Releases: AnswerDotAI/safecmd
Releases · AnswerDotAI/safecmd
v0.1.0
Breaking Changes
Refactor: Replace operator blocking with destination-based redirect validation
Major changes:
- Remove
ok_opsallowlist; all operators now permitted - Add
ok_destsallowlist for output redirect destinations (default: ./, /tmp) extract_commands() now returns 3-tuple: (commands, operators, redirects)- New
collect_redirects() extracts write redirect destinations from AST - New
normalize_dest()/validate_dest() resolve paths to absolute before matching,
preventing path traversal attacks (./.. , ./subdir/../../escape) - Rename DisallowedOps -> DisallowedDest
CmdSpec improvements:
- Detect denied flags in combined short flags (e.g., -xvfI matches -I)
- Match long flags with =value (e.g., --to-command=cat matches --to-command)
API changes:
safe_run/validate: ops param -> dests paramadd_allowed_ops/rm_allowed_ops->add_allowed_dests/rm_allowed_destsbash/unsafe_bash:rm_ops->rm_dests,add_ops->add_dests- Extract validate() function for reusable command validation (#6)