fix(ci): harden release-proposal-dispatch against untrusted main_start_ref#2045
Merged
Conversation
…t_ref Block three privilege-escalation paths for an authorised release operator who selects an attacker-controlled `main_start_ref`: - Reject `refs/pull/*` and require the resolved commit be reachable from `origin/main` or the matching `origin/hotfix/<crate>/N.x.x` branch. - Reject `pre-release-hook` / `pre-release-replacements` anywhere in the checked-out `Cargo.toml` / `release.toml`, since cargo-release would execute them with the job's OIDC mint capability. - Move `inputs.main_start_ref` from inline template expansion into an `env:` mapping on the ephemeral-branch step to close a shell-injection sink. Also extract the hotfix branch regex into `HOTFIX_REF_PATTERN` at workflow level so all three call sites stay in sync. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: a710531 | Docs | Datadog PR Page | Give us feedback! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 93f0b9d356
ℹ️ 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".
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2045 +/- ##
==========================================
- Coverage 72.86% 72.83% -0.03%
==========================================
Files 459 459
Lines 76134 76134
==========================================
- Hits 55472 55453 -19
- Misses 20662 20681 +19
🚀 New features to boost your workflow:
|
Contributor
Artifact Size Benchmark Reportaarch64-alpine-linux-musl
aarch64-unknown-linux-gnu
libdatadog-x64-windows
libdatadog-x86-windows
x86_64-alpine-linux-musl
x86_64-unknown-linux-gnu
|
…ay forms The previous pattern required the key to be preceded by start-of-line or whitespace, so valid TOML forms like `package.metadata.release.pre-release-hook = "..."` and `[[package.metadata.release.pre-release-replacements]]` would slip past the guard while still being honoured by cargo-release. Switch to a broader match that catches the key name in any TOML position (bare, dotted, quoted, inline-table, array-of-table) while still excluding `#` comments. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
hoolioh
approved these changes
May 27, 2026
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.
What does this PR do?
Harden
release-proposal-dispatchagainst untrustedmain_start_refBlock three privilege-escalation paths for an authorised release operator who selects an attacker-controlled
main_start_ref:refs/pull/*and require the resolved commit be reachable fromorigin/mainor the matchingorigin/hotfix/<crate>/N.x.xbranch.pre-release-hook/pre-release-replacementsanywhere in the checked-outCargo.toml/release.toml, since cargo-release would execute them with the job's OIDC mint capability.inputs.main_start_reffrom inline template expansion into anenv:mapping on the ephemeral-branch step to close a shell-injection sink.Also extract the hotfix branch regex into
HOTFIX_REF_PATTERNat workflow level so all three call sites stay in sync.