Skip to content

Public projections: allowlisted operational fields, proven with fast-check - #85

Merged
Oba-One merged 5 commits into
mainfrom
claude/trust-public-allowlists
Nov 22, 2026
Merged

Oba-One merged 5 commits into
mainfrom
claude/trust-public-allowlists

Conversation

@Oba-One

@Oba-One Oba-One commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

Why

Plan item 20: "no payload type can carry email, raw note, pending submission". Map nodes, map state and the impact payload already build their output field by field. Operational records did not: PublicOperationalRecord was { slug; id; [key: string]: any }, and normalizeRecord spread every field its source carried. Only a denylist (containsPrivateOperationalContentField) stood between a new Directus column and the public site.

Measured

  • Agent: claude-code, model claude-opus-5-5, effort high
  • PUBLIC_OPERATIONAL_RECORD_FIELDS in packages/shared/src/public-content.ts lists each collection's top-level public fields. Each list equals the keys the latest content.public_* view emits, the seed files carry and the committed snapshot holds. Chapters also read imageAlt, imageCredit and imageFileId, which the image resolver consumes.
  • The snapshot keeps only those fields. The pick runs after the quarantine check, so quarantine alerts still fire for a private-looking field, and the project guild filter runs before it. It iterates the record's own keys, so a regenerated snapshot keeps its key order.
  • The record types now name their fields (PublicChapterRecord and the rest; PublicOperationalRecord is their union). An unlisted field does not type-check. Nested values stay under the existing denylist scan and quarantine.
  • scripts/public-projection-allowlist.test.ts (fast-check, 300 runs per property):
    • Each collection: a committed record plus random extra fields (random names and known private names, holding a sentinel secret) publishes exactly what the record alone publishes. A private-looking extra quarantines it instead. The sentinel never appears.
    • A private key nested inside a published object value never publishes its value.
    • Map nodes: an approved submission with private fields and extras publishes only PUBLIC_MAP_NODE_FIELDS, with no private field or value. Pending, rejected, archived, blank and missing statuses are never published.
    • Map state chapter and submitted nodes carry no private field or value.
    • The impact payload never carries raw upstream feedback, media or notes, at the top level or inside the project, milestone or garden.
    • Type-level: @ts-expect-error lines prove that an email, raw note, pending revision or review note does not fit the public types. If the types ever regain an index signature, the typecheck fails.
  • fast-check 4.10.3 (and its one dependency, pure-rand 8.4.2) added as an exact root devDependency through the release-age gate, approved by afo in the session.
  • The AGENTS.md privacy row names the new test and the allowlist: a new Directus column reaches the site only once listed.

Verification

