Files
Dragan Spiridonov 6dcb919aee feat(deps): dependency-security system + fix grpc-js HIGH (ADR-115)
Closes the gap that let @grpc/grpc-js@1.14.3 (CVE-2026-48068/48069, HIGH)
sit undetected: every existing dependency check only fires on dep-file
changes, so a CVE disclosed against a frozen pin was invisible.

Adds:
- scripts/dependency-audit.mjs    in-repo + consumer-POV audit, severity gate
- scripts/dependency-update.mjs   security-first in-range updater with a guard
                                  that refuses to drop optional @ruvector
                                  platform deps (the Dependabot lockfile bug)
- dependency-audit.yml            daily consumer-POV scan -> tracking issue
- dependency-update.yml           weekly in-range security PR (gh CLI)
- docs/guides/dependency-security-policy.md + ADR-115
- tests/unit/scripts/dependency-security.test.ts (11 hermetic tests)
- npm scripts: deps:audit[:consumer], deps:update[:all]

Also bumps @grpc/grpc-js 1.14.3 -> 1.14.4 in-range (HIGH 1 -> 0); optional
platform deps preserved (90 -> 90).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 12:18:21 +00:00

91 lines
3.3 KiB
YAML

# =============================================================================
# Dependency Update — SCHEDULED security PR (ADR-115)
# =============================================================================
#
# Why not Dependabot/Renovate: this repo declares 15 optionalDependencies (the
# @ruvector/* native binaries per-platform, hnswlib-node, rvlite). Dependabot
# regenerates the lockfile on the runner's single platform and PRUNES the
# optional entries for every OTHER platform, producing a lock that fails
# `npm ci` with EUSAGE elsewhere. So we run our own updater, which GUARDS that
# no optional platform dep is dropped before proposing anything.
#
# Default mode is security-targeted (`npm audit fix --package-lock-only`):
# only vulnerable packages move, in-range, no major bumps — small reviewable
# PRs. A human can run `scripts/dependency-update.mjs --all` for a broader
# lockfile-maintenance sweep when desired.
#
# Uses the gh CLI (no third-party PR action) — supply-chain hygiene applies to
# our own pipeline too.
# =============================================================================
name: Dependency Update
on:
schedule:
# Weekly, Monday 06:00 UTC — before the Monday/Wednesday release cadence.
- cron: '0 6 * * 1'
workflow_dispatch:
permissions:
contents: write
pull-requests: write
concurrency:
group: dependency-update-scheduled
cancel-in-progress: true
env:
NODE_VERSION: '24.13.0'
BRANCH: deps/auto-security-update
jobs:
update:
name: In-range security update
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: main
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run in-range security updater (optional-dep guard enforced)
run: node scripts/dependency-update.mjs
- name: Open PR if the lockfile changed
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
if git diff --quiet -- package-lock.json; then
echo "No in-range security updates — nothing to propose."
exit 0
fi
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout -B "${BRANCH}"
git add package-lock.json
git commit -m "chore(deps): in-range security updates (automated, ADR-115)"
git push --force-with-lease -u origin "${BRANCH}"
# Reuse an open PR from this branch if present, else create one.
if [ -z "$(gh pr list --head "${BRANCH}" --state open --json number --jq '.[0].number // empty')" ]; then
gh pr create --base main --head "${BRANCH}" \
--title "chore(deps): automated in-range security updates" \
--body-file reports/dependency-update.md \
--label dependencies,security || \
gh pr create --base main --head "${BRANCH}" \
--title "chore(deps): automated in-range security updates" \
--body-file reports/dependency-update.md
else
echo "Existing PR updated by force-push."
fi