Skip to content

馃崚Fix command expansion in env.sh - #591

Open
etcwilde wants to merge 3 commits into
swiftlang:release/1.2from
etcwilde:ewilde/1.2/command-injection
Open

馃崚Fix command expansion in env.sh#591
etcwilde wants to merge 3 commits into
swiftlang:release/1.2from
etcwilde:ewilde/1.2/command-injection

Conversation

@etcwilde

Copy link
Copy Markdown
Member

Swiftly copies the contents of the SWIFTLY_HOME_DIR, SWIFTLY_BIN_DIR, and SWIFTLY_TOOLCHAINS_DIR environment variables into the generated env.sh file. If these environment variables contain a command, the command is executed.

This changes Swiftly to use single-quotes, preventing variable expansions and command execution when sourcing the env.sh. Also changes Swiftly to escape single quotes in the environment variable to prevent ending the single-quoted string and passing arbitrary outputs.

1.2 Cherry-Pick: #590

Teaching Swiftly to escape the `SWIFTLY_*` environment variables and
wrap them with single quotes.
Updating unmodified env.sh files to use the single quotes.
Adding tests to verify that the environment variables are single-quoted
appropriately and that Swiftly upgrades from both old formats correctly.
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.

1 participant