Skip to content
Toolkit

ADR-0083 — A gate password is a digest, and the public payload is an allowlist

Status: Accepted · Date: 2026-08-29 · Track: standing repairs (security)

Context

The password a visitor types before a protected resource opens — password protection in the glossary, billed through 004's password_protection capability — was stored in links.settings as the string the owner typed. Five write paths put it there: the generic link settings blob (create and update), both file-link forms, both static-page forms and the event create.

serveBiolinkPage then returned link.Settings wholesale to anonymous callers. So the password left the server, in the clear, to anyone who asked for the page — together with the click limit, the expiration URL, the sensitive-content flag and the cloaking script.

Both halves were the absence of code rather than a wrong line: no hashing call on the way in, no allowlist on the way out. That is why the defect survived review, and it is why this ADR ends with a gate rather than a fix.

The serving-path enforcement of the gate — the interstitial, the unlock endpoint — is 007's. This decision is only about how the secret is stored and what an anonymous caller is served.

Decision

1. A gate password is stored as a bcrypt digest, under its own key. services.NormalizeGatePassword turns the plaintext a write path accepted into password_hash; password is never a key of a stored settings map. Every one of the five write paths calls it. bcrypt at DefaultCost, the same primitive the account passwords already use.

2. Silence carries the gate forward; only an empty string clears it. A settings blob replaces what was stored, so the three cases are distinct:

the write saysthe resource
nothing about passwordkeeps the digest it had
password: ""loses its gate
password: "…"takes a new digest

This exists because the owner's form can no longer prefill the password: it has never seen it. Without carry-forward, editing a link's UTM tags would silently un-gate it. Without the explicit empty, nothing could ever remove a gate — which is the shape of the file-form defect already recorded as 004's residue, and this decision declines to add a second instance of it.

3. A password_hash posted by a caller is dropped. A digest is derived on the server or carried forward from storage. It is never accepted from the wire, so a digest read back before this repair cannot be replayed onto another resource.

4. The anonymous biolink payload is an allowlist, not the blob. publicBiolinkSettings serves exactly the seven keys the public renderer reads: background_color, text_color, btn_background_color, btn_text_color, image, title, description. An absent key stays absent — the renderer's own defaults are better than an empty string painted over them. This is 005's phase 00 rule in the other direction: a payload is served only as far as a consumer reads it.

5. Pre-existing plaintext is dropped, not converted. Migration 000032 removes the password key from links.settings. bcrypt is not available in SQL on this deployment (no pgcrypto, and adding an extension is a dependency this repair will not take on), and a secret that reached the database in the clear cannot be re-derived. Dropping it removes no protection: nothing on the serving path has ever read the key, so the gate was never in force. What an owner loses is a value they must type again — the same thing a rotation after a leak would cost them, and the value was leaking. The down migration is a stated no-op: the plaintext cannot come back, and dropping the digests instead would un-gate every resource protected since the release.

6. The owner's own read still carries the digest. Narrowing an authenticated resource payload is the /api/v2/ shape question ADR-0078/0079 already parked, and the owner set the password. The web form reads the digest's presence to know a gate exists, and never its value.

Consequences

  • npm run check:secrets (scripts/check-secret-storage.mjs) holds all of it: S1 — a handler that writes the plaintext key also hashes in the same file; S2 — the anonymous payload serves the allowlist and the allowlist never names a secret; S3 — every settings key a public renderer reads is in the allowlist. S3 is the drift rule, because the natural fix for a key that renders as missing is to serve the whole blob again. All four watched failing (evidence .station/jobs/005-i18n/evidence/repair-password-leak-gate-2026-08-29.md).
  • The link detail form gained a Remove password protection toggle, which is the only thing an empty field used to mean and can no longer say.
  • 007 inherits services.GatePasswordMatches for its unlock endpoint, so the comparison is written once and in constant time.
  • Operators upgrading past 000032 should tell owners of protected resources to set the password again before 007 turns the gate on.

Source: docs/decisions/0083-a-gate-password-is-a-digest-and-the-public-payload-is-an-allowlist.md

Library