security: wire path + prompt validation into IPC commands#27
Merged
Conversation
Wire the existing (but previously uncalled) validators from core::security into the command layer: - sanitize_workflow_path on save/load/delete_workflow, save/load_workflow_with_metadata, and save_workflow_with_sidecar to block path traversal (.., /, \, null bytes) in names that are used to construct on-disk file paths. - validate_prompt on generate_workflow_from_prompt to enforce the length cap and basic injection guards before the prompt reaches the LLM provider. validate_coordinates is intentionally left unwired: its hardcoded 0-10000 bound would reject legitimate coordinates on multi-monitor setups. https://claude.ai/code/session_01CQaxE4mHrAWqLcfHNFpdUR
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Wires the existing-but-uncalled validators from
core::securityinto the IPC command layer (items 1 & 2 from the next-steps plan). These functions already had the logic written and tested; they were simply never invoked fromcommands.rs.Changes
sanitize_workflow_pathnow runs at the top of every command that turns a user-suppliednameinto an on-disk path:save_workflow,load_workflow,delete_workflow,save_workflow_with_metadata,load_workflow_with_metadata, andsave_workflow_with_sidecar. It blocks..,/,\, and null bytes.save_workflow_with_sidecarwas the most exposed, since it builtformat!("{}.meta.json", name)directly.validate_promptruns ingenerate_workflow_from_promptbefore the prompt reaches the LLM provider (length cap + basic injection guards).Deliberately not done
validate_coordinateswas left unwired. Its hardcoded0–10000bound would reject legitimate coordinates on multi-monitor setups (three horizontal 4K displays span ~11520px), turning a "security win" into a false-positive regression ininspect_element.Compatibility note
sanitize_workflow_pathrestricts names to[a-zA-Z0-9_\- ]. Any pre-existing workflow saved with a name containing punctuation (e.g.Report.v2,Backup (old)) would now fail to load or delete. This is the project's own designed validator, used as-is.Test plan
cargo check/clippy/teston macOS + Windows)../evilreturns a validation error instead of writing outside the data dirhttps://claude.ai/code/session_01CQaxE4mHrAWqLcfHNFpdUR
Generated by Claude Code