Repository navigation
fix(runner): confine task-file reads to the state directory - #16
Merged
Merged
Conversation
The data flow CodeQL reports for py/path-injection goes server route -> Runner.create -> _verify_run -> jload(root/AE/tasks/<task>.json); the previous fix guarded the server's own reads, not this one. A shared policy.state_file now resolves the path (symlinks included) and refuses anything outside .ai-engineering; Runner.create checks the name before anything is queued, and the read itself goes through it. The server's _jload uses the same helper instead of its own copy. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Follow-up to #14, which did not close alert #3: the SARIF code flow is server route →
Runner.create→_verify_run→jload(root/AE/tasks/<task>.json)(runner.py:223), not the server's own reads.policy.confine/policy.state_file: resolve with realpath (symlinks included), ValueError if outside.ai-engineering.Runner.createvalidates the task path before queueing (so a run is never left half-started); the read at line 223 goes throughstate_file._jloadreusesconfineinstead of its own copy.Still not exploitable before this (names pass
NAME_REfirst); this puts the guard on the path CodeQL traces.Tests:
test_state_file_stays_inside_the_state_directory('..', absolute, symlink) andtest_the_runner_refuses_an_escaping_task_name_before_queueing. Local: 66 passed / 11 failed (same environment failures as main without the change: 63+tests).🤖 Generated with Claude Code