Escape Script-Fu path literals to prevent injection#60
Merged
yuh-yang merged 1 commit intoHKUDS:mainfrom Mar 14, 2026
Merged
Conversation
Jah-yee
pushed a commit
to Jah-yee/CLI-Anything
that referenced
this pull request
Mar 13, 2026
Adds _script_fu_escape() to safely escape values embedded in Script-Fu double-quoted strings. Prevents command injection through crafted file paths containing quotes or control characters. - Added _script_fu_escape() function for escaping backslashes, quotes, and control characters - Updated create_and_export() to use safe path variants - Updated apply_filter_and_export() to use safe path variants Fixes: HKUDS#60
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
Fixes a critical security issue in the GIMP backend by preventing Script-Fu command injection through file paths.
What was wrong
input_path/output_pathwere interpolated directly into Script-Fu strings ingimp_backend.py.A crafted path containing quotes or control characters could break out of the intended string and inject additional Script-Fu code.
What this PR changes
_script_fu_escape()to safely escape values embedded in Script-Fu double-quoted strings.safe_abs_input,safe_abs_output) in:create_and_export()apply_filter_and_export()