security: fix path traversal in agent builder and documentation micro-fixes#5599
Open
Kaushikj-7 wants to merge 3 commits intoaden-hive:mainfrom
Open
security: fix path traversal in agent builder and documentation micro-fixes#5599Kaushikj-7 wants to merge 3 commits intoaden-hive:mainfrom
Kaushikj-7 wants to merge 3 commits intoaden-hive:mainfrom
Conversation
Kaushikj-7
commented
Mar 1, 2026
Author
Kaushikj-7
left a comment
There was a problem hiding this comment.
-
Vulnerability Addressed:
I identified a path traversal risk in agent_builder_server.py where user-provided session_id and
agent_path parameters were used directly in filesystem operations (unlink, mkdir, read_text). A
malicious input could have allowed an attacker to read or delete files outside of the intended
directories. -
The Fix:
_safe_path_segment: Now strictly enforces that session IDs contain no path separators (/, )
or parent directory references (..)._safe_export_path: Uses .resolve() and a prefix check to ensure that all agent exports and
imports are strictly confined to the exports/ directory, preventing escapes to sensitive system
areas.
- Test Coverage (see
core/tests/test_agent_builder_path_traversal.py):
I added a new test suite that verified the following:
- Success Cases: Valid alphanumeric session IDs and local export paths work as expected.
- Traversal Blocking: Confirmed that inputs like ../../etc/passwd or sub/dir trigger a ValueError.
- Integrity Check: Verified that delete_session successfully blocks a deletion attempt targeting a
file outside the restricted sessions directory.
- Documentation:
Corrected terminology for "builder skills" to match the project's internal naming conventions and
fixed minor typos.
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.
Description
This PR addresses a critical security vulnerability and improves documentation clarity.
Type of Change
Related Issues
N/A (Security audit finding)
Changes Made
session and export tools.
to verify protection against malicious paths.
core files.
Testing
Checklist