Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the labeler workflow hardening changes.
No open issues 🎉
What changed in this PR
Hardens the labeler workflow while retaining pull_request_target for labeling fork PRs, with no intended behavior change.
Changes:
- Pins action references to full commit SHAs with version comments.
- Moves token permissions to the triage job and defaults workflow permissions to none.
- Replaces inline expressions in shell commands with environment variables and documents the trigger’s safety rationale.
| File | Description |
|---|---|
.github/workflows/labeler.yml |
Hardens action references, permission scope, and shell input handling while preserving existing automation. |
Review effort: Balanced
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
Harden
.github/workflows/labeler.yml; thepull_request_targettrigger is kept.permissions: {}, with the needed permissions set on the job.pull_request_targetis kept and that no PR code is checked out.${{ }}inrun:(github.repository, github.actor, step outputs in the debug step) with env vars.Why
pull_request_targetis needed to add labels to PRs from forks (apull_requesttoken is read-only there). The workflow never checks out or runs PR code, so the trigger is safe here; pinning and least privilege limit the damage if an action tag were ever moved. Part of thepull_request_targetaudit: https://github.com/elastic/observability-robots/issues/5292Behaviour change
None intended. Same triggers, same steps, same permissions (now scoped to the job).
Verification
Done:
dangerous-triggersremains, which is the intentionalpull_request_target.gh api(annotated tags dereferenced) and checked the latest non-draft releases.${{ }}left in anyrun:.Not done:
🤖 Generated with Claude Code