Repository navigation
Fix: Resolve bug security and sidebar - #70
Merged
Merged
Conversation
Development
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Describe what changed and why.
Fix: redirect a /bootstrap al arrancar y sidebar ausente tras el login
1. Redirect a
/bootstrapen la primera petición (src/hooks.server.ts)Problema: el
authGuardconsultabaisBootstrapCompleted()sin esperar a que terminase elarranque (clon de GitDB,
ensureAuthReady,refreshBootstrapState). Mientras tanto el estadoen memoria vale "pendiente" por defecto, así que la primera petición se redirigía a
/bootstrap.hooks.server.tscon la primera petición./health.Impacto de seguridad: durante esa ventana el wizard (que no pide login) creía que no había
administrador, así que un POST a
createAdministratorpodía crear uncluster-adminen uncluster ya inicializado. Si el arranque fallaba, el estado se quedaba en "pendiente" y el
wizard quedaba abierto de forma permanente.
Solución: el guard espera a
serverReadyantes de evaluar el estado de bootstrap, salvoen
/health, que debe seguir respondiendo 503 mientras arranca. Si el arranque falla, sedevuelve 503 (JSON en
/api, texto plano en el resto) en lugar de redirigir al wizard.2. El sidebar y el navbar no aparecían tras el login hasta refrescar (
src/lib/page-store.ts)Problema:
createPageStorehacíatoStore(() => page).page(de$app/state) es siempreel mismo objeto, con getters reactivos que esa función no leía, así que el store nunca volvía
a emitir y
$page.urlse quedaba congelado en la primera página cargada. Tras el login(
use:enhance, navegación en el cliente) el layout seguía viendo/auth/loginy no pintabael shell.
Solución: el store lee explícitamente
url,params,route,status,error,data,formystate, y emite un objeto nuevo en cada navegación. Afecta a todos los consumidoresde
createPageStore, por ejemplo el resaltado del elemento activo en el sidebar.Cómo probar
bun run devy recargar: la primera petición tarda lo que tarda el arranque ylleva a
/auth/logino a/, no a/bootstrap.Checks
bun run check: 0 erroresbun run test: 291/291 pasanbun run lint: 5 errores en archivos que esta PR no toca (vault,CveDetailView.svelte)🤖 Generated with Claude Code
Related issue
Closes #
Change type
Verification
bun run checkbun run lintbun run testbun run format:checkReview notes
Mention migrations, environment variables, security implications, screenshots, known limitations, or follow-up work. Confirm that logs and screenshots contain no secrets.