fix(#622): the auth-config applier can no longer half-apply a secret-bearing feature - #623
Merged
Merged
Conversation
…ng feature `auth-config.json` is committed, so it holds no secrets — but two of the features it declares need one, and the Management API takes it as a sibling field: smtp_host, smtp_user, … need smtp_pass security_captcha_enabled needs security_captcha_secret `--apply` sent the visible fields and omitted the secrets, which is strictly worse than the drift it claims to fix. SMTP with no password sends NOTHING — a downgrade from the built-in fallback mailer. CAPTCHA with no secret REJECTS EVERY SIGNUP. This is not hypothetical. On 2026-08-07 the drift check told an operator to run exactly this command against a production project whose smtp_host was null. Now each secret is sourced from env (falling back to .env, since nothing preloads dotenv here), and when it is absent the feature's fields are withheld ENTIRELY rather than half-applied — a visible gap beats a config that looks applied and silently does nothing. If every proposed change gets withheld, exit 1. TURNSTILE_SECRET is the name scripts/check-captcha.mjs already uses; run that first — it validates the secret against Cloudflare siteverify. Verified against production: with TURNSTILE_SECRET unset, `--apply` withholds both captcha fields, applies nothing, and exits 1. The attach path runs only under --apply and is unverified until a real secret exists. Closes #622
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.
The bug
scripts/supabase/auth-config.jsonis committed, so it holds no secrets. But two ofthe features it declares are broken or dangerous without one, and the Management API
takes the secret as a sibling field in the same PATCH:
smtp_host,smtp_user, …smtp_passsecurity_captcha_enabledsecurity_captcha_secret--applysent the visible fields and omitted the secrets — so the command the driftcheck recommends could leave production strictly worse than the drift it "fixed".
Not hypothetical: on 2026-08-07 the drift check told an operator to run exactly this
against a production project whose
smtp_hostwasnull. Details in #622.The fix
Each secret is sourced from env, falling back to
.env(nothing preloads dotenv forthis script, so a normal local shell would otherwise read every secret as absent).
When a secret is missing, that feature's fields are withheld entirely rather than
half-applied, with a message naming the harm. If everything gets withheld, exit 1.
TURNSTILE_SECRETis the namescripts/check-captcha.mjsalready uses — one name persecret. Run that script first; it validates against Cloudflare
siteverify.Verification
Against production, with
TURNSTILE_SECRETunset:Nothing was changed. Before this PR that same invocation would have enabled Turnstile
with no secret.
Stated limitation: the attach path runs only under
--apply, so it is exercisedonly when a real secret exists — I did not fake one against production. It will be
verified when the Turnstile secret is restored (the "attaching …" line, plus the drift
check going green).
Closes #622