Skip to content

fix(ci): give callers the union of the reusable's declared permissions - #105

Merged
hyperpolymath merged 2 commits into
mainfrom
fix/caller-permissions-union
Sep 21, 2026
Merged

hyperpolymath merged 2 commits into
mainfrom
fix/caller-permissions-union

Conversation

@hyperpolymath

Copy link
Copy Markdown
Owner

Job-level permissions: replace the workflow-level block, so a job block that lists only some keys silently drops the rest and GitHub refuses the call (The workflow is requesting 'id-token: write'/'contents: read', but is only allowed '<none>').

This sets each calling job's block to the union of the workflow-level grants and the callee's declared permissions (max level per key), validated by re-parsing the file before commit.

@hyperpolymath
hyperpolymath merged commit a499723 into main Sep 21, 2026
@hyperpolymath
hyperpolymath deleted the fix/caller-permissions-union branch September 21, 2026 08:08
@coderabbitai

coderabbitai Bot commented Sep 21, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 7be93811-bfc9-4ed4-9af7-272e85a54593

📥 Commits

Reviewing files that changed from the base of the PR and between 61b3034 and 582bb2d.

📒 Files selected for processing (2)
  • .github/workflows/governance.yml
  • .github/workflows/mirror.yml
 ____________________________________________________________________________________________________________________________________
< Contrary to popular belief, Unix is user friendly. It just happens to be very selective about who it decides to make friends with. >
 ------------------------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).

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.

@github-actions

Copy link
Copy Markdown

🔍 Hypatia Security Scan

Findings: 37 issues detected

Severity Count
🔴 Critical 1
🟠 High 14
🟡 Medium 22

⚠️ Action Required: Critical security issues found!

View findings
[
  {
    "reason": "Job `triage` in label-triage.yml has no `timeout-minutes:` declaration. Default is 6 hours — a stuck codeload fetch or runner hang can burn budget. Add `timeout-minutes: 10` (or proportional).",
    "type": "missing_timeout_minutes",
    "file": "label-triage.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium",
    "recipe_id": "recipe-add-workflow-timeout-minutes",
    "job": "triage"
  },
  {
    "reason": "Job `sync` in labels.yml has no `timeout-minutes:` declaration. Default is 6 hours — a stuck codeload fetch or runner hang can burn budget. Add `timeout-minutes: 10` (or proportional).",
    "type": "missing_timeout_minutes",
    "file": "labels.yml",
    "action": "flag",
    "rule_module": "workflow_audit",
    "severity": "medium",
    "recipe_id": "recipe-add-workflow-timeout-minutes",
    "job": "sync"
  },
  {
    "reason": "Required file missing (condition: public_repo)",
    "type": "missing_requirement",
    "file": "SECURITY.md",
    "action": "create",
    "rule_module": "cicd_rules",
    "severity": "high"
  },
  {
    "line": 56,
    "reason": "job in .github/workflows/dependabot-automerge.yml references `secrets.*` but does not install `step-security/harden-runner` — review outbound-egress monitoring",
    "type": "RE001",
    "file": ".github/workflows/dependabot-automerge.yml",
    "action": "report",
    "rule_module": "research_extensions",
    "severity": "warn"
  },
  {
    "line": 74,
    "reason": "job in .github/workflows/hypatia-scan.yml references `secrets.*` but does not install `step-security/harden-runner` — review outbound-egress monitoring",
    "type": "RE001",
    "file": ".github/workflows/hypatia-scan.yml",
    "action": "report",
    "rule_module": "research_extensions",
    "severity": "warn"
  },
  {
    "line": 52,
    "reason": "job in .github/workflows/label-triage.yml references `secrets.*` but does not install `step-security/harden-runner` — review outbound-egress monitoring",
    "type": "RE001",
    "file": ".github/workflows/label-triage.yml",
    "action": "report",
    "rule_module": "research_extensions",
    "severity": "warn"
  },
  {
    "line": 38,
    "reason": "job in .github/workflows/labels.yml references `secrets.*` but does not install `step-security/harden-runner` — review outbound-egress monitoring",
    "type": "RE001",
    "file": ".github/workflows/labels.yml",
    "action": "report",
    "rule_module": "research_extensions",
    "severity": "warn"
  },
  {
    "line": 48,
    "reason": "workflow .github/workflows/dependabot-automerge.yml:48 gates on `github.actor == 'dependabot[bot]'` — `github.actor` is the run-triggering user, which an attacker controls on `pull_request_target` from a fork",
    "type": "RE008",
    "file": ".github/workflows/dependabot-automerge.yml",
    "action": "report",
    "rule_module": "research_extensions",
    "severity": "critical"
  },
  {
    "line": null,
    "reason": "workflow .github/workflows/dependabot-automerge.yml has top-level `permissions:` with `contents: write` AND performs a write (push/commit/release/PR). It is over-broad, but narrowing the workflow level alone WOULD BREAK IT — no job declares its own `permissions:`.",
    "type": "WH002",
    "file": ".github/workflows/dependabot-automerge.yml",
    "action": "report",
    "rule_module": "workflow_hardening",
    "severity": "warn"
  },
  {
    "line": 12,
    "reason": "workflow .github/workflows/mirror.yml:12 uses `secrets: inherit` — forwards every caller secret to the reusable workflow",
    "type": "WH008",
    "file": ".github/workflows/mirror.yml",
    "action": "report",
    "rule_module": "workflow_hardening",
    "severity": "warn"
  }
]

Powered by Hypatia Neurosymbolic CI/CD Intelligence

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