Skip to content

[codex] fix local object store key safety - #5

Merged
sarthakagrawal927 merged 3 commits into
mainfrom
codex/object-store-key-path-safety
Jun 13, 2026
Merged

[codex] fix local object store key safety#5
sarthakagrawal927 merged 3 commits into
mainfrom
codex/object-store-key-path-safety

Conversation

@sarthakagrawal927

Copy link
Copy Markdown
Member

What changed

  • Reject unsafe object-store key segments before building raw upload keys.
  • Added a regression test that proves put_raw_file() refuses path-traversal-shaped domains.

Why

  • The local filesystem backend derived paths directly from domain via raw/<domain>/<hash>. With a local object store, a malicious or malformed domain like ../evil could escape the object root.
  • That is a real safety bug because object_store=local is a supported configuration.

Validation

  • uv run pytest -q tests/test_objects.py
  • uv run ruff check src/kb/storage/objects.py tests/test_objects.py

@sarthakagrawal927
sarthakagrawal927 marked this pull request as ready for review June 13, 2026 05:31
@sarthakagrawal927
sarthakagrawal927 merged commit 2bdd259 into main Jun 13, 2026
0 of 2 checks passed
@sarthakagrawal927
sarthakagrawal927 deleted the codex/object-store-key-path-safety branch June 13, 2026 05:31
sarthakagrawal927 added a commit that referenced this pull request Jun 13, 2026
PR #5 added parent_id to _ALLOWED_FILTER_COLS for cross-backend
compatibility but forgot to update the corresponding test assertion.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
sarthakagrawal927 added a commit that referenced this pull request Jun 19, 2026
PR #5 added parent_id to _ALLOWED_FILTER_COLS for cross-backend
compatibility but forgot to update the corresponding test assertion.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sarthakagrawal927 added a commit that referenced this pull request Jun 19, 2026
Both sides wanted raw/<domain>/<content_hash> (no filename).  HEAD also
carried _safe_key_segment() path-traversal guard and the safety rejection
test from PR #5; kept the superset (HEAD) on both conflicted hunks so no
intent is lost.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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