Skip to content

test(security): regression pass over the OpenAPI, visibility and key surface (#868) - #1221

Merged
athvin merged 5 commits into
mainfrom
issue/868-epic-security-pass
Nov 25, 2026
Merged

athvin merged 5 commits into
mainfrom
issue/868-epic-security-pass

Conversation

@athvin

@athvin athvin commented Nov 25, 2026 •

Copy link
Copy Markdown
Owner

Closes #868

🚧 Claimed by an agent session — 2026-11-25T09:15:54Z, session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on brians-MacBook-Pro.
The claim is this open draft PR: closing it releases the ticket.

Post-merge is part of this pull request. The ledger below records whether
the follow-up work actually happened. /land-pr closes it.

What

The OpenAPI epic's adversarial close (#857). Every claim it makes about what a client cannot see is now a test in the named harness, and each test was observed failing for the right reason before it landed.

Why

A guard whose precondition always holds is decoration (the security skill's harness-first rule).

Proof

make check: 1,168 passed, 0 failed. er-server --tests against Postgres: 399 passed. Per bullet, with the mutation that proves each one:

  1. Public-document leak (openapi.rs, the_public_document_exposes_no_internal_surface). It derives everything from the entity catalog rather than a hand-kept list, with floors of more than 50 paths and at least 3 non-public columns. Three mutations, each failing the test:
    • Drop the filter's operator arm: operator operation get /v1/audit is in the public document.
    • Drop the internal-path arm: internal path /v1/internal/attempts/{attempt_id} is in the public document.
    • Inject key_hash into the public ApiKey schema: ApiKey.key_hash (Internal) is in the public document.
  2. V19 secret-column lint (the ticket's "V18"; the registry now numbers it V19). A verification pass: both fixture directions already exist. V19_public_secrets must fail and V19_internal_secrets must pass. Disabling the exact-name arm of the rule (let secret = false && matches!(…)) fails fixtures::every_fixture_matches_its_expectation on V19_public_secrets.
  3. Key-minting family (pg_auth.rs, from Self-service API keys: org-admin minting with a role ceiling, list endpoint, show-once UI #866, re-run here and passing). Covers: cross-org mint 404, steward and viewer 403, operator 422, plaintext shown once, and a list with no hash and no plaintext. Mutation, recorded on feat(api): self-service API keys — admin minting with a role ceiling, list, show-once UI (#866) #1216: putting back operator_only on mint fails it.
  4. BFF authz (bff-authz-gate.test.ts).
  5. Serialization (tests/wire_serialization.rs). No Json(json!(<ident>)) in lib.rs product code: the shape that serializes a whole struct, internal columns included. Test modules are stripped by brace matching, and the detector is asserted against positive and negative samples.

Risk & rollback

Tests only, with no product code changed. Rollback: git revert <merge-sha>.

Post-merge ledger

Closed by: agent · session Claude Code:d1e3b2dc-3174-4091-9c30-c08fc4820306 on Mac · 2026-11-25T10:08:37Z

Specific to this change

Context — plan, discoveries, measurements, files

Plan

Discoveries

Serialization review (a written finding, as the ticket allows).

  • lib.rs has 70 Json(json!( sites. All are object literals with their keys spelled out.
  • No product handler serializes a bare value. The only json!(<entity>) uses are in test modules, comparing an entity against its *Wire form.
  • json!(env_map) and its kin are internal values written to Postgres, never responses.
  • So no handler serializes a non-wire entity on a client path. The new source test pins the most direct way that could come back.

Findings: zero open. No real vulnerability was found. The one production defect found during this work, the deploy-digest pagination bug, was not a security issue. It was filed as #1223 and fixed in #1224.

Measurements

Files

rust/crates/er-server/src/openapi.rs, rust/crates/er-server/tests/{wire_serialization.rs,main.rs}, frontend/tests/unit/bff-authz-gate.test.ts

@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

The marketing preview was removed because this PR is closed or merged.

bmoore813 and others added 5 commits November 25, 2026 01:49
One derived guard over openapi.public.json: no /v1/internal/ path, no
operation whose bearer role is operator, and no column of any entity
whose visibility is not public, read from the catalog rather than
listed. Floors (more than 50 paths, at least 3 non-public columns
checked) keep it from passing vacuously.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e wire (#868)

bff-authz-gate: the real #866 key routes with their guard renamed away
are reported (GET and POST, DELETE), and pass as written. Removing
'openapi' from UNAUTHENTICATED_DIRS was observed failing the coverage
test.

wire_serialization: no Json(json!(<ident>)) in lib.rs product code, the
shape that serializes a whole struct (internal columns included). Test
modules are stripped by brace matching, and the detector is itself
asserted against positive and negative samples.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
@athvin
athvin force-pushed the issue/868-epic-security-pass branch from ad7624a to 5c19762 Compare November 25, 2026 09:49
@athvin
athvin marked this pull request as ready for review November 25, 2026 09:49
@athvin
athvin merged commit b3c93d7 into main Nov 25, 2026
43 checks passed
@athvin
athvin temporarily deployed to marketing-preview November 25, 2026 09:57 — with GitHub Actions Inactive

This branch was previously deployed

1 inactive deployment
marketing-preview — 5c197624 Deployed Nov 25, 2026 by athvin via remove closed PR previews #50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security regression pass over the OpenAPI/visibility/key surface

2 participants