Skip to content

Update workflows to use short-lived dispatch tokens - #38

Closed
ColinDaglish wants to merge 0 commit into
mainfrom
37-fix-workflow-call-issue-so-that-private-key-is-not-passed-down
Closed

Update workflows to use short-lived dispatch tokens#38
ColinDaglish wants to merge 0 commit into
mainfrom
37-fix-workflow-call-issue-so-that-private-key-is-not-passed-down

Conversation

@ColinDaglish

Copy link
Copy Markdown
Contributor

Pull Request

Overview

This change enhances security by implementing short-lived dispatch tokens for workflows, ensuring that sensitive credentials are not passed down unnecessarily.

What Changed

  • Updated workflows to mint a repository-scoped PROJECT_ROUTER_BOT_TOKEN.
  • Replaced the use of PROJECT_ROUTER_BOT_PRIVATE_KEY in workflows with the new token.
  • Implemented token revocation after use in public reusable workflows.
  • Added concurrency control to prevent overlapping workflow runs.

Validation

  • Verified that workflows successfully mint and use the short-lived dispatch token.
  • Conducted tests to ensure that the token is revoked after the workflow execution.
  • Manual verification confirmed that no private keys are exposed in the workflow calls.

Reviewer Notes

  • Review the implementation of token revocation to ensure it functions as intended.
  • Consider potential edge cases where the token might expire before use.
  • Follow-up work may include monitoring for any issues related to token management in workflows.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Masked installation tokens cannot propagate through job outputs, breaking the new caller flow, and one ADR example contains invalid YAML.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Moves dispatch authentication to caller-minted, short-lived GitHub App tokens and adds downstream revocation.

Changes:

  • Replaces private-key forwarding with scoped installation tokens.
  • Adds token minting, revocation, and concurrency controls.
  • Updates security architecture and usage documentation.
File summaries
File Description
.github/workflows/add-issue-to-projects.yml Accepts and revokes dispatch tokens.
.github/workflows/add-pr-to-projects.yml Accepts and revokes dispatch tokens.
.github/workflows/test-add-issue-to-projects-reusable.yml Adds token minting and concurrency.
.github/workflows/test-add-pr-to-projects-reusable.yml Adds token minting and concurrency.
.github/copilot-instructions.md Records the new credential model.
docs/how-to/use-add-issue-to-projects-workflow.md Updates caller example.
docs/how-to/use-add-pr-to-projects-workflow.md Updates caller example.
docs/reference/reusable-workflows.md Documents token lifecycle and contract.
docs/reference/github-apps.md Clarifies router credential usage.
docs/explanation/ADR-0001-called-workflow-owns-secret-usage.md Updates the credential-boundary decision.
docs/explanation/ADR-0004-separate-reusable-pinning-from-dispatch-ref.md Updates the SHA-pinned caller example.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 7
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +31 to +32
outputs:
token: ${{ steps.app-token.outputs.token }}
Comment on lines +32 to +33
outputs:
token: ${{ steps.app-token.outputs.token }}
Comment on lines +52 to +53
outputs:
token: ${{ steps.app-token.outputs.token }}
Comment on lines +38 to +39
outputs:
token: ${{ steps.app-token.outputs.token }}
Comment on lines +39 to +40
outputs:
token: ${{ steps.app-token.outputs.token }}
Comment thread docs/reference/reusable-workflows.md Outdated
- `PROJECT_ROUTER_BOT_APP_ID` (Actions variable, org-level)
- `PROJECT_ROUTER_BOT_PRIVATE_KEY` (Actions secret, org-level)

Callers mint the token in a separate job with `actions/create-github-app-token`, scoped to `datasciencecampus/github-actions` with only `actions: write`. They pass the resulting token to the public reusable workflow as `PROJECT_ROUTER_BOT_TOKEN`; the private key does not cross that workflow boundary. Because the token is consumed by a later job, the minting action must set `skip-token-revoke: true`. The reusable workflow revokes the token after the dispatch attempt, with its one-hour expiry as a fallback if cleanup cannot run.
Comment on lines +55 to +59
- id: app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.PROJECT_ROUTER_BOT_APP_ID }}
private-key: ${{ secrets.PROJECT_ROUTER_BOT_PRIVATE_KEY }}
@ColinDaglish
ColinDaglish force-pushed the 37-fix-workflow-call-issue-so-that-private-key-is-not-passed-down branch from 77d1465 to 4dcd9a0 Compare September 2, 2026 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants