-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Source
ChatGPT security review feedback
Problem
path_validator.rs already uses O_NOFOLLOW to prevent TOCTOU symlink races (good), but there are still non-atomic checks elsewhere (is_symlink() then read_link() flows) which are raceable.
Fix
For any "real" file operation:
- Open the path with fd-based APIs (or capability dir handles)
- Resolve realpath from the fd
- Perform the action via fd (or via path derived from fd)
- Have path validation operate on the resolved target of that fd
Consider integrating cap-std for capability-based filesystem access.
Relevant Code
src/safety/path_validator.rssrc/tools/file.rssrc/cognitive/self_edit.rs(symlink bypass fix already applied)
Priority
P0 — completes existing security work
Labels
security, P0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request