Harden TQQQ trusted snapshot verification - #220
Conversation
Co-Authored-By: Codex <noreply@openai.com>
Co-Authored-By: Codex <noreply@openai.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f9819c81c4
ℹ️ 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".
| if type(payload) is not bytes or type(name) is not str: | ||
| _invalid("invalid strict JSON") |
There was a problem hiding this comment.
Enforce the JSON payload size bound
When read_strict_json is called directly with untrusted bytes larger than MAX_EVIDENCE_BYTES, it decodes and parses the entire payload without any length check, allowing a large flat array or object to consume unbounded additional memory despite the function's promise to decode bounded JSON. The package loader happens to pre-bound file inputs through _read_regular, but this newly public helper is also exercised directly and should reject oversized payloads before decode().
Useful? React with 👍 / 👎.
| def _open_snapshot_directory(snapshot_dir: str | Path) -> int: | ||
| try: | ||
| return os.open(os.fspath(snapshot_dir), _safe_open_flags(directory=True)) | ||
| except OSError as exc: |
There was a problem hiding this comment.
Reject trailing-slash symlink snapshot roots
When snapshot_dir is supplied as a string ending in / or /. and its final directory component is a symlink, POSIX resolves that symlink before applying O_NOFOLLOW, so this open succeeds and the loader accepts a root that verify_tqqq_r1_snapshot rejects after Path normalization. This bypasses the intended non-symlink trusted-input boundary and leaves TrustedSnapshotPackage.snapshot_dir referring to a mutable symlink; normalize and reject such paths or open the final component relative to its parent descriptor.
Useful? React with 👍 / 👎.
|
Fail-closed settlement for immutable head
The high-risk single-review immutable-head contract forbids post-review patching or re-review. Closing unmerged; no review-thread mutation, rerun, or merge. P3 remains unauthorized and |
Summary
Validation
39 passed584 passed, 3 skippedBoundaries
size=0