Tier: critical (packages/shared/src/public-content.ts) and agent image (packages/shared/src/**, package.json, bun.lock): merges only on afo's go, pinned to the head. Head: f7cc40d4cd4c8285f5056ebcab90a1069b37a35c.

  • Full gate green at the head: PR checks (typecheck including the @ts-expect-error type test, lint, every test file, website build, size budget), Database proofs, em dashes, supply chain, agents doctor, CodeQL. Rendered proof does not apply: the snapshot content is unchanged (the committed-snapshot round trip passes), so no page renders differently.

  • The first CI run (31f2f20) failed, which was useful: the properties found private values that the old denylist let through when nested inside a published object (featuredStory.request_ip, media.request_metadata, media.consumed_at, impactSources.mediaUrls, cadence.works). 3112d44 makes the operational scan match the map-node and impact private names exactly. Against the old scan, the nested properties fail for every collection with object values; with the fix, all 17 properties pass locally (bun test scripts/public-projection-allowlist.test.ts) and in CI.

  • No key in the committed snapshot or the seed files matches the new private names, so no current record is newly quarantined.

  • bun test scripts/public-content-contract.test.ts scripts/map-node-contract.test.ts: 139 pass.

  • Fresh adversarial review of 3112d44: approve. It confirmed the lists equal the views' keys, nothing the website or locations or impact bindings read is dropped, the type test is type-checked, and the lockfile adds only fast-check and pure-rand within the release-age gate (fast-check published 2026-11-18, about 3.5 days before the commit). Its non-blocking notes are addressed in 503620d (arrays of objects fuzzed, key order asserted, one key normalizer, a comment on generic names failing closed), which a second fresh review approved.

  • After afo's first go (at 503620d), Codex found that the pick dropped the latitude/longitude aliases before map locations were built. b52f8c9 builds locations and impact bindings from the checked records before the pick, with a test that fails without it; a fresh review approved b52f8c9. f7cc40d only types that test's lookup (CI typecheck); bun run typecheck passes locally, 18 properties pass, and the full gate is green at f7cc40d. The fast-check thread is answered with afo's approval quote.

Not verified

  • Production records carrying a top-level field outside the lists would now be dropped. The lists equal the views' keys, so none should exist, but this is checked against the views and the committed snapshot, not against production rows.

🤖 Generated with Claude Code

…en with fast-check

Plan item 20. An operational record used to carry every field its source
held (`[key: string]: any`), guarded only by a denylist. Now:
- PUBLIC_OPERATIONAL_RECORD_FIELDS lists each collection's top-level public
  fields, matching the content.public_* views and the committed snapshot
- the snapshot keeps only those fields, after the quarantine check (so its
  alerts still fire) and in the record's own key order
- the record types name their fields; an unlisted one does not type-check
- scripts/public-projection-allowlist.test.ts proves with fast-check that
  extra and private fields (known names and random ones, at any depth)
  never reach operational records, map nodes, map state nodes or the
  impact payload, and that unapproved submissions are never published
- fast-check 4.10.3 added as an exact devDependency (approved by afo)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Model: claude-opus-5-5/high
@coderabbitai

coderabbitai Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 2 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 04c63579-7213-46c1-ac86-90f46003abe1
Commits

Reviewing files that changed from the base of the PR and between cbeda33 and f7cc40d.

Files ignored due to path filters: 1

  • bun.lock is excluded by !**/*.lock
Files selected for processing: 4

  • AGENTS.md
  • package.json
  • packages/shared/src/public-content.ts
  • scripts/public-projection-allowlist.test.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Oba-One and others added 2 commits November 21, 2026 16:57
…ecords

The fast-check properties found private values that the operational scan let
through when nested inside a published object: media.request_metadata,
featuredStory.request_ip, media.consumed_at, impactSources.mediaUrls,
cadence.works. The scan now also matches, exactly, the private names the map
node and impact contracts list (impact's media aside, a public operational
field), plus a steward-note pattern. No key in the committed snapshot or the
seed files matches the new names.

The test model now expects workflow fields (reviewedBy and the like) to be
stripped rather than quarantined, keeps media and media.reviewStatus as
public operational names, and gives each property a 60 s limit so a loaded
machine cannot fail it on time.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Model: claude-opus-5-5/high
…key normalizer

From the adversarial review of PR 85 at 3112d44 (all non-blocking):
- the nested property also plants private fields inside arrays of objects
  (links, stewards, proof signals, public members), and asserts that themes
  is the only collection with nothing nested rather than skipping silently
- the extras property checks that published key order matches the record's
- the duplicate key normalizer is gone; the comment on the known private
  names says generic ones fail closed and raise the quarantine alert

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Model: claude-opus-5-5/high
@Oba-One
Oba-One marked this pull request as ready for review November 22, 2026 01:16
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-22T01:31:37.771169Z b52f8c9 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 503620d1ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json Resolved
Comment thread packages/shared/src/public-content.ts Resolved
Oba-One and others added 2 commits November 21, 2026 17:27
…fore the pick

From Codex on PR 85: toPublicOperationalLocations accepts latitude and
longitude aliases, but the pick removed them before the locations were built,
so such a chapter would have left /locations.json. Locations and impact
bindings build explicit payloads, so they now read the records that passed
the quarantine check; the published chapter still carries only its listed
fields. A test covers the alias case and fails without this change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Model: claude-opus-5-5/high
CI typecheck at b52f8c9: seo on a Record<string, unknown> is unknown.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Agent-Model: claude-opus-5-5/high
@Oba-One
Oba-One merged commit 779dbdc into main Nov 22, 2026
10 checks passed
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.

1 participant