This repository was archived by the owner on Feb 24, 2026. It is now read-only.
fix: github workflow vulnerable to script injection#2600
Merged
diegomarquezp merged 5 commits intogoogleapis:mainfrom Aug 20, 2024
Merged
fix: github workflow vulnerable to script injection#2600diegomarquezp merged 5 commits intogoogleapis:mainfrom
diegomarquezp merged 5 commits intogoogleapis:mainfrom
Conversation
Signed-off-by: Diogo Teles Sant'Anna <diogoteles@google.com>
Contributor
|
@diogoteles08 , lgtm but can you take a look also. There might be other instances elsewhere where this might be useful. |
Contributor
Contributor
|
@PhongChuong we have this script in other hw repos. |
Contributor
|
I did a similar change in google-cloud-java: googleapis/google-cloud-java#10881 |
Contributor
Author
Hi! I did realize this very same workflow was used in other repositories of this org. I grouped some and pointed them in this comment: googleapis/java-storage#2663 (comment) |
PhongChuong
approved these changes
Aug 19, 2024
Contributor
|
/gcbrun |
Contributor
|
@diogoteles08 just testing a few commits to confirm if we can also inline an env var in the |
diegomarquezp
approved these changes
Aug 19, 2024
Contributor
|
/gcbrun |
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Hi! I'm Diogo from Google's Open Source Security Team(GOSST) and I'm dropping by to suggest this small change that will enhance the security of your repository by preventing script injection attacks through your GitHub workflows.
In the piece of code I changed, you were directly using the value of a variable that comes from a user's input, so a malicious user could exploit that input and use it to run arbitrary code. By using an intermediate environment variable, the value of the expression is stored in memory, used as a variable and doesn't interact with the script generation process. This mitigates the script injection risks and also keeps your workflow running exactly as before.
You can find more information about this on this github documentation or in this gitguardian blogpost.
Cheers!