Skip to content

ci: set least-privilege token permissions on core CI workflows - #8062

Open
rivassec wants to merge 2 commits into
elastic:mainfrom
rivassec:harden/ci-token-permissions
Open

ci: set least-privilege token permissions on core CI workflows#8062
rivassec wants to merge 2 commits into
elastic:mainfrom
rivassec:harden/ci-token-permissions

Conversation

@rivassec

Copy link
Copy Markdown

Adds a top-level permissions: contents: read to core CI workflows that currently rely on the default GITHUB_TOKEN scope: unit-test.yml, ci-pull_request.yml, packaging.yml (PR/merge_group builds only, no push), and ci.yml.

ci.yml keeps all its existing job-level permissions: blocks (OIDC id-token: write, pull-requests: write) — those override the top-level default, so only the previously-unscoped jobs are tightened. eks-ci.yml is intentionally left out (it writes back to the PR and pushes images).

No behavior change; hardening only.

@mergify

mergify Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

This pull request does not have a backport label. Could you fix it @rivassec? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v./d./d./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

@rivassec
rivassec force-pushed the harden/ci-token-permissions branch from 1b0208b to 6b9e28e Compare August 24, 2026 00:37
@cla-checker-service

cla-checker-service Bot commented Aug 24, 2026

Copy link
Copy Markdown

💚 CLA has been signed

Add an explicit top-level `permissions: contents: read` block to core CI
workflows that previously relied on the default GITHUB_TOKEN scope:
ci.yml, ci-pull_request.yml, unit-test.yml, packaging.yml.

These workflows run build/test/lint/package jobs only. In ci.yml the
jobs that need broader scope already declare their own job-level
permissions (id-token: write for cloud OIDC, pull-requests: write for
the allure/PR-comment job); those job-level blocks override the
top-level default and are unchanged. No behavior change.
@rivassec
rivassec force-pushed the harden/ci-token-permissions branch from 6b9e28e to 39de42a Compare August 24, 2026 00:39
@rivassec
rivassec marked this pull request as ready for review August 24, 2026 00:40
@rivassec
rivassec requested a review from a team as a code owner August 24, 2026 00:40
@rivassec

Copy link
Copy Markdown
Author

This pull request does not have a backport label. Could you fix it @rivassec? 🙏 To fixup this pull request, you need to add the backport labels for the needed branches, such as:

* `backport-v./d./d./d` is the label to automatically backport to the `8./d` branch. `/d` is the digit

* `backport-active-all` is the label that automatically backports to all active branches.

* `backport-active-8` is the label that automatically backports to all active minor branches for the 8 major.

* `backport-active-9` is the label that automatically backports to all active minor branches for the 9 major.

I do not have the ability of assign labels

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.

1 participant