Skip to content

fix: resolve confirmed Codex P1 findings on merged PRs (batch 1) - #5683

Merged
Sinity merged 9 commits into
masterfrom
claude/codexdebt
Sep 28, 2026
Merged

Sinity merged 9 commits into
masterfrom
claude/codexdebt

Conversation

@Sinity

@Sinity Sinity commented Sep 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

First batch for bead polylogue-1tyq5: unhandled Codex P1 findings on PRs merged 2026-08-20..09-27. The survey's "340" was one finding per file; the real count of P1 threads whose cited code still exists is 945. This PR fixes the defects confirmed in this pass and records a disposition for every finding in the bead.

Problem

Codex review threads were never answered on merged PRs. A sample showed several still describe live defects, including identity-affecting ones that must land before the fresh build.

Solution

Fixed (each with the finding it resolves):

  • Identity: Gemini thoughtSignature(s) no longer enter hashed block metadata (provider re-signs on replay, like Claude's thinking signature); a Decimal that does not round-trip through float is hashed as a tagged exact value, so it neither collides with a neighbouring float nor with an equal string.
  • Fail closed: ZIP replay recovers a provider from the origin only when that origin names exactly one provider; the non-injective AI Studio/Drive origin reports replay_provider_unrecorded instead of a guess.
  • Excision: raw admission raises ContentExcisedError, the class the ingest loops catch, so one excised file is skipped instead of aborting the batch; the now test-only assert_admissible is removed.
  • Schema fast-forward refuses transaction-control statements before executing them.
  • pytest-heavy (where verify_all runs) counts as pytest-slot ownership.
  • Browser tooling: the live-provider proof binds to the extension it just loaded (by derived id) and restores the operator's receiver settings on SIGINT/SIGTERM; its capture scratch is private and removed; compact ChatGPT captures are labelled native_compact, not native_full.
  • Deleted with no remaining consumer: devtools/clone_support.py (test-only), devtools/source_storage_evaluation.py (no caller). The earlier deletion of .github/workflows/verify.yml was dropped on rebase: master has since made it an on-demand (workflow_dispatch) route and edited it, so this PR leaves it as master has it.
  • Review round (e2b228f): a mapping key spelled $decimal is escaped so no mapping hashes like a tagged exact Decimal; the fast-forward transaction-control refusal skips SQL comments; thought signatures on non-thinking parts become session evidence.

Dispositions across all 945: see the bead note. Findings in files mid-change in other open PRs are listed per PR for those owners; the rest are grouped by area for batched follow-up.

Verification

  • devtools test over agent_env, schema_fast_forward, hash vocabulary, pipeline ids, export member addressing, parsers_drive, live_provider_proof_service, backup, verify: 307 passed, 8 failed (both causes were in this branch and fixed); re-run of backup, schema_fast_forward, export member addressing, excision policy and acquisition excision tests: PASSED.
  • node --check on both edited extension scripts.
  • devtools schema closure: pipeline/ids.py and security/excision_policy.py are IN (identity moves; must land before the fresh build); the other production files are out.

Residuals

Most P1 findings are still unverified (listed per area/PR in the bead); P2 findings are a later pass.

🤖 Generated with Claude Code

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for security reviews. Please try again later.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-28T08:28:07.800331Z 850803f 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: 7bd5736d32

ℹ️ 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 polylogue/pipeline/ids.py Resolved
Comment thread devtools/schema_generate.py Resolved
@Sinity
Sinity enabled auto-merge (squash) September 27, 2026 21:26

@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: c3375ca84b

ℹ️ 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 polylogue/pipeline/ids.py Resolved
Comment thread devtools/schema_fast_forward.py Resolved
Sinity and others added 8 commits September 28, 2026 09:30
…part signatures

- A mapping key spelled `$decimal` (or with more leading `$`) gains one
  `$` in the hash walk, so no admitted mapping hashes like an exact
  Decimal's tagged form.
- Schema fast-forward finds a statement's leading keyword past
  whitespace and SQL comments, so `-- note\nCOMMIT;` is refused before
  it runs.
- A thought signature on any block type becomes session evidence;
  parsed_blocks_from_meta strips it from every block, so evidence must
  cover every block it strips from.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6

@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: e2b228fabc

ℹ️ 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 polylogue/pipeline/ids.py Resolved
Comment thread devtools/schema_fast_forward.py Resolved
- Session-event payload keys declared replay-volatile
  (`thoughtSignature`/`thoughtSignatures` on gemini_thinking_evidence)
  are kept as evidence but excluded from every event hash projection, so
  a signature-only change moves neither the session hash nor the event
  identity.
- The fast-forward transaction-control refusal skips a U+FEFF BOM, which
  SQLite treats as whitespace.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01P8nGdByCWAzpk78ko2xza6
@Sinity
Sinity merged commit 8ad05c8 into master Sep 28, 2026
3 checks passed
@Sinity
Sinity deleted the claude/codexdebt branch September 28, 2026 08:29
Sinity added a commit that referenced this pull request Sep 29, 2026
## Summary

Closes the fail-open security findings from the bug sweep: n3xdn,
qut1/l6v61, dahse, dzk48, 8k10u, mdlft.

## Problem

- **n3xdn:** shell HTML (`/`, `/sessions`, `/s/:id`, `/search`, `/w`,
`/p`, `/a`, assets) was served to any loopback client without a
credential, and `POST /api/web-auth/session` minted a first-party cookie
for any loopback request. Any local uid could read every archived
transcript even with a bearer token configured.
- **qut1/l6v61:** page scripts share the content script's realm; they
could trigger captures with synthetic clicks and supply the identity a
MAIN-world capture woke.
- **dahse:** the Antigravity export reserved a port, released it, and
handed it to the vendor server (a TOCTOU), and the server's loopback API
took no credential.
- **dzk48:** the agent-integration installer wrote native client configs
before recording ownership; a crash in between left uninstall reporting
a false clean.
- **8k10u:** the live-provider proof restored the operator's receiver
settings only on its normal exit path, not on cancellation.
- **mdlft:** `schema commit` could publish a package the promotion audit
never saw, and the audit only inspected `x-polylogue-values`, not keys
nested under other annotations.

## Solution

- **Owner credential on loopback.** With a token configured, shell HTML
and web-credential bootstrap need the daemon bearer, a one-time sign-in
ticket, or a valid cookie being rotated. `POST /api/web-auth/ticket`
(bearer-only) mints a 60 s single-use ticket; the CLI's open paths pass
it in the URL fragment, and an uncredentialed browser gets a sign-in
page with no archive data. `--api-allow-no-auth` stays the explicit open
opt-out.
- **Extension.** Badge and ambient-surface controls act only on
`event.isTrusted`; a MAIN-world capture may wake a freshness capture
only for the conversation the tab URL names.
- **Antigravity.** The vendor server picks its own port
(`-http_server_port=0`), a per-run `-csrf_token` is sent on every
request (the server answers 401 without it), and the port is read only
from the discovery file naming our child's pid. Store discovery streams
`/nix/store` once and finds the current `lib/antigravity-ide` layout.
- **Installer.** A dry-run plan (conflicts raise before any write) is
recorded as prepared operations before anything is applied; uninstall
removes a present prepared effect and treats an absent one as never
applied.
- **Proof.** Dropped on rebase: #5683 already landed the same
SIGTERM/SIGINT receiver restore on master (`pendingReceiverRestore`), so
this PR keeps master's version and no longer carries its own copy or
test.
- **Schema commit.** Both routes run the promotion audit on the tree
they wrote and restore the prior tree on a blocker; the audit now holds
keys and strings under every `x-polylogue-*` annotation to the
property-name and identifier bar, redacting offending keys even in
paths. The committed provider tree audits clean.

## Review rounds
- Installer: removals are journaled beside prepared operations, and
`status()` reports an interrupted install as blocking.
- Schema commit: generation runs outside the tree lock. A refused
publication rolls back by atomic exchange. A secret used as an
annotation key is redacted before the finding path is built.
- Antigravity: a discovery file must be newer than the launch.
- Sign-in: tickets go through a `/web-auth/sign-in` exchange page that
always clears the fragment. The ticket route has a typed OpenAPI
operation. ChatGPT temporary-chat freshness hints are admitted by the
temporary-payload predicate.
- Refuted: moving the Antigravity CSRF token off argv. The vendor server
accepts it only as `-csrf_token`, with no flagfile or other transport.

## Verification

- `devtools test` over the affected daemon, route-contract, openapi,
web-auth, web-reader auth, installer, schema-commit, antigravity and CLI
sign-in files: `devtools test: PASSED` (receipt
`20260928T000719Z-focused-test-724806-aff04b59`, after fixing 41
expectation failures from the first run).
- Browser extension: `vitest run` 23 files, 415 passed.
- `devtools render all --check`: no surface out of sync.
- `python -m polylogue.schemas.promotion_audit
polylogue/schemas/providers`: 0 blockers.
- `devtools schema closure`: only
`polylogue/sources/parsers/antigravity.py` is IN; this must land before
the fresh build.

## Residuals

- The Antigravity CSRF token is visible in `/proc/<pid>/cmdline` to
other local uids (no `hidepid` on this host; the vendor binary has no
flag-file or env option).
- MAIN-world capture *content* remains forgeable by XSS on an allowed
origin (qut1's accepted property); temporary chats no longer receive
MAIN-world freshness wakes.
- The Playwright web-auth spec was updated for ticket sign-in but not
run here (not part of CI).

## Self-review

I reviewed the complete diff at the final head: fifteen commits across
the security family, re-read against the code.

**Loopback is not an authority (n3xdn)**
- With a token configured, shell HTML and the web-credential bootstrap
require one of: the bearer, a one-time sign-in ticket, or a cookie bound
to the peer uid.
- Tickets are single-use and expire after 60 s. They are exchanged on a
dedicated page and never appear in argv or a URL query (the CLI passes
them in the fragment).
- Peer identity is read from the accepted socket, once, and IPv6 peers
are handled. The sign-in exchange bypasses proxies.
`--api-allow-no-auth` is the explicit opt-out.

**Page scripts cannot drive the extension (qut1/l6v61)**: controls act
only on `event.isTrusted`, and a MAIN-world capture takes no identity
from the page.

**Antigravity language server (dahse)**
- The port is not reserved and then released. The child's own discovery
file names its port.
- Discovery accepts only files that are new or changed relative to a
snapshot taken before launch (inode, mtime, ctime, size). This does not
depend on timestamp resolution.
- The RPCs carry the server's credential and bypass proxies. There is no
discovery deadline while the child lives, and a failed start stops the
child.

**Installer ownership (dzk48)**
- Ownership is journalled before any native file is written.
- Uninstall journals every planned removal before deleting, so a kill at
any point converges on rerun.
- Replaced clients are journalled, and rollback is atomic.

**Schema publication (mdlft)**: `schema commit` publishes only the tree
the promotion audit inspected. The exchange is atomic (`renameat2`, or
`renamex_np` where that is absent), and the audit inspects annotations
at any depth.

**Verification**:
- `devtools test tests/unit/sources/test_antigravity_language_server.py
tests/unit/agent_integration/test_installer.py
tests/unit/daemon/test_daemon_http_security.py
tests/unit/daemon/test_web_auth.py` on the final head bc014cb: 668
passed, 1 failed. The failure,
`TestNoTokenLogging::test_no_token_in_log_or_print_calls`, flags
master's `browser_capture/server.py` `_assertion_candidate_capture` and
fails identically on clean master (recorded in polylogue-rb7tx).
- `agentctl job start polylogue verify_quick`: succeeded (job 2124).

**Residuals**: 8k10u (the live-provider proof restoring receiver
settings on cancellation) is tracked in its bead and is not in this
diff.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_013Vn4qhKjhyaVBG4aPiqNW4

---------

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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