Skip to content

mitigate "extra_env" code injection via template expansion#23383

Open
cburroughs wants to merge 1 commit into
mainfrom
csb/z-inject-tmplenv
Open

mitigate "extra_env" code injection via template expansion#23383
cburroughs wants to merge 1 commit into
mainfrom
csb/z-inject-tmplenv

Conversation

@cburroughs

@cburroughs cburroughs commented May 27, 2026

Copy link
Copy Markdown
Contributor

zizmor does not like any of the places where we allow inputs based template expansion. Example:
https://github.com/pantsbuild/pants/security/code-scanning/102

Per the comment "extra_env" is already limited to maintainers due to its vulnerability to shell injection. I'm not sure preventing maintainers from doing template injection is that much of an improvement, but fixing it wasn't much more work than getting an ignore comment to propagate through the yaml machinations.

NOTE: LLM assisted for both what zizmor was getting at, and generating the work around.

Test Note: https://github.com/pantsbuild/pants/actions/runs/26538042158/job/78172033584
image

zizmor does not like any of the places where we allow inputs based
template expansion. Example:
https://github.com/pantsbuild/pants/security/code-scanning/102

Per the comment "extra_env" is already limited to maintainers due to
its vulnerability to shell injection.  I'm not sure preventing
maintainers from doing template injection is that much of an
improvement, but fixing it wasn't much more work than getting an
ignore comment to propagate through the yaml machinations.

NOTE: LLM assisted for both what zizmor was getting at, and generating
the work around.
@cburroughs cburroughs self-assigned this May 27, 2026
@cburroughs cburroughs added the release-notes:not-required [CI] PR doesn't require mention in release notes label May 27, 2026
@cburroughs cburroughs marked this pull request as ready for review May 27, 2026 20:59
@cburroughs cburroughs requested a review from sureshjoshi May 27, 2026 20:59
@tdyas

tdyas commented Jun 1, 2026

Copy link
Copy Markdown
Contributor

For my own education, what does public_repos.yaml do? Also, can we just delete the EXTRA_ENV support?

@cburroughs

Copy link
Copy Markdown
Contributor Author

It runs the tests of a variety of open soruce repos that use Pants. The env var stuff it tied to how it is intended to be used. For example, if we change or add a default (PANTS_FOO_BAR=1) , what breaks?

@cburroughs

Copy link
Copy Markdown
Contributor Author

gentle ping @sureshjoshi as it sounded as your summer is somewhat less crazy now.

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

Labels

release-notes:not-required [CI] PR doesn't require mention in release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants