claude-code-cli / claude-sonnet-5-5 / medium / medium effort preferred over xai / grok-4.7-efficient / medium / medium effort · close win.
Primary judge: Sol 6.1, requested Low. Effective provider effort and internal attempts were not verified. A close win is still a scored preference; it does not establish a material defect.
Reviewed public evidence
Task goal
Review the supplied native and Python private-capture implementations and owner/direct invocation contracts for confidentiality and evidence integrity. Trace the concrete input/output surfaces, credential-field exclusions, file permissions, immutable naming, failure retention, request binding, and reconnect/reconciliation behavior. Examine plausible credential leakage, path or symlink substitution, oversized/truncated envelopes and stale owner-process capture configuration against the actual code. Report only actionable findings with severity, exact packet file/line evidence, realistic trigger and smallest remediation. Separately list acceptance gaps that are not demonstrated defects. Do not inspect credentials/profiles, invoke tools, change files, run tests, or publish private contents.
claude-code-cli / claude-sonnet-5-5 / medium / medium effort answer
# Evidence packet: private-capture confidentiality and integrity review
Direct analysis of `security.packet.md` only. No team lanes, tools or file writes. Line numbers are packet lines. `validateInput`, `OpenCodeClient`, the storage backend and the Mission Control MCP schema are not in the packet and are treated as uncertain.
## 1. Actionable findings
**F1 – Medium: credential exclusion is an exact-match key denylist.**
- Evidence: native 3-4, 8-9; Python 18-20, 26-29. Keys are normalized, then matched exactly against a fixed set.
- The match misses `x-api-key` (→ `xapikey`), `authToken`, `idToken`, `sessionToken`, `secret`, `privateKey`, `accessKey`, `bearer`, and env-style names such as `OPENAI_API_KEY`.
- `token` is withheld only when its value is a string. Free-text values are never scanned, which the code acknowledges at Python 24.
- Trigger: a receipt, input or tool result carries `{"env":{"OPENAI_API_KEY":"…"}}` or `{"authToken":"…"}`. It is written to disk, and Python labels the envelope `exact`/`structured-credentials-withheld` (139-141), which gives false assurance.
- Fix: match on a normalized substring or regex (`secret|token|password|passwd|apikey|authorization|cookie|credential|privatekey|bearer|accesskey`). Explicitly allow counters such as `tokens`, `inputTokens` and `maxTokens`. Share one list between native and Python and test them with the same fixtures.
**F2 – Medium: native receipt stores raw input as `privateTaskContext`, unsanitized.**
- Evidence: native RPC 302 stores `privateTaskContext: input`, and `transition` persists it (240-241). `inspect` returns the receipt (346). Only the terminal snapshot (native 15) and Python (116) apply `privateEvidence`.
- Trigger: `privateCapture` is on and the submit input carries credential-like fields. They sit in the general request-key storage outside the 0700/0600 capture domain, and the sanitizer guards only the later snapshot copy.
- Whether `validateInput` rejects such fields is outside the packet.
- Fix: store `privateEvidence(input)` or only `inputHash`. The raw input is not needed for reconciliation.
**F3 – Medium: post-admission capture can throw and mask the native result.**
- Evidence: Python 116-119 (`[REDACTED: private constant]`, `.get` on payload/output) and the `record` build with `evidence_index` (120-130) sit outside the `try` that starts at 131.
- Trigger: the final `capture_[REDACTED: private constant](method, payload, output)` at 222 runs after the native call has succeeded. Deeply nested output hits `RecursionError` in the unbounded `[REDACTED: private constant]` recursion (the depth guard exists only in `evidence_index`). A non-dict payload raises `AttributeError` at 118. The exception propagates out of `_direct_rpc`, so the caller loses `runID` and state for an already-admitted submit and may replay it.
- The response-envelope capture at 215 may preserve the data, but the caller cannot see it.
- Fix: move lines 116-130 inside the `try`. Add a depth bound to `[REDACTED: private constant]`. Wrap the 222 and 218 calls so a capture failure returns `capture-failed` status and never replaces the native output.
**F4 – Low/Medium: no request/run binding check.**
- Evidence: Python 118-119 prefers `output.requestID` over `payload.requestID`. `_direct_rpc` (216-223) never compares the two. `nativeBattleID` can also come from caller-supplied `payload.runID`.
- Trigger: a stale, misrouted or replayed reply is filed under the reply's ID and returned as the answer to this request.
- Fix: if both IDs are present and differ, record both with `bindingMismatch: true`, set `reconciliationRequired`, and raise `BridgeError`.
**F5 – Low: retries are indistinguishable.**
- Evidence: Python records contain no time, attempt or sequence (120-130), and the filename is the content digest (53-54, 54).
- Trigger: two identical `submit-before` or `-response` captures from a replayed or uncertain submit collapse into one file. The retry count cannot be proven, which matters for the no-replay fence.
- The docstring says "each native battle ID groups snapshots", but the layout is flat digest names with no requestID or run prefix, so lookup requires scanning contents.
- Fix: add an attempt nonce and monotonic time to the record (the digest changes accordingly), or write a per-request sidecar index.
**F6 – Low: oversize and truncation behavior loses evidence.**
- Evidence: Python 51-52 raises when the record exceeds 8 MB, and the failure record is identity-only (152-155). The raw envelope is digest-only above 2 MB (139-140). The digest covers the sanitized form (135-137).
- The "exact" coverage label means exact parsed JSON, not wire bytes. A truncated or non-JSON body raises in `client.request` (209-212), leaving only the exception class name.
- Trigger: a large `needs-collection` or terminal output. The Python side keeps nothing. Native holds the receipt, but the F6 gap is that the bridge capture is then silently weaker.
- Native 27 behaves the same way: identity-only failure above 8 MB.
- Fix: spill oversized content to a separate digest-named file, or record the wire byte length and HTTP status at the client layer. Rename the label to `parsed-json-exact`.
**F7 – Low: directory and file hardening gaps.**
- Evidence: Python 41-49, 55-68, 157-159.
- Only the final path component is checked for symlinks. There is no `st_uid == geteuid()` check, and `mkdir(parents=True)` creates intermediate directories with umask defaults.
- A relative `OPENCODE2_[REDACTED: private constant]` resolves against the bridge's cwd.
- `os.link` fails on filesystems without hardlinks (exFAT/SMB under `/Volumes`), so every capture there becomes a failure. A pre-existing 0755 fallback directory makes the failure log fail with `logged=False`.
- Files are 0600, not read-only, so immutability is by naming and write-time readback only.
- Same-user path substitution is mostly mitigated: `O_NOFOLLOW` at 68 and 78, and a planted destination symlink makes `os.link` raise `FileExistsError`, which falls through to the NOFOLLOW open. The residual risk is a same-user adversary.
- Fix: require an absolute path, check the owner, and fall back to `O_CREAT|O_EXCL` when `link` is unsupported. Optionally set 0400 after the write.
**F8 – Low: reconnect/reconciliation load and ordering.**
- Evidence: native 406-408, 431-433, 242-243.
- Every `server.connected` and every execution event rescans all requests. For each terminal one it re-serializes, hashes and reads back up to 8 MB, outside `exclusively`.
- In `transition`, snapshot capture is awaited before waiters are woken and the event is emitted, so slow storage delays completion signals.
- Fix: skip requests already verified (an in-memory digest set), and run capture after `wake()`/`emit`.
## 2. Acceptance gaps (not demonstrated defects)
- **Stale owner process.**
- Python reads the env on each call (113), so a stale owner MCP process silently returns `{'state':'disabled'}` inside `privateCapture`, with no hard failure.
- The native `options.privateCapture` flag is independent of the Python env, so the two sides can disagree.
- Original `team_moa` and direct Codex writer flows do not call the helper. No automatic capture completeness is claimed or shown.
- **Native admission states have no private snapshot.** Only `completed` and `terminal-incomplete` are captured (native 21). `admission-uncertain` and `admission-rejected`, the most reconciliation-critical states, are covered only by the mutable receipt plus Python's `-response` captures.
- **Native failure records are write-only.** `direct-private/v1/failure/*` records are never cleared or surfaced by `readTerminalCapture` (43-57). A later success leaves the stale `reconciliationRequired` record in place.
- **No tamper evidence beyond the same trust domain.** The native snapshot and the receipt share one storage. The digest is anchored externally only if the Python capture of an `inspect` response includes `privateTerminalCapture`.
- **`reconciliationRequired` is false for non-terminal `running` and `needs-collection`** on the final method capture (Python 146-148). This is only a labeling gap.
- **Unverified items.** `validateInput` field filtering, the `client.request` size and timeout behavior, and the storage `set` overwrite semantics are outside the packet.
## 3. Discarded hypotheses and likely false positives
- A symlinked final directory or destination is handled by the `is_symlink` check and `O_NOFOLLOW`.
- A leftover temp file is cleaned by the `finally` at 66-67. After a crash it is a 0600 file only.
- The native get-then-set race is benign because the key is content-addressed. A differing existing value triggers a readback failure and is not overwritten.
- Exception messages are intentionally not logged (151).
- `headers` is withheld at all nesting depths in both implementations.
- Returning the unsanitized native `output` to the caller is consistent with existing behavior and is not a new leak.
## 4. Next action
Fix F1-F3 first. They are small and local: a shared sanitizer test with credential-name fixtures, `try` scope and depth bounding in `capture()`, and sanitizing `privateTaskContext`. Then add the F4 binding check and the F5 attempt nonce. Verify the stale-owner and oversized-envelope gaps with targeted tests on the owner MCP restart path.
MATERIAL_EVIDENCE_CONFLICT: none. The only tension is the docstring claim at Python 110, "each native battle ID groups immutable snapshots", against the flat digest-only layout at Python 54, which is covered in F5.xai / grok-4.7-efficient / medium / medium effort answer
The capture boundary fails closed on replay, but credential exclusion is bypassable on the normal write path and Python failure handling drops already-computed integrity anchors. Four defects are actionable; stale owner configuration is not a demonstrated leak.
## Actionable findings
**1. High — structured credential exclusion fails open.** Both denylists omit common names (`secret`, `privatekey`, `jwt`, `bearer`, `sessiontoken`, `idtoken`). A normalized key matches only the fixed set; `token` is not in that set and is withheld only when `key.lower() == 'token'` and the value is a string. Object or array `token` values are recursed, so nested `jwt`, `value`, or `secret` fields are stored. Prefixed keys such as `x-api-key` normalize to `xapikey` and miss `apikey`. String and non-dict envelopes are stored unchanged.
Evidence: `native/private-capture.js` lines 3–9; `bridge/[REDACTED: private constant].py` lines 18–32 and 132–140. `terminalEvidence` and `capture` then persist the walked object (`private-capture.js` lines 12–16 and 22–29; `[REDACTED: private constant].py` lines 116–130 and 144).
Trigger: a terminal receipt, direct payload, or raw RPC envelope contains `token: {jwt: "..."}`, `secret`, `[REDACTED: private constant]`, or `x-api-key`. The success path writes those values into the private snapshot. Durable storage is worse: redaction never runs on the primary receipt.
Smallest remediation: one shared normalized denylist; withhold the whole value on match regardless of type; also match normalized suffixes `token`, `secret`, `password`, `apikey`, and `credential`. Apply that helper before any durable or snapshot write.
**2. High — enabling private capture stores and returns unredacted input.** On `options.privateCapture === true`, the full client `input` is copied to `privateTaskContext` and committed with `storage.set` before the snapshot helper runs. `privateEvidence` is applied only inside `terminalEvidence` to a separate object. `inspect`, `submit`, `advance`, and `cancel` return that durable receipt. The bridge then spreads the original `output`, not the redacted copy.
Evidence: native direct RPC lines 302, 240–242, 273–275, and 340–346; bridge helper line 223.
Trigger: private capture is on and `input` or engine `admission` or `result` contains a credential field, including one the denylist would have caught. It remains in scoped request storage and in the authenticated RPC response. Turning the flag on increases retention relative to the question-only receipt.
Smallest remediation: redact `input` before assigning `privateTaskContext`, and do not return that field on RPC. Keep the unredacted task context only in the private snapshot store after finding 1 is fixed.
**3. Medium — Python capture path checks do not pin the directory they write.** `is_symlink()` covers only the leaf. `resolve()` follows parent symlinks. The repo check and `stat()` mode check are not tied to a directory fd. `stat()` follows symlinks. `O_NOFOLLOW` is used only after `NamedTemporaryFile` and `os.link`. Relative `OPENCODE2_[REDACTED: private constant]` or `OPENCODE2_CAPTURE_FAILURE_DIR` is resolved against the process cwd. The temp file is created with the process umask and chmodded to `0o600` only afterward.
Evidence: `bridge/[REDACTED: private constant].py` lines 39–49 and 53–68; failure directory selection at lines 157–159.
Trigger: a parent component of the capture or failure directory is a symlink, or the leaf is replaced after the symlink check, pointing at a traversable directory or a repo. Writes follow that path. A local observer can open the temp name before `fchmod` if the substituted directory is traversable and umask leaves group or other read. A same-user redirect into a repo defeats the `.git` check via that race and can later be committed.
Smallest remediation: reject non-absolute paths; walk with `O_NOFOLLOW`; `open` the final directory `O_DIRECTORY|O_NOFOLLOW`; require mode `0o700`, matching uid, and a regular non-repo directory; create the temp file `O_EXCL|O_NOFOLLOW` with mode `0o600` on that dirfd before writing.
**4. Medium — Python failure retention and response binding drop or mis-file evidence.** The `except` block builds an identity-only failure record and discards `record`, including `rawEnvelopeEvidence.sha256` already computed in the `try`. The failure file digest is not returned. Separately, `runID` and `requestID` prefer the response over the submitted payload when both exist. Python filenames are content digests only, so a mis-bound snapshot is not request-scoped on disk. Native failure keys do retain `snapshotDigest` (`private-capture.js` lines 34–37); Python does not.
Evidence: `bridge/[REDACTED: private constant].py` lines 118–119, 132–144, and 150–164; bridge call at helper line 222.
Trigger: `_store` raises after an oversized or secret-bearing envelope was hashed (combined record over 8,000,000 bytes, readback mismatch, or unsafe directory). Reconciliation is left with no digest. Or the RPC `output` carries a different `requestID` or `runID` than the payload; the lifecycle snapshot is labeled with the response identity and can be reconciled to the wrong battle.
Smallest remediation: on failure, persist `requestID` from the caller, `errorClass`, raw-envelope sha256, and serialized length, and return those digests. If both sides have an ID, require equality and otherwise fail closed. Bind the record to the caller ID.
## Acceptance gaps (not demonstrated defects)
- The stale Codex MCP process with old env or schema is an unverified capture gap. Both gates fail silent: the native code returns when `enabled` is not strictly `true`, and Python returns `disabled` when `OPENCODE2_[REDACTED: private constant]` is unset (`private-capture.js` line 21; `[REDACTED: private constant].py` lines 113–115; packet lines 235 and 484). That is missing evidence, not a shown credential leak.
- Free text is intentionally retained, including `question`, `error` (native RPC line 334, sliced to 2000 characters), and `text`. Credential-shaped strings in those fields are a residual policy risk.
- Native snapshots cover only `completed` and `terminal-incomplete`. `admitting` and `admission-uncertain` are not snapshotted, and reconcile or advance will not move them (native RPC lines 354–355 and 408–410). Recovery depends on `inspectUnsafe` plus engine helpers not in this packet.
- The admission-diagnostic RPC is not captured (bridge helper lines 226–236). `publicationAllowed: false` is stored but not enforced here.
- The native storage permissions, `validID`, `KEY`, `inputHash`, and `OpenCodeClient.request` shape are outside the packet. The integration claim of directory `0700` and file `0600` is not visible in the JS capture path.
- `evidence_index` stops after 4096 path characters or 64 segments (`[REDACTED: private constant].py` lines 89–90). Full `input` and `nativeReceipt` copies remain. Digests are not comparable across native `JSON.stringify` and Python canonical JSON.
- Non-dict `output` is silently replaced with `{}` (`[REDACTED: private constant].py` line 117). The shown bridge success path avoids that with `isinstance(..., dict)`.
## Alternatives and discarded hypotheses
- I did not treat a pre-created leaf symlink in `/tmp` as a bypass. `is_symlink()` rejects that leaf. The gap is parent symlinks and the check-to-write race.
- I did not treat `events.emit("changed", ...)` as a credential leak. The payload is only sequence, request ID, and state (native RPC line 244).
- I did not treat JSON key-order readback mismatch as a defect. The packet states native readback was verified, and storage round-trip semantics are not in the packet.
- I did not treat returning the RPC `output` to the direct caller as itself a leak. The caller needs the result. The defect is the unredacted durable copy and the weak snapshot denylist.
- `coverage: digest-only-over-limit` omits a sanitized label, but `structuredCredentialsWithheld` remains set (`[REDACTED: private constant].py` lines 139–141). That is not an independent defect.
## Missing evidence
`validID`, storage key prefix `KEY`, hash inputs, `validateInput`, engine launch, status, and collect shapes, and the storage implementation are not in the packet. I cannot confirm request-ID key traversal, whether reconcile’s scan is cross-workspace, or that live replies actually contain the weak field names. Consequence: findings 1 and 2 are proven write-path defects; exploitability in production traffic depends on those unseen object shapes. The symlink finding does not depend on them.
## Next useful action
Patch findings 1–4 in the snapshot helpers and the durable `privateTaskContext` assignment, then add tests for object-valued `token`, suffix keys, response ID mismatch, failure-record digest retention, and a parent-symlink capture directory. Do not inspect live credentials or treat a stale owner process as a leak.Primary judge's stated reason
A receives a slight forced preference for avoiding B's specific unsupported temporary-file disclosure scenario, which could misdirect confidentiality remediation. This is not an established material quality gap: A has its own unsupported assertions, while B offers useful failure-retention analysis. An independent review could reasonably prefer B.
This reason is the judge's assessment. No independent factual-defect finding is asserted by this record.
Battle wave: 363476d6-e8c0-4ffc-9edf-97ef2eef4154. Pair: brp1_89161849aece005bed837997745fb10dc19beb02abdd1cd3ce6261934eeb1cce. A separate independent review is required before calling a concern a verified factual defect. Judge disagreement is not recorded here.