fix: replace secrets: inherit with explicit secret mappings in CI/CD workflows - #213
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR tightens GitHub Actions reusable-workflow secret handling by removing secrets: inherit and explicitly passing only the secrets each stage needs, aligning the CI/CD pull request pipeline with least-privilege principles and addressing the SonarCloud finding.
Changes:
- Replaced
secrets: inheritwith explicit secret mappings when calling reusable stage workflows from the pull request pipeline. - Declared required/optional
on.workflow_call.secretsin reusable workflows so callers can only pass approved secrets. - Stopped passing secrets to stages that don’t use them (build and acceptance).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| .github/workflows/cicd-1-pull-request.yaml | Replaces secrets: inherit with explicit secret mappings for commit/test stages; removes secret passing for build/acceptance. |
| .github/workflows/stage-1-commit.yaml | Declares the four IDP_AWS_REPORT_UPLOAD_* secrets for workflow_call (optional). |
| .github/workflows/stage-2-test.yaml | Declares SONAR_TOKEN for workflow_call (required). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
hirra-farooq
approved these changes
Apr 10, 2026
walteck
added this pull request to the merge queue
Apr 20, 2026
This was referenced Jul 21, 2026
This was referenced Jul 31, 2026
This was referenced Aug 24, 2026
Merged
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.
Description
Replace
secrets: inheritwith explicit secret mappings in the CI/CD pull request workflow and add correspondingsecrets:declarations to the reusable stage workflows.cicd-1-pull-request.yaml:commit-stagenow passes only the fourIDP_AWS_REPORT_UPLOAD_*secrets;test-stagenow passes onlySONAR_TOKEN;build-stageandacceptance-stageno longer pass any secrets as none are requiredstage-1-commit.yaml: addedsecrets:block toon.workflow_calldeclaring the fourIDP_AWS_REPORT_UPLOAD_*secretsstage-2-test.yaml: addedsecrets:block toon.workflow_calldeclaringSONAR_TOKENContext
SonarCloud flagged the use of
secrets: inheritin.github/workflows/cicd-1-pull-request.yaml(lines 81, 94, 108, and 122) as a security risk.When
secrets: inheritis used to call a reusable workflow, all repository secrets are made available to that workflow, violating the principle of least privilege. By replacing it with explicit secret mappings, each reusable workflow receives only the specific secrets it requires, reducing the blast radius of any potential secret exposure.Type of changes
Checklist
Sensitive Information Declaration
To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.