|
| 1 | +# Daily Dependabot alert sweep (#4874), replacing Dependabot's security-update |
| 2 | +# PRs. Ported from the MCP Inspector's workflow of the same name |
| 3 | +# (inspector#2233). |
| 4 | +# |
| 5 | +# Security-update PRs are a repo setting (`automated-security-fixes`) and are |
| 6 | +# switched off; the ALERTS stay on, and this workflow consumes them. It runs |
| 7 | +# `scripts/dependabot-alerts.mjs`, which files one issue per vulnerable |
| 8 | +# package per lockfile (npm's root `package-lock.json`, and each Python |
| 9 | +# server's `uv.lock`), and the fix is written by hand against `v2/main`: |
| 10 | +# |
| 11 | +# alert -> this sweep -> issue (labeled, milestoned) -> issue-triage boards it -> maintainer PR -> v2/main |
| 12 | +# |
| 13 | +# A schedule, not an event handler: there is no `dependabot_alert` workflow |
| 14 | +# trigger, only a webhook. |
| 15 | +# |
| 16 | +# ⚠️ GitHub computes alerts from the DEFAULT branch (`main`), and we ship from |
| 17 | +# `v2/main`. So each alert is re-checked against `v2/main`'s own lockfile |
| 18 | +# (hence the `ref: v2/main` checkout) and skipped if it is already fixed |
| 19 | +# there. The converse is a blind spot: a vulnerable dependency introduced on |
| 20 | +# `v2/main` and not yet merged to `main` produces no alert at all. |
| 21 | +# |
| 22 | +# ⚠️ A scheduled workflow runs only from `main`, so this does nothing until a |
| 23 | +# milestone merge carries it there. |
| 24 | +# |
| 25 | +# `vulnerability-alerts: read` is the one non-default permission, and |
| 26 | +# `GITHUB_TOKEN` can hold it. Two things are out of that token's reach, and |
| 27 | +# the sweep degrades rather than fails on both: |
| 28 | +# |
| 29 | +# * Reading back `automated-security-fixes` needs `administration: read`, |
| 30 | +# which `permissions:` has no key for. Under this token the script reports |
| 31 | +# that guard as UNVERIFIED; an explicit `enabled: true` still fails it. |
| 32 | +# * Writing the card on the org project board needs `organization projects: |
| 33 | +# write`. The issue arrives labeled and milestoned and `issue-triage` |
| 34 | +# boards it in `Todo`. Boarding from here waits on a GitHub App (#5061); |
| 35 | +# the Inspector's version reads a `PROJECT_TOKEN` that was never created, |
| 36 | +# so its board code never ran (inspector#2547), which is why none is |
| 37 | +# shipped here. |
| 38 | +name: Dependabot Alert Sweep |
| 39 | + |
| 40 | +on: |
| 41 | + schedule: |
| 42 | + - cron: "17 6 * * *" # 06:17 UTC daily; alerts are not minute-sensitive |
| 43 | + workflow_dispatch: |
| 44 | + |
| 45 | +# The marker lookup is a read before a write, so two overlapping runs could |
| 46 | +# both file. The queued run waits and re-reads what the first one wrote. |
| 47 | +concurrency: |
| 48 | + group: dependabot-alert-sweep |
| 49 | + cancel-in-progress: false |
| 50 | + |
| 51 | +permissions: |
| 52 | + contents: read |
| 53 | + issues: write |
| 54 | + vulnerability-alerts: read |
| 55 | + |
| 56 | +jobs: |
| 57 | + alert-sweep: |
| 58 | + timeout-minutes: 15 |
| 59 | + if: github.repository_owner == 'modelcontextprotocol' |
| 60 | + runs-on: ubuntu-latest |
| 61 | + steps: |
| 62 | + - name: Checkout v2/main |
| 63 | + uses: actions/checkout@v6 |
| 64 | + with: |
| 65 | + ref: v2/main |
| 66 | + |
| 67 | + - name: Setup Node.js |
| 68 | + uses: actions/setup-node@v7 |
| 69 | + with: |
| 70 | + node-version: 22 |
| 71 | + cache: npm |
| 72 | + |
| 73 | + # The script reads every lockfile as text; its one dependency is |
| 74 | + # `semver`. No lifecycle scripts: nothing here builds. |
| 75 | + - name: Install dependencies |
| 76 | + run: npm ci --ignore-scripts |
| 77 | + |
| 78 | + - name: Run the Dependabot alert sweep |
| 79 | + run: node scripts/dependabot-alerts.mjs |
| 80 | + env: |
| 81 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 82 | + GITHUB_REPOSITORY: ${{ github.repository }} |
0 commit comments