Skip to content
Toolkit

ADR-0098 — A gate holds on every door into the page

Status: Accepted · Date: 2026-08-29 · Track: 007-enforcement, phase 02 close-out

Context

ADR-0092 gates /l/{slug}: a password-protected resource 302s to an interstitial, and the destination appears in no response until a grant is presented. That is true, and it was never the only way to ask for a biolink.

/api/public/biolinks/{slug} is the endpoint the public page actually fetches. It has its own handler, it took no part in the gate, and it answered anyone:

GET /api/public/biolinks/{slug}
{"data":{"blocks":[{"settings":{"text":"CONFIDENTIAL BLOCK BODY"}, …}],
          "settings":{"password":"hunter2","title":"Secret Page"}, …}}

Three defects, one request.

The page was not gated. Every block of a password-gated biolink was served to an unauthenticated caller. The interstitial on /l/{slug} was a door beside an open window.

The payload was the stored blob. ADR-0083 narrowed the anonymous biolink payload to an allowlist of seven keys, and check:secrets rule S2 holds it there — for redirect.go. This second endpoint served link.Settings wholesale, so whatever the gate was checking went out with the page.

And what it served was the plaintext. ADR-0083 hashed the gate password on every write path it enumerated. handlers/biolinks.go was not among them, and it is the write behind the one resource type with an anonymous public payload. It never names password — it takes the settings map whole and puts it on the link — so rule S1, which looks for a handler that writes the key, could not see it. The plaintext arrived, was stored, and was served.

The three compound: the leak needed a write path that did not hash, a payload that did not narrow, and a serving path that did not gate. Each was the absence of code, which is what ADR-0083 already observed does not show up in a diff.

Decision

Every path that serves a resource anonymously enforces the gates on it, and serves the same allowlist. Concretely:

  1. public_biolink.go evaluates all three reasons in the redirect path's own order — password, sensitive, splash — and a closed gate answers with the reason and nothing else: no blocks, no settings, no owner, no pixels, and no recorded view, because a visitor at a closed gate has resolved nothing.
  2. It verifies grants with the same LinkGrantService the redirect path and the unlock endpoint use. One issuer, one verifier: a second would be a second place for the two halves of a gate to disagree. A grant names the gate it answered and is scoped to one link (ADR-0093), so an acknowledgment cannot open a password gate here either. No verifier wired means a gate that can never be answered, not one that is always open.
  3. It serves publicBiolinkSettings(...), the allowlist redirect.go already serves — not a second list.
  4. biolinks.go normalizes the gate password on create and update, as the four other write paths do.

The refusal is a door, not a document, which is ADR-0092's rule one layer up: the reason travels so the page can send the visitor to the interstitial that already exists, and the unlock endpoint returns them with a grant. The public page redirects on gated rather than drawing a second password form.

Consequences

A gated biolink is no longer readable by asking for it a different way, and the gate password — plaintext or digest — reaches no anonymous caller.

check:secrets grows to match the defect rather than the shape of the last one:

  • S1 gains a second test. A handler that stores a caller-supplied settings map must hash, whether or not it names password. The rule that only looked for the key is exactly why this path went unnoticed.
  • S2 covers both anonymous endpoints, not the first one found.
  • S4, new, requires the fetched endpoint to check a gate and verify a grant.

The three gate rows in the enforcement ledger now name both serving paths, and check:enforcement's E1 validates every path a row lists rather than only a lone string — a row naming a list used to skip the check entirely, which would have let this widening rot silently. Reader anchors 56 → 65.

All five are watched failing: the write path stops hashing, the payload serves the blob, the gate check goes, the grant verification goes, and a row names a file that does not exist.

What this does not do is give the public page a door of its own. It reuses phase 02's interstitial, so the wording, and whether an acknowledgment is remembered, remain charter blocker 3 and still the owner's.

Existing rows are not migrated. Any biolink whose password was stored in plaintext before this keeps that value in links.settings.password, where no serving path now reads it and no payload now serves it; the next write through the editor replaces it with a digest. A migration that drops the key is the shape migration 000032 already used for ADR-0083 and is one PR, not this one.

Source: docs/decisions/0098-a-gate-holds-on-every-door-into-the-page.md

Library