-
Notifications
You must be signed in to change notification settings - Fork 1
chore: add Dependabot configuration and critical-vuln gate #136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| # Dependabot config for npm-based frontend/CMS repos (React/Vite/Next/Vue/Strapi). | ||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "npm" | ||
| directory: "/" | ||
| target-branch: "develop" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "tuesday" | ||
| time: "06:00" | ||
| timezone: "Asia/Amman" | ||
| open-pull-requests-limit: 10 | ||
| groups: | ||
| npm-minor-patch: | ||
| update-types: ["minor", "patch"] | ||
| labels: | ||
| - "dependencies" | ||
| - "npm" | ||
|
|
||
| - package-ecosystem: "docker" | ||
| directory: "/" | ||
| target-branch: "develop" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "tuesday" | ||
| time: "06:00" | ||
| timezone: "Asia/Amman" | ||
| open-pull-requests-limit: 5 | ||
| labels: | ||
| - "dependencies" | ||
| - "docker" | ||
|
|
||
| - package-ecosystem: "github-actions" | ||
| directory: "/" | ||
| target-branch: "develop" | ||
| schedule: | ||
| interval: "weekly" | ||
| day: "tuesday" | ||
| time: "06:00" | ||
| timezone: "Asia/Amman" | ||
| open-pull-requests-limit: 5 | ||
| groups: | ||
| actions-minor-patch: | ||
| update-types: ["minor", "patch"] | ||
| labels: | ||
| - "dependencies" | ||
| - "github-actions" |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,38 @@ | ||||||
| # ============================================================================= | ||||||
| # Critical Dependabot Vulnerability Check — Caller template | ||||||
| # ============================================================================= | ||||||
| # USAGE: | ||||||
| # Copy this file to your repo at .github/workflows/critical-vuln-check.yml. | ||||||
| # No REPLACE values needed — this template requires no customization. | ||||||
| # | ||||||
| # WHAT IT DOES: | ||||||
| # Runs on every PR targeting main or develop. Fails if the repository has | ||||||
| # any open CRITICAL-severity Dependabot alert. | ||||||
| # | ||||||
| # Enforcement differs by target branch via each repo's OWN branch | ||||||
| # protection settings (not by anything in this file): | ||||||
| # - On `main`: mark this check REQUIRED in branch protection — merge | ||||||
| # is physically blocked while a critical alert is open. | ||||||
| # - On `develop`: leave this check NOT required — it still shows as a | ||||||
| # failing/red check (a visible warning) without blocking | ||||||
| # the merge. | ||||||
| # ============================================================================= | ||||||
| name: Critical Vulnerability Check | ||||||
| run-name: vuln-check-${{ github.event.pull_request.number }} | ||||||
|
|
||||||
| on: | ||||||
| pull_request: | ||||||
| branches: [main, develop] | ||||||
|
|
||||||
| # critical-vuln-gate.yml's own job requests these two scopes -- a caller can | ||||||
| # only narrow permissions for a nested reusable-workflow job, never widen | ||||||
| # them, so these must be granted here or the whole file fails to parse. | ||||||
| permissions: | ||||||
| contents: write | ||||||
| security-events: read | ||||||
|
|
||||||
| jobs: | ||||||
| vuln-gate: | ||||||
| uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@main | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Pin the reusable workflow to a commit SHA, not A branch reference is mutable — if As per path instructions, treat GitHub Actions changes as supply-chain sensitive and check for unpinned third-party actions. 🔒 Proposed fix- uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@main
+ uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@<full-commit-sha>📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[error] 36-36: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSource: Path instructions |
||||||
| secrets: | ||||||
| dependabot-alerts-token: ${{ secrets.DEPENDABOT_ALERTS_TOKEN }} | ||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,61 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================================================================= | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Dependabot Auto-Merge — Caller template | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================================================================= | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # USAGE: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Copy this file to your repo at .github/workflows/dependabot-auto-merge.yml. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # No REPLACE values needed. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # WHAT IT DOES: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # Auto-merges a Dependabot PR ONLY when ALL of the following hold: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # - The PR author is dependabot[bot] | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # - The update is a semver PATCH bump (never minor/major) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # - The ecosystem is npm, nuget, pub, bundler, or github-actions | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # (NEVER docker — base image bumps always need manual review) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # - This repo currently has no open critical Dependabot alert (re-checked | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # here explicitly — see workflow-templates/critical-vuln-check.yml's | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # header for why this can't just `needs:` that file's job) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # "Auto-merge" here means GitHub's native auto-merge feature: it still | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # waits for the repo's actual required status checks (build/test) to pass | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # before merging — this workflow does not bypass those. | ||||||||||||||||||||||||||||||||||||||||||||||||||
| # ============================================================================= | ||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Dependabot Auto-Merge | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: [main, develop] | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+23
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win Add a concurrency group to cancel superseded runs. Without concurrency settings, pushing multiple commits to the same Dependabot PR triggers overlapping workflow runs. A concurrency group cancels stale runs. ♻️ Proposed refactor on:
pull_request:
branches: [main, develop]
+concurrency:
+ group: dependabot-auto-merge-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
+
permissions:📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[warning] 23-25: insufficient job-level concurrency limits (concurrency-limits): workflow is missing concurrency setting (concurrency-limits) 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| permissions: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| pull-requests: write | ||||||||||||||||||||||||||||||||||||||||||||||||||
| contents: write | ||||||||||||||||||||||||||||||||||||||||||||||||||
| security-events: read | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+27
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Scope permissions to job level to avoid granting Workflow-level permissions apply to all jobs. The As per path instructions, check for overbroad permissions and missing least-privilege permissions. 🔒 Proposed fix permissions:
- pull-requests: write
- contents: write
- security-events: read
+ contents: read
+
jobs:
vuln-gate:
if: ${{ github.actor == 'dependabot[bot]' }}
+ permissions:
+ security-events: read
uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@main
secrets:
dependabot-alerts-token: ${{ secrets.DEPENDABOT_ALERTS_TOKEN }}
auto-merge:
needs: vuln-gate
if: ${{ github.actor == 'dependabot[bot]' }}
runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ contents: write
timeout-minutes: 5📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[error] 28-28: overly broad permissions (excessive-permissions): pull-requests: write is overly broad at the workflow level (excessive-permissions) [error] 29-29: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level (excessive-permissions) [warning] 28-28: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment (undocumented-permissions) 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| vuln-gate: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if: ${{ github.actor == 'dependabot[bot]' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@main | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win Pin both action references to commit SHAs. Line 35 references the reusable workflow at As per path instructions, treat GitHub Actions changes as supply-chain sensitive and check for unpinned third-party actions. 🔒 Proposed fix- uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@main
+ uses: simplify9/.github/.github/workflows/critical-vuln-gate.yml@<full-commit-sha>- uses: dependabot/fetch-metadata@v2
+ uses: dependabot/fetch-metadata@<full-commit-sha>Also applies to: 47-47 🧰 Tools🪛 zizmor (1.26.1)[error] 35-35: unpinned action reference (unpinned-uses): action is not pinned to a hash (required by blanket policy) (unpinned-uses) 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||||||||||||||
| secrets: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| dependabot-alerts-token: ${{ secrets.DEPENDABOT_ALERTS_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| auto-merge: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: vuln-gate | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if: ${{ github.actor == 'dependabot[bot]' }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 5 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Fetch Dependabot metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||
| id: metadata | ||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: dependabot/fetch-metadata@v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Enable auto-merge for eligible patch bumps | ||||||||||||||||||||||||||||||||||||||||||||||||||
| if: | | ||||||||||||||||||||||||||||||||||||||||||||||||||
| steps.metadata.outputs.update-type == 'version-update:semver-patch' && | ||||||||||||||||||||||||||||||||||||||||||||||||||
| contains(fromJSON('["npm_and_yarn", "nuget", "pub", "bundler", "github_actions"]'), steps.metadata.outputs.package-ecosystem) | ||||||||||||||||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| PR_URL: ${{ github.event.pull_request.html_url }} | ||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||
| set -euo pipefail | ||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "::notice title=🤖 [AUTO-MERGE] Enabling auto-merge::${PR_URL} — patch-level ${{ steps.metadata.outputs.package-ecosystem }} bump, vuln gate passed" | ||||||||||||||||||||||||||||||||||||||||||||||||||
| gh pr merge --auto --squash "$PR_URL" | ||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+58
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🔵 Trivial | 💤 Low value Pass The ♻️ Proposed refactor env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_URL: ${{ github.event.pull_request.html_url }}
+ ECOSYSTEM: ${{ steps.metadata.outputs.package-ecosystem }}
run: |
set -euo pipefail
- echo "::notice title=🤖 [AUTO-MERGE] Enabling auto-merge::${PR_URL} — patch-level ${{ steps.metadata.outputs.package-ecosystem }} bump, vuln gate passed"
+ echo "::notice title=🤖 [AUTO-MERGE] Enabling auto-merge::${PR_URL} — patch-level ${ECOSYSTEM} bump, vuln gate passed"
gh pr merge --auto --squash "$PR_URL"📝 Committable suggestion
Suggested change
🧰 Tools🪛 zizmor (1.26.1)[info] 60-60: code injection via template expansion (template-injection): may expand into attacker-controllable code (template-injection) 🤖 Prompt for AI AgentsSource: Path instructions |
||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
contents: writeis overly broad for a read-only vulnerability check.This workflow only reads Dependabot alerts — it does not modify repository contents. The comment on lines 27–29 claims the caller must grant these scopes for the reusable workflow, but reusable workflows define their own
permissionsblock independently of the caller. Ifcritical-vuln-gate.ymlspecifies its own permissions, this block is unnecessary. If it doesn't,contents: writeshould still becontents: readsince a vulnerability gate has no reason to write to the repo.As per path instructions, check for overbroad permissions and missing least-privilege permissions.
🔒 Proposed fix
📝 Committable suggestion
🧰 Tools
🪛 zizmor (1.26.1)
[error] 31-31: overly broad permissions (excessive-permissions): contents: write is overly broad at the workflow level
(excessive-permissions)
[warning] 31-31: permissions without explanatory comments (undocumented-permissions): needs an explanatory comment
(undocumented-permissions)
🤖 Prompt for AI Agents
Source: Path instructions