Skip to content

chore(security): add top-level permissions to 5 reusable workflows#790

Merged
anandray merged 1 commit into
developfrom
chore/workflow-permissions-batch1
May 8, 2026
Merged

chore(security): add top-level permissions to 5 reusable workflows#790
anandray merged 1 commit into
developfrom
chore/workflow-permissions-batch1

Conversation

@anandray

@anandray anandray commented May 7, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds permissions: contents: read (least-privilege default) to the top of five workflow files that had no top-level permissions declaration. Closes 5 Scorecard TokenPermissionsID alerts.

Files changed

File Closes Scorecard alert Existing job-level permissions preserved
.github/workflows/_build.yaml #513 Yes (Docker push job retains packages: write)
.github/workflows/_docker.yaml #514 Yes
.github/workflows/_init.yaml #515 Yes (no job-level changes needed)
.github/workflows/_release.yaml #516 Yes (release jobs retain contents: write, packages: write)
.github/workflows/sync-models.yml #605 Yes (sync job retains contents: write, pull-requests: write)

Why this is safe

  • All five are reusable workflows invoked via uses: ./.github/workflows/_*.yaml from caller workflows, except sync-models.yml which runs on schedule
  • Top-level permissions: acts as a default ceiling, not a hard cap — individual jobs raise to write where they need it
  • Existing job-level permissions: blocks are unchanged
  • contents: read matches the pattern in secret-scan.yml and ci.yml

Type

chore (security hardening)

Linked Issue

Fixes #789

Out of scope (follow-up PRs)

  • Stage 2 — narrow broad top-level writes in nightly.yaml + storage-cleanup.yml (3 alerts)
  • Stage 3 — justify or selectively dismiss the 7 job-level write alerts on legitimate release/build operations

SOC2 Notes

CC7.1 vulnerability management — mechanical batch resolution of 5 critical/high TokenPermissionsID findings within the SLA window. SECURITY.md disposition: Fixed.

Summary by CodeRabbit

  • Chores
    • Updated CI/CD workflow permissions across build, deployment, and sync pipelines to enforce least-privilege access controls at the workflow level.

Adds `permissions: contents: read` (least-privilege default) to the
top of five workflow files that had no top-level permissions
declaration:

  - .github/workflows/_build.yaml      (Scorecard #513)
  - .github/workflows/_docker.yaml     (Scorecard #514)
  - .github/workflows/_init.yaml       (Scorecard #515)
  - .github/workflows/_release.yaml    (Scorecard #516)
  - .github/workflows/sync-models.yml  (Scorecard #605)

Existing job-level `permissions:` blocks within these files are
unaffected; the top-level acts as a default ceiling that individual
jobs can raise where they actually need write access (Docker push,
release tag push, etc.).

Stage 1 of 3 in cleaning up TokenPermissionsID findings:
  Stage 1 (this PR): no top-level permissions  -> 5 alerts
  Stage 2 (separate): broad top-level writes   -> 3 alerts
  Stage 3 (separate): job-level writes for     -> 7 alerts
                       legitimate release ops

SOC2 CC7.1 vulnerability management — mechanical batch resolution
following SECURITY.md disposition framework (Fix).

Fixes #789
@anandray
anandray requested a review from kwit75 as a code owner May 7, 2026 23:58
@github-actions github-actions Bot added the ci/cd CI/CD and build system label May 7, 2026
@coderabbitai

coderabbitai Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 37433fc1-4764-459e-85e4-4a70c8b071a5

📥 Commits

Reviewing files that changed from the base of the PR and between 9846a14 and 6d9c58f.

📒 Files selected for processing (5)
  • .github/workflows/_build.yaml
  • .github/workflows/_docker.yaml
  • .github/workflows/_init.yaml
  • .github/workflows/_release.yaml
  • .github/workflows/sync-models.yml

📝 Walkthrough

Walkthrough

Five reusable GitHub Actions workflows (_build.yaml, _docker.yaml, _init.yaml, _release.yaml, sync-models.yml) now declare top-level least-privilege permissions (contents: read). Job-level permissions remain unchanged. No other workflow logic or job definitions were modified.

Changes

SOC2 Compliance: Workflow Permission Declarations

Layer / File(s) Summary
Least-privilege permission declarations
.github/workflows/_build.yaml, .github/workflows/_docker.yaml, .github/workflows/_init.yaml, .github/workflows/_release.yaml, .github/workflows/sync-models.yml
Five reusable workflows receive permissions: contents: read at the workflow level to establish secure defaults. Job-level permissions remain unchanged to elevate access only where needed (e.g., packages: write in build, pull-requests: write in sync).
Scope verification
.github/workflows/_build.yaml
Workflow trigger blocks and other configurations remain unchanged; only permission declarations are added.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • rocketride-org/rocketride-server#297: Directly related prior work updating workflow-level permissions in the same set of reusable workflow files with identical permission defaults.
  • rocketride-org/rocketride-server#261: Related permission governance—both PRs adjust GitHub Actions workflow token permissions to apply least-privilege defaults at the workflow level.

Suggested labels

ci/cd

Suggested reviewers

  • kwit75

Poem

🐰 Five workflows stand in a row so neat,
With contents: read in perfect beat,
Least privilege rules the action stage,
SOC2 compliance on each page,
Security thumps its approval deep! 🔐

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding top-level permissions to five reusable workflows for security hardening.
Linked Issues check ✅ Passed All five workflows have been updated with top-level permissions: contents: read blocks immediately after name: declarations, exactly as specified in issue #789.
Out of Scope Changes check ✅ Passed All changes are within scope of issue #789 Stage 1; no additional modifications to job logic, steps, or unrelated files were introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/workflow-permissions-batch1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented May 7, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@kwit75 kwit75 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM — pure additive top-level least-privilege defaults; job-level permissions for write paths preserved (Docker push, tag/release, model-sync PR, SARIF upload). Closes 5 Scorecard alerts. CI green.

@anandray
anandray merged commit 13771ef into develop May 8, 2026
24 checks passed
@anandray
anandray deleted the chore/workflow-permissions-batch1 branch May 8, 2026 00:45
anandray added a commit that referenced this pull request May 8, 2026
…794)

Moves \`actions: write\` from the workflow-level permissions block to
the \`cleanup\` job's own permissions block. Top-level now defaults to
\`contents: read\`, so any future job added to this workflow inherits
read-only by default rather than the broad cleanup token.

The \`cleanup\` job's effective permissions are unchanged
(\`actions: write\` + \`contents: read\`), so behavior is identical.

Stage 2a of the TokenPermissionsID cleanup. Stage 1 (PR #790) verified
that the top-level least-privilege pattern is accepted by Scorecard.

Closes Scorecard alert #528.
SOC2 CC7.1 vulnerability management.

Fixes #793

Co-authored-by: Anand Ray <anand.ray@rocketride.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/cd CI/CD and build system

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SOC2] Add top-level permissions blocks to reusable workflow files

2 participants