fix: contain deserialized payload artifacts#106
Open
Hinotoi-agent wants to merge 2 commits into
Open
Conversation
4 tasks
spencrr
reviewed
Jul 8, 2026
Comment on lines
+353
to
+361
| if artifact_path.is_absolute() or ".." in artifact_path.parts: | ||
| msg = f"Invalid artifact path: {artifact!r}. Must stay under artifacts/." | ||
| raise ValueError(msg) | ||
| if ( | ||
| len(artifact_path.parts) < _MIN_ARTIFACT_PATH_PARTS | ||
| or artifact_path.parts[0] != "artifacts" | ||
| ): | ||
| msg = f"Invalid artifact path: {artifact!r}. Must be under artifacts/." | ||
| raise ValueError(msg) |
Contributor
There was a problem hiding this comment.
Author
|
Thanks — updated in I kept the explicit absolute/ Validation: uv run pytest tests/unit/payloads/test_payload_store_security.py -q
# 5 passed
uv run pytest tests/unit/payloads/test_store.py tests/unit/payloads/test_payload_store_security.py -q
# 18 passed
uv run ruff check rampart/payloads/_store.py tests/unit/payloads/test_payload_store_security.py
uv run ruff format --check rampart/payloads/_store.py tests/unit/payloads/test_payload_store_security.py
uv run ty check rampart/payloads/_store.py tests/unit/payloads/test_payload_store_security.py
python -m compileall -q rampart tests
git diff --check |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This is the focused follow-up requested in #57 (comment).
It keeps the load-time artifact containment hardening only: when deserializing a persisted payload collection, artifact references now have to remain under the collection's
artifacts/directory after normalization and symlink resolution.What changed
_resolve_artifact_path()inrampart/payloads/_store.pyfor deserialized artifact references..., or do not start withartifacts/.artifacts/directory.Scope notes
Payload.idvalidation.rampart/core/payload_ids.py._copy_file_artifact()orOneDriveSurface.upload_async().Test plan
Host-local:
Results:
5 passed18 passed617 passed, 5 skippedContainer validation:
Result: passed (
18 passed; ruff, ty, and diff whitespace checks passed).