sec: control-plane hardening batch (5 deepsec findings)#17
Merged
Conversation
Batch of self-contained control-plane fixes flagged by the Svalinn/deepsec scan. No schema or data-plane change; deploys with the control-plane container. - Timing-safe bearer-token comparison (index.ts): replace the three bare `===`/`!==` token checks (global /v1 guard, Skuld enqueue bypass, /migrate handler) with a constant-time `secretEqual` (crypto.timingSafeEqual, length guarded). The /migrate path is the most exposed — it's the first guard a request hits after the middleware bypass. [MED eb871abc / card b87fd284] - SQLi via unescaped identifier (zero.ts): wrap config.zeroDb with an ident() helper in the CREATE/ALTER DATABASE DDL, matching provision.ts. A stray `"` in HAULDR_ZERO_DB could otherwise break out of the identifier. [MED e1aba8d1 / card 78649811] - TOCTOU in provisionStorage (storage.ts): guard the read-check-mint-update with a transaction + pg_advisory_xact_lock(hashtext(name)) so two racing provisions of the same project can't both mint a Garage key (the loser's key would be orphaned with live bucket access, untracked, unrevokable). [BUG 56281121 / card d62c24c2] - storageReady excluded from auto-heal gate (lifecycle.ts): add storageExpected to the allReady conjunction so a project whose storage sidecar is still unhealthy isn't flipped to 'live' with services.storage.ready=false. [BUG 41fb8f44 / card 71d4dedc] - Misleading apiKey comment (config.ts): the middleware fails CLOSED (503) when HAULDR_API_KEY is empty; the comment said "Empty = open (dev only)". Fix the comment so nobody "restores" the documented-but-false open behaviour. [BUG 502d50e7 / card 822ea084] Deploy deferred: accumulate on main; roll out by recreating only the control-plane container in a window (app 'hauldr' bundles the shared fleet DB). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Lote de fixes self-contained do control-plane (Svalinn/deepsec). Sem mudança de schema/data-plane; deploya com o container control-plane.
secretEqual/timingSafeEqual) nas 3 checagens (/v1, bypass skuld, /migrate)ident()noconfig.zeroDb(CREATE/ALTER DATABASE)pg_advisory_xact_lock+ transação no provisionStoragestorageExpectedno gate allReady (auto-heal)Verificação
jobs.ts/pg-boss).secretEqual(equal/diff/len/empty) +ident()(escapa"→ injeçãofoo"; DROP...vira nome de DB, não executa).Nota (TOCTOU)
O advisory lock resolve a corrida concorrente (2 callers mintando). Uma falha parcial (mint OK, UPDATE falha) ainda pode orfanar 1 chave — caso pré-existente e mais raro; a serialização cobre o que o finding pede.
Deploy
Não deployar agora. Acumula na main; rollout numa janela recriando SÓ o container
control-plane(apphauldr= compose com o Postgres compartilhado). Junta com os Cards 1-2.🤖 Generated with Claude Code