ci: scope GITGUARDIAN_API_KEY to ggshield-action step only#6
Merged
Conversation
Per Copilot review feedback on YouTubeMusicPS#21: the previous job-level env exposed the full secret value to every step in the job (including actions/checkout and any future additions), even though only the ggshield-action step needs it. Switches to a boolean-gate pattern: job-level env exposes only GGSHIELD_ENABLED (a "true"/"false" string indicating whether the secret is set), and the actual GITGUARDIAN_API_KEY value is scoped via step-level env on the ggshield-action invocation. Behavior unchanged when the secret is set; better defense-in-depth against future steps inheriting the secret unintentionally. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Scopes the GITGUARDIAN_API_KEY secret so it’s only available to the GitGuardian/ggshield-action step, reducing accidental secret exposure across the rest of the job while preserving the existing “graceful skip” behavior when the secret is not set.
Changes:
- Replaces job-level
GITGUARDIAN_API_KEYwith a job-level boolean gate (GGSHIELD_ENABLED) derived from secret presence. - Updates step
if:conditions to checkGGSHIELD_ENABLED == 'true'. - Adds step-level
envto passGITGUARDIAN_API_KEYonly to the ggshield action step.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Summary
Refines the graceful-skip pattern landed earlier so the
GITGUARDIAN_API_KEYsecret value is no longer exposed to every step of the ggshield job.Before: job-level
env: { GITGUARDIAN_API_KEY: ${{ secrets.GITGUARDIAN_API_KEY }} }made the secret visible toactions/checkoutand any future steps in the job.After: job-level env only exposes a boolean (
GGSHIELD_ENABLED: ${{ secrets.GITGUARDIAN_API_KEY != '' }}); the actual secret value is scoped to theggshield-actionstep via step-level env.Why
Copilot review feedback on tablackburn/YouTubeMusicPS#21 flagged the wider exposure. Adopted there in commit 8af9b36; this PR propagates the same refinement to keep the convention aligned across all template-derived repos.
Behavior
No functional change when the secret is set (gate evaluates to
'true'and the action runs as before). Pure defense-in-depth: future additions to the job can't accidentally inherit the secret.Test plan
GitGuardian Scanruns (gate evaluates true here)🤖 Generated with Claude Code