Skip to content

ci: replace secrets.GITHUB_TOKEN with dd-octo-sts#3875

Open
lloeki wants to merge 1 commit into
masterfrom
lloeki/dd-octo-sts
Open

ci: replace secrets.GITHUB_TOKEN with dd-octo-sts#3875
lloeki wants to merge 1 commit into
masterfrom
lloeki/dd-octo-sts

Conversation

@lloeki
Copy link
Copy Markdown
Member

@lloeki lloeki commented May 12, 2026

Stacked on #3878 (chainguard policies — merge first).

Description

Replace all secrets.GITHUB_TOKEN usage across 4 GitHub Actions workflows with OIDC tokens from DataDog/dd-octo-sts-action.

  • Added 4 Chainguard policy files
  • Added permissions block to add-asset-to-gh-release.yml (previously had none)
  • No functional changes

Reviewer checklist

  • Test coverage seems ok.
  • Appropriate labels assigned.

@lloeki lloeki force-pushed the lloeki/dd-octo-sts branch from f598baf to 89c8d32 Compare May 12, 2026 09:11
@datadog-prod-us1-4
Copy link
Copy Markdown

datadog-prod-us1-4 Bot commented May 12, 2026

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

🎯 Code Coverage (details)
Patch Coverage: 100.00%
Overall Coverage: 60.68% (+0.01%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0725324 | Docs | Datadog PR Page | Give us feedback!

Migrate all 4 GitHub Actions workflows from
secrets.GITHUB_TOKEN to OIDC tokens minted by
DataDog/dd-octo-sts-action. The token exchange is
auditable and governed by chainguard policy files that
explicitly declare which workflow, event, and ref pattern
may request which permissions.

Add a permissions block to add-asset-to-gh-release.yml
which previously had none.
@lloeki lloeki force-pushed the lloeki/dd-octo-sts branch from 89c8d32 to 0725324 Compare May 12, 2026 14:19
@lloeki lloeki changed the base branch from master to lloeki/dd-octo-sts-chainguard May 12, 2026 14:28
@lloeki lloeki marked this pull request as ready for review May 12, 2026 15:13
@lloeki lloeki requested a review from a team as a code owner May 12, 2026 15:13
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0725324cf3

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +23 to +28
- name: Get GitHub Token via dd-octo-sts
id: generate-token
uses: DataDog/dd-octo-sts-action@96a25462dbcb10ebf0bfd6e2ccc917d2ab235b9a # v1.0.4
with:
scope: DataDog/dd-trace-php
policy: self.auto-label-prs
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Restrict STS token minting on pull_request workflows

This workflow now mints a write-scoped STS token during pull_request runs and then hands it to code from the checked-out PR (./github-actions-helpers/build.sh), which means forked PRs can execute attacker-controlled code with stronger permissions than the default fork token model. With secrets.GITHUB_TOKEN, fork PRs are read-only by default, but self.auto-label-prs grants issues: write and pull_requests: write, so a malicious fork can exfiltrate or abuse that token to mutate PR metadata in the base repo; the same pattern also appears in auto_check_snapshots.yml.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

@lloeki lloeki May 13, 2026

Choose a reason for hiding this comment

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

Good callout.

@bwoebi the problem here seems to be the need to checkout, which makes it depend on untrusted repo code that could leverage the token for mischief.

Contrast with this one which doesn't clone: https://github.com/DataDog/dd-trace-rb/blob/master/.github/workflows/pull-request-labeler.yml

That said, this is moot if external contributor PRs don't run this CI workflow (which I think it doesn't?)

Base automatically changed from lloeki/dd-octo-sts-chainguard to master May 13, 2026 10:08
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