fix(sandbox): harden path validation and error handling#9
Merged
Conversation
- Add SeatbeltError enum with path injection prevention - Validates paths for unescaped quotes, newlines, null bytes - Prevents malicious paths from breaking Seatbelt syntax - All path interpolation now validates before use - Replace Arc<Mutex<File>> with owned TraceOutput enum - Simplifies violation trace output handling - Removes unnecessary thread-safe wrapper pattern - More idiomatic Rust for single-owner code - Add ViolationKind enum for type-safe categorization - Replace 130+ chars of magic ANSI strings with compile-time safety - Supports colored() and plain() output methods - Cleaner, more maintainable violation reporting - Convert expect() to Result types throughout codebase - ProfileError: Io, Parse, InvalidBuiltin variants - ExecutionError: wraps IO and Seatbelt errors - SeatbeltError: path validation failures - Proper error chaining with source() implementation - Improve error logging for security-critical operations - Log warnings for failed profile loads (not silent skipping) - Add zshrc write failure warning instead of silent ignore - Implement one-time violation trace write error logging - Improve zombie process handling - Better error handling for kill/wait operations - Proper result propagation instead of silent swallowing - Optimize config merging performance - Change merge_unique() from O(n²) to O(n) - Use HashSet for O(1) path lookups instead of contains() - Remove code quality issues - Delete duplicate NetworkMode enum (re-export from config::schema) - Remove dangling profile_path reference in ExecutionResult - Remove unused helper functions and dependencies Testing: All 185 tests pass. Code ready for open-source release.
The commit.github.username variable triggers GitHub API requests that fail with 404 errors when the repository is not accessible. Remove this reference to allow changelog generation to succeed with local git data only.
Pierozi
commented
Jan 28, 2026
| } | ||
| } | ||
|
|
||
| // Profile not found - this is not an error, it might be an unknown name |
Contributor
Author
There was a problem hiding this comment.
We must add a notice about profile not found
- Add warning when unknown profile is specified instead of silent skipping - Fallback to 'online' profile for unknown names to prevent unexpected network blocking - Remove references to removed profiles (node, python, go, git) from help text - Update shell integrations (bash, zsh, fish) to list only available profiles - Remove deprecated aliases (sxn for node, sxp for python) - Update init template and tests to reflect actual builtin profiles Available profiles: base, online, localhost, rust, claude, gpg All 185 tests pass.
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
Security Improvements
Test plan
cargo build --releasesucceedscargo clippyreports no critical warningsFiles Changed
src/sandbox/seatbelt.rs(path validation),src/sandbox/trace.rs(error handling)src/config/profile.rs,src/sandbox/executor.rssrc/config/merge.rs(O(n) optimization)Ready for open-source release.