Skip to content

ci: (workflows & actions) interpolate into env vars#2105

Merged
kaylareopelle merged 2 commits into
open-telemetry:mainfrom
robbkidd:robb.workflow-interpolate-in-env-vars
Apr 23, 2026
Merged

ci: (workflows & actions) interpolate into env vars#2105
kaylareopelle merged 2 commits into
open-telemetry:mainfrom
robbkidd:robb.workflow-interpolate-in-env-vars

Conversation

@robbkidd
Copy link
Copy Markdown
Member

@robbkidd robbkidd commented Apr 22, 2026

Move ${{ ... }} interpolations from 'run:' scripts to env vars to avoid shell injection shenanigans. YAML string handling works as hoped for the variables whose values are strings with spaces in them, like flags and named-things-to-be-released.

Move ${{ ... }} interpolations from 'run:' scripts to env vars to avoid
shell injection shenanigans. These workflows had low exposure before
(only available to trusted users), but now the exposure is even lower.
Move ${{ ... }} interpolations from 'run:' scripts to env vars to avoid
shell injection shenanigans.
@robbkidd
Copy link
Copy Markdown
Member Author

I exercised these changes locally as much as possible.

Copy link
Copy Markdown
Contributor

@kaylareopelle kaylareopelle left a comment

Choose a reason for hiding this comment

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

Thank you for doing this, @robbkidd! One question before I approve.

@@ -119,7 +122,9 @@ runs:
- name: Build Gem
shell: bash
if: "${{ inputs.build == 'true' }}"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this an input we need to be concerned about?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

No, but it's good to be suspicious and ask why!

The if: field is evaluated by whatever YAML processing GitHub Actions is doing. The value of inputs.build is not passed to a shell. The equality check is performed by Action YAMLing, so sh hax0rs.activate shenanigans == 'true' would result in false as the value for if:.

As I understand the vulnerability, it only presents when ${{ … }} appears directly within specifically a run: block since that's passed on for a shell to execute.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you! I appreciate your explanation! 🎉

@kaylareopelle kaylareopelle merged commit 20682be into open-telemetry:main Apr 23, 2026
72 checks passed
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.

3 participants