Skip to content

Add ShellEscape node for safe string escaping in shell commands#61

Open
Nickalus12 wants to merge 1 commit intoSerpent-Tools:mainfrom
Nickalus12:fix/issue-50
Open

Add ShellEscape node for safe string escaping in shell commands#61
Nickalus12 wants to merge 1 commit intoSerpent-Tools:mainfrom
Nickalus12:fix/issue-50

Conversation

@Nickalus12
Copy link
Copy Markdown

Add a new ShellEscape node that takes a string input and produces a safe, POSIX-compliant shell-escaped output. This uses single quotes around the string and properly escapes any internal single quotes to prevent shell injection attacks in command construction (e.g., replacing Exec + Join patterns).

The implementation includes a helper for escaping and handles the empty string case. A unit test suite covers common scenarios: empty strings, spaces, single quotes, and newlines. A brief example is added to the nodes README.

Fixes #50

Copy link
Copy Markdown
Contributor

@vivax3794 vivax3794 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you explore much of the codebase before working on this? It seems to be putting the code in a rather strange place, and inventing imports.

If you are unsure how the codebase works feel free to ask questions here, or join the discord linked in the repo description.

Comment thread serpentine_internal/src/nodes/mod.rs
@Nickalus12
Copy link
Copy Markdown
Author

You're right, I didn't explore the codebase thoroughly enough before writing this. I see the nodes should live in serpentine/src/engine/nodes.rs rather than as a separate module. I'll rework this to follow the existing patterns. Thanks for pointing that out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ShellEscape node.

2 participants