test: pin /api/gate fail-closed, the beacon allowlist, and verify mismatch - #115
Draft
cursor[bot] wants to merge 7 commits into
Draft
test: pin /api/gate fail-closed, the beacon allowlist, and verify mismatch#115cursor[bot] wants to merge 7 commits into
cursor[bot] wants to merge 7 commits into
Conversation
…WT that must not carry an address The delivery confirmation route, the key-box callback, and questionnaire JWTs shipped without tests. Pin fail-closed auth, write-once pdf_delivered_at, GPC/DNT opt-out, and session tokens that verify as hashes not mailboxes. Read KEYBOX_RENDER_* and RENDER_CALLBACK_* on each call (same boot-order trap jwt.ts already documents) so the tests can set them, and so a missing .env at import cannot lock the consent path into "unavailable" forever. Co-authored-by: Ralphie B. <nyagrodha@users.noreply.github.com>
… nowhere These suites already existed or just landed; the check job never invoked them. Add --allow-write for keystore temp dirs. Leave tests/ out: it still carries the pre-existing type errors that fail before any test executes. Co-authored-by: Ralphie B. <nyagrodha@users.noreply.github.com>
…dentity These contracts lived under tests/ (which CI cannot type-check) or skipped whenever typst/qpdf were absent. Colocate them next to the production code and run them on the check job so a hostile session id, a forged X-Forwarded-For, or a guessed "yes" cannot regress silently. Co-authored-by: Ralphie B. <nyagrodha@users.noreply.github.com>
️✅ There are no secrets present in this pull request anymore.If these secrets were true positive and are still valid, we highly recommend you to revoke them. 🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request. |
…match The /gate page still posts answers through /api/gate, which had no tests. These pin fail-closed encryption, the public metrics allowlist, magic-link token mismatch before the database, wearable token format, DATABASE_URL parsing, and rust-server connection-string redaction. Co-authored-by: Ralphie B. <nyagrodha@users.noreply.github.com>
cursor
Bot
force-pushed
the
cursor/missing-test-coverage-e5d1
branch
from
September 5, 2026 10:17
d69d5e0 to
757dc37
Compare
This was referenced Sep 6, 2026
Keep production's lib/gate_encrypt_test.ts on the check job alongside the delivery, auth, and audience suites this branch already added. The two edits collided on the same deno test path list after #113 landed. Co-authored-by: rbauer <rbauer@colorado.edu>
Union CI path lists so /api/gate fail-closed, the beacon allowlist, and verify-mismatch suites sit next to the stacked delivery/consent tests. Keep this branch's rust-server cargo test job. Co-authored-by: rbauer <rbauer@colorado.edu>
cursor Bot
pushed a commit
that referenced
this pull request
Sep 7, 2026
Keep both rust-server test suites: store bounds / recipient fail-closed from this branch, and DATABASE_URL redaction from #115. Union the CI Deno path list so profile, metrics, and gate page tests sit next to the stacked coverage. Co-authored-by: rbauer <rbauer@colorado.edu>
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.
Coverage for production paths that shipped without tests, and that #112/#114 do not already pin.
Risky behavior now covered
POST /api/gate): the/gatepage still posts answers here one question at a time. Unparseable or out-of-range bodies never reach the Rust service. An unreachable or rejecting gate is 503 before the INSERT, and the client error never carries answer text or the gate's body. A well-formed answer is posted to/api/storewithoutX-Gate-Key. Thefresh_gate_responsesINSERT still binds NULL for both plaintext answer columns.POST /api/metrics/increment): only the allowlisted names move a counter. A server-only funnel name (funnel.gate.q1_answered) is a silent no-op. Allowed and disallowed responses are the same 200{ ok: true }withCache-Control: no-store, so the list cannot be walked by status code. Membership is exact, not a prefix.GET /auth/verify): missing tokens, a garbage JWT, and a resume token that does not hash to the JWTsession_idall fail before the database and set no cookie. Failure pages do not echo the email, the JWT, or the resume token.GET /w/:token): traversal-shaped, short, long, and punctuation tokens 404 before any query and set no cookie, so the page is not an existence oracle.sslmode=requireis in the URL; a remotesslmode=requireenables it; URL-encoded password characters are decoded; an unparseable URL is not a config.redact_db_url): userinfo is stripped, including a password that itself contains@. A schemeless string is<redacted>, not echoed.Test files added/updated
routes/api/gate_test.ts(new)routes/api/metrics/increment_test.ts(new)routes/auth/verify_test.ts(new)routes/w/token_test.ts(new)lib/db_config_test.ts(new)lib/db.ts—_resolveConfigForTesthook onlyrust-server/src/main.rs— unit tests forredact_db_url.github/workflows/ci.yml— these Deno suites, pluscargo testfor the gateWhy these tests materially reduce regression risk
/api/gateis the other door answers enter through. #113 collapsed the questionnaire ontolib/gate_encrypt.tsand tested that client plus/api/questions/answer; this endpoint was still untested, so a plaintext INSERT or a 200-on-gate-down path would ship again. The beacon allowlist is public: a prefix match or a leaked 4xx would let anyone invent conversions the daily report treats as truth. Verify mismatch before the database is what stops a stolen JWT fragment from minting cookies. Wearable format 404 is what keeps a printed token from becoming an oracle or a cookie injection.redact_db_urlis the line that logsDATABASE_URLon every gate start — the password used to go to journald.Hermetic: fetch is stubbed,
DATABASE_URLis unparseable, no SMTP, no Postgres. No production behavior changes.