Skip to content

ci: harden labeler workflow - #434

Merged
SylvainJuge merged 1 commit into
mainfrom
chore/harden-labeler
Nov 6, 2026
Merged

SylvainJuge merged 1 commit into
mainfrom
chore/harden-labeler

Conversation

@mallendem

Copy link
Copy Markdown
Contributor

What

Harden .github/workflows/labeler.yml; the pull_request_target trigger is kept.

  • Pin every action to a full commit SHA with a version comment (latest published releases: create-github-app-token v3.3.0, github-script v9.0.0, oblt-actions v1.43.0, action-add-labels v1.1.0, issue-labeler v2.3, which is its only release).
  • Top-level permissions: {}, with the needed permissions set on the job.
  • Comment explaining why pull_request_target is kept and that no PR code is checked out.
  • Replaced inline ${{ }} in run: (github.repository, github.actor, step outputs in the debug step) with env vars.

Why

pull_request_target is needed to add labels to PRs from forks (a pull_request token 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 the pull_request_target audit: https://github.com/elastic/observability-robots/issues/5292

Behaviour change

None intended. Same triggers, same steps, same permissions (now scoped to the job).

Verification

Done:

  • zizmor 1.30.1 (offline, container, all default audits): only dangerous-triggers remains, which is the intentional pull_request_target.
  • YAML parses.
  • Resolved action SHAs with gh api (annotated tags dereferenced) and checked the latest non-draft releases.
  • No inline ${{ }} left in any run:.

Not done:

  • No workflow run of the new version (needs a real issue/PR event).

🤖 Generated with Claude Code

@mallendem
mallendem marked this pull request as ready for review November 6, 2026 08:43
@mallendem
mallendem requested review from a team as code owners November 6, 2026 08:43
Copilot AI balanced review requested due to automatic review settings November 6, 2026 08:43

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.

🔵 Needs a closer look

Upstream action read timeouts left pinned implementations and transitive dependencies unverified, requiring human verification because the pull_request_target job exposes privileged tokens to them.

No open issues 🎉

What changed in this PR

Hardens the ECS Java logging repository’s labeler workflow while retaining pull_request_target for fork PR labeling, with no intended behavior changes.

Changes:

  • Pins action references to full commit SHAs with version comments.
  • Sets empty workflow-level permissions and scopes required permissions to the triage job.
  • Moves inline shell expressions into environment variables and documents why pull_request_target is retained.
File Description
.github/​workflows/​labeler.yml Hardens action references, token permissions, and shell inputs while preserving existing automation.

Review effort: Balanced

@SylvainJuge
SylvainJuge merged commit b27df8f into main Nov 6, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants