Skip to content

ci: replace secrets inherit with explicit token mapping for chatops - #5071

Open
mayankdev-oss wants to merge 2 commits into
tektoncd:mainfrom
mayankdev-oss:resolve-zizmor-secrets-inherit
Open

ci: replace secrets inherit with explicit token mapping for chatops#5071
mayankdev-oss wants to merge 2 commits into
tektoncd:mainfrom
mayankdev-oss:resolve-zizmor-secrets-inherit

Conversation

@mayankdev-oss

Copy link
Copy Markdown

Changes

Fixes #5068

This PR addresses the security vulnerability warnings flagged by zizmor regarding unrestricted secret inheritance. Instead of using secrets: inherit which passes all repository secrets to called workflows unconditionally, this explicitly maps only the required tokens to improve the security posture of our CI/CD pipelines.

Specifically, it:

  • Replaces secrets: inherit in .github/workflows/chatops-retest.yml with an explicit pass-through mapping for CHATOPS_TOKEN.
  • Replaces secrets: inherit in .github/workflows/slash.yml with an explicit pass-through mapping for CHATOPS_TOKEN.

Submitter Checklist

As the author of this PR, please check off the items in this checklist:

  • Docs included if any changes are user facing
  • Tests included if any functionality added or changed
  • Follows the commit message standard
  • Meets the Tekton contributor standards (including functionality, content, code)
  • Has a kind label. You can add one by adding a comment on this PR that contains /kind <type>. Valid types are bug, cleanup, design, documentation, feature, flake, misc, question, tep
  • Release notes block below has been updated with any user facing changes (new features, significant UI changes, API changes, bug fixes, changes requiring upgrade notices or deprecation warnings)
  • Release notes contains the string "action required" if the change requires additional action from users switching to the new release

Release Notes

NONE

@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Jun 23, 2026
@tekton-robot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign alangreene after the PR has been reviewed.
You can assign the PR to them by writing /assign @alangreene in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@mayankdev-oss

Copy link
Copy Markdown
Author

/kind cleanup

@tekton-robot tekton-robot added the kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. label Jun 23, 2026

@AlanGreene AlanGreene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we not also need to update the workflows in the plumbing repo to accept this?

https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-syntax#jobsjob_idsecretssecret_id

The identifier must match the name of a secret defined by on.workflow_call.secrets.<secret_id> in the called workflow.

This isn't required when using inherit as all secrets the calling workflow has access to are made available to the called workflow.

https://docs.github.com/en/actions/how-tos/reuse-automations/reuse-workflows#using-inputs-and-secrets-in-a-reusable-workflow

If the secrets are inherited by using secrets: inherit in the calling workflow, you can reference them even if they are not explicitly defined in the on key.

Comment thread .github/workflows/chatops-retest.yml Outdated
@mayankdev-oss
mayankdev-oss force-pushed the resolve-zizmor-secrets-inherit branch from eb638cb to 5a2f716 Compare June 24, 2026 05:45
@tekton-robot tekton-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 24, 2026
@mayankdev-oss
mayankdev-oss force-pushed the resolve-zizmor-secrets-inherit branch from 5a2f716 to 0600c5c Compare June 24, 2026 06:15
@tekton-robot tekton-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Jun 24, 2026
@mayankdev-oss
mayankdev-oss force-pushed the resolve-zizmor-secrets-inherit branch from 0600c5c to 4b4073b Compare June 24, 2026 06:16
@tekton-robot tekton-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Jun 24, 2026
@mayankdev-oss

Copy link
Copy Markdown
Author

Great catch, Alan! Thanks for pointing that out. I totally missed that the reusable workflows would need on.workflow_call.secrets explicitly defined once we drop inherit.

I've just pushed a commit to fix the indentation nit here. Should I go ahead and open a quick PR over in the tektoncd/plumbing repo to update _chatops_retest.yml and _slash.yml? Happy to get that done so we can unblock this one!

@mayankdev-oss
mayankdev-oss requested a review from AlanGreene June 24, 2026 09:46
@mayankdev-oss

Copy link
Copy Markdown
Author

@AlanGreene following up on this. Should I go ahead and open a PR in the tektoncd/plumbing repo to explicitly map on.workflow_call.secrets for _chatops_retest.yml and _slash.yml to unblock this?

@AlanGreene

Copy link
Copy Markdown
Member

Yes the plumbing change is required to unblock this

@mayankdev-oss

Copy link
Copy Markdown
Author

@AlanGreene I have submitted the required plumbing repository changes across two clean PRs to explicitly declare the secrets schema:

Please let me know if these look good or if you need any adjustments on either side!

@AlanGreene AlanGreene left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mayankdev-oss Thanks again for your work on this so far. The changes in the plumbing repo were merged a few weeks ago so this PR now just needs to be updated to use the new versions of the relevant workflows.

I've also left a few comments on unrelated changes to newlines / comments that should be reverted.

Please squash your commits when done.

@@ -1,14 +1,12 @@
name: Rerun Failed Actions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this


permissions:
contents: read

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this

on:
repository_dispatch:
types: [retest-command]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this

@@ -1,17 +1,15 @@
name: Slash Command Routing

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this


permissions:
contents: read

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this

on:
issue_comment:
types: [created]

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this

Comment on lines -14 to -15
issues: write # for peter-evans/slash-command-dispatch to create issue reaction
pull-requests: write # for peter-evans/slash-command-dispatch to create PR reaction

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: revert this

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

Labels

kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Follow-up: Resolve secrets-inherit warnings caught by zizmor

3 participants