Skip to content

fix(ci): tighten PR workflow permissions and secret access (v2.0 backport)#903

Merged
robdecker merged 2 commits into
v2.0from
fix/ci-harden-pr-workflows-v2.0
May 11, 2026
Merged

fix(ci): tighten PR workflow permissions and secret access (v2.0 backport)#903
robdecker merged 2 commits into
v2.0from
fix/ci-harden-pr-workflows-v2.0

Conversation

@robdecker
Copy link
Copy Markdown
Member

Summary

Backport of #901 to the v2.0 pre-release staging branch. Applies the same security mitigations to next-drupal.yml and release-pr.yml so this branch's PR-triggered workflows have the same hardened defaults.

next-drupal.yml

  • Switch from pull_request_target to pull_request
  • persist-credentials: false on checkout
  • permissions: contents: read at workflow root
  • Drupal secrets only loaded when github.event_name == 'push' to v2.0
  • PR runs skip the integration test (crud-methods) and lift coverage threshold accordingly
  • concurrency cancel-in-progress + timeout-minutes: 15
  • Trigger filters updated to v2.0 (replaces stale main references)

release-pr.yml

  • Trigger restricted to pull_request: [labeled]
  • Internal-PR guard: head.repo.full_name == base.repo.full_name
  • persist-credentials: false on checkout
  • setup-node@v4 registry-url + NODE_AUTH_TOKEN (replaces inline .npmrc echo)
  • Replace third-party comment action with built-in gh pr comment
  • permissions: contents: read, pull-requests: write
  • concurrency cancel-in-progress + timeout-minutes: 15

Test plan

  • CI on this PR validates the new next-drupal.yml (PR path, integration test skipped)
  • Push-to-v2.0 path runs full test suite with Drupal secrets after merge
  • release-pr.yml validated on next experimental release attempt against this branch

Notes

v2.0 is the pre-release staging branch (where features merge before stable npm release) and serves docs from https://next-drupal.org/.

…port)

Backport of #901. Same security mitigations applied to the v2.0
pre-release staging branch.

next-drupal.yml:
- Switch from pull_request_target to pull_request
- persist-credentials: false on checkout
- permissions: contents: read
- Gate Drupal secrets to push-to-v2.0 events only
- Add concurrency + timeout-minutes

release-pr.yml:
- Restrict trigger to internal-PR labeled events
- persist-credentials: false on checkout
- setup-node@v4 registry-url + NODE_AUTH_TOKEN
- Replace third-party comment action with gh CLI
- permissions: contents: read, pull-requests: write
- Add concurrency + timeout-minutes
@vercel
Copy link
Copy Markdown

vercel Bot commented May 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
next-drupal-next Ready Ready Preview, Comment May 8, 2026 11:49pm
2 Skipped Deployments
Project Deployment Actions Updated (UTC)
next-drupal Ignored Ignored May 8, 2026 11:49pm
next-drupal-v1-6 Ignored Ignored May 8, 2026 11:49pm

Request Review

… list

The test utility module constructs a Drupal client at module load
time, which throws when DRUPAL_CLIENT_ID and DRUPAL_CLIENT_SECRET
are unset. Pass placeholder values on PR runs so unit tests
(which mock fetch) can import the utils without crashing.

Several additional test files exercise a live Drupal instance and
fail when pointed at the placeholder DRUPAL_BASE_URL. Until the live
dependency is removed, skip these on PR runs alongside crud-methods.
@robdecker robdecker merged commit 558412b into v2.0 May 11, 2026
6 checks passed
@robdecker robdecker deleted the fix/ci-harden-pr-workflows-v2.0 branch May 11, 2026 20:23
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