test(memory): add unit tests for safe_fs security boundary#1043
Open
ralf003 wants to merge 1 commit into
Open
Conversation
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
Added comprehensive unit tests for the
safe_fssecurity boundary module of agent-memory.What Changed
Added
src/agent-memory/tests/safe_fs_tests.rs— 734 lines, 45 unit tests.Test Coverage
open_root (3 tests)
read/write/append round-trips (9 tests)
metadata / exists (5 tests)
openat2 sandbox escape prevention (6 tests)
../rejection (RESOLVE_BENEATH) ✅../rejection (AOS target kernel 6.x) ✅assert_no_symlink_traversal (5 tests)
..) in path rejectedremove_dir_all_safe (2 tests)
open_read (1 test)
validate_user_id edge cases (7 tests)
..variants (x.., ..y, x..y, a.b..c)resolve_path boundary conditions (6 tests)
.) component rejectedReliability (2 tests)
Verification
..test passes on AOS target kernel 6.x; 4.18 RESOLVE_BENEATH has looser mid-path..handling)cargo test --package agent-memoryall pass