Skip to content

Declare explicit secrets inputs instead of relying on callers' secrets: inherit #671

Description

@prymax10

Context

Every caller of go-pr-validation.yml across the org passes secrets: inherit — br-slc, br-sta, br-sisbajud, br-consignado-gw. A review of LerianStudio/br-sisbajud#229 flagged this as CWE-732 (incorrect permission assignment): inherit forwards all of the caller repository's secrets into the reusable workflow and onward to every nested workflow, far beyond what any of them consume.

The finding is legitimate. It was declined in that PR because fixing it caller-by-caller is unsafe and would fragment the convention — this is the right place to fix it once.

Why callers cannot fix it themselves

The suggested replacement in that review was MANAGE_TOKEN, SLACK_WEBHOOK_URL and LERIAN_LIB_READ_TOKEN. Enumerating what the chain actually consumes at v1.47.4 shows that list is incomplete — it would have broken the security scan silently:

Nested workflow Secrets actually referenced
pr-validation.yml MANAGE_TOKEN, SLACK_WEBHOOK_URL
go-pr-analysis.yml MANAGE_TOKEN, SLACK_WEBHOOK_URL
pr-security-scan.yml MANAGE_TOKEN, SLACK_WEBHOOK_URL, GITHUB_TOKEN, DOCKER_USERNAME, DOCKERHUB_IMAGE_PULL_TOKEN, NPMRC_TOKEN
lerian-lib-version-check.yml MANAGE_TOKEN, LERIAN_LIB_READ_TOKEN

Union across the chain: MANAGE_TOKEN, SLACK_WEBHOOK_URL, LERIAN_LIB_READ_TOKEN, GITHUB_TOKEN, DOCKER_USERNAME, DOCKERHUB_IMAGE_PULL_TOKEN, NPMRC_TOKEN.

Three of the seven were missing from the suggested list. A caller adopting it would lose Docker Hub pull credentials and the npm token in pr-security-scan.yml, and the Slack notification path fails quietly rather than loudly.

Proposed change

Declare an explicit secrets: block on go-pr-validation.yml's workflow_call, marking each as required: false where the corresponding job is optional, and forward them explicitly to the nested workflows instead of relying on inheritance. Callers then move from secrets: inherit to a named mapping, and the contract becomes visible and auditable at the boundary.

Suggested rollout: land the explicit inputs while still accepting inherit (no breaking change), migrate callers one repo at a time, then tighten.

Notes

  • Verified against tag v1.47.4 (commit 419fe86a8a8aa70c1b4b796a2f2bed895456e54d).
  • Raised from MAP-3954 (controlled repository sharing); recorded as separate technical debt so it is not mixed into that work.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions