Harden TQQQ trusted snapshot package - #221
Conversation
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: f2d813e7ed
ℹ️ 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".
| snapshot_sessions = { | ||
| row["session"] | ||
| for row in csv.DictReader( | ||
| StringIO( | ||
| members["prices.csv"].decode("utf-8"), | ||
| ), | ||
| ) |
There was a problem hiding this comment.
Bind the session from the verified CSV parse
When prices.csv has more fields per row than its three headers, pandas can treat the leading field as an implicit index, so _verify_snapshot_fd validates the following field as the session while this independent csv.DictReader treats the leading field as row["session"]. A crafted, correctly hashed snapshot can therefore put the receipt session only in that discarded index field and pass this membership check even though the validated price rows contain no such session; derive the sessions from the already-normalized dataframe or reject rows with extra fields.
Useful? React with 👍 / 👎.
| if type(raw_path) is not str or not raw_path: | ||
| _invalid("invalid snapshot directory") | ||
| return os.path.normpath(raw_path) |
There was a problem hiding this comment.
Preserve path semantics while rejecting final symlinks
When a snapshot path contains .. after a symlinked ancestor, normpath changes which directory is opened because it collapses the component lexically whereas normal filesystem resolution follows the symlink before applying ... For example, base/link/../snapshot can resolve under the link target but is opened here as base/snapshot, allowing verification to succeed against a directory different from the caller-supplied path that is retained in snapshot_dir; reject ambiguous .. components or strip only the trailing forms needed for the final-symlink check.
Useful? React with 👍 / 👎.
|
Fail-closed closure evidence for immutable head
Closing unmerged as |
Summary
Validation
Provider-free, size-zero implementation. No dependency, schema, workflow, settings, replay, deploy, or live changes.