Repository navigation
Always enable redaction in GitHub actions. - #16200
Conversation
Summary of ChangesHello @gundermanc, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a critical security enhancement by ensuring that environment variable redaction is always active within GitHub Actions workflows. This change prevents the accidental exposure of sensitive data in logs by overriding any configuration that might otherwise disable redaction. Additionally, the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
e3c6e84 to
ffec38a
Compare
There was a problem hiding this comment.
Code Review
This pull request correctly enforces environment variable redaction when running in GitHub Actions, which is a good security enhancement. My review focuses on making the detection of the CI environment more robust. I've suggested using the standard GITHUB_ACTIONS environment variable in environmentSanitization.ts to ensure this security feature is reliable. The test changes look good and correctly validate the new behavior.
| const isStrictSanitization = | ||
| !!processEnv['GITHUB_SHA'] || processEnv['SURFACE'] === 'Github'; |
There was a problem hiding this comment.
While using GITHUB_SHA is a good way to detect if the code is running in GitHub Actions, the most standard and reliable method is to check for process.env.GITHUB_ACTIONS === 'true'. This environment variable is documented by GitHub to be always set to 'true' in a workflow context.
Adding this check would make the detection more robust and idiomatic, reducing the risk of this security feature being accidentally disabled in some edge cases or future runner environments. The SURFACE variable seems to be a custom convention, which is fine to keep for specific use cases, but adding the standard check improves future-proofing and clarity.
| const isStrictSanitization = | |
| !!processEnv['GITHUB_SHA'] || processEnv['SURFACE'] === 'Github'; | |
| const isStrictSanitization = | |
| process.env.GITHUB_ACTIONS === 'true' || !!processEnv['GITHUB_SHA'] || processEnv['SURFACE'] === 'Github'; |
There was a problem hiding this comment.
Not a regression. We can consider this later. @galz10 FYI.
|
Size Change: +61 B (0%) Total Size: 22.3 MB ℹ️ View Unchanged
|
Summary
Force-enables redaction of sensitive environment variables when run in GitHub actions, regardless of the user setting.
Pre-Merge Checklist