feat(ci): 17 of 24 repos could not report a CVE, and nothing measured that (#39)

* feat(ci): 17 of 24 repos could not report a CVE, and nothing measured that

surf-your-life.orangecat.ch served Next 16.2.3 — two CRITICAL unauthenticated
RCEs — plus a critical @auth/core flaw and six more high findings. Thirteen in
total, on a live site, for months.

Nothing was ignored. Dependabot alerts were simply OFF for that repo, so GitHub
never raised one and there was no number for anyone to act on. The correlation
across the fleet that day was exact:

  botsmann        alerts ON  -> Dependabot PR #193 took it to 16.3.3 on its own
  orangecat       alerts ON  -> its security job went red, which is how this surfaced
  surf-your-life  alerts OFF -> silence, 1 critical + 6 high

17 of 24 repos were off. The instrument was missing, not the diligence.

WHY THE EXISTING SWEEP COULD NOT SEE IT. version-currency.mjs compares MAJORS
parsed out of package.json ranges: parseMajor("^16.2.12") is 16, blessed is 16,
no gap. Every minor and patch is invisible, and it reads the declared RANGE
while the lockfile decides what ships — a caret that ALLOWS 16.3.4 sits on
16.2.12 forever, because an already-satisfied dependency is never upgraded on
install. Both vulnerable pins returned zero gaps from it. That limit is now
written into its own header rather than left to be rediscovered; the two audits
are complements, not overlaps.

A HARD FLOOR, NOT A RATCHET. Its siblings baseline a count because their
findings have legitimate exceptions. This one has none: a repo with alerts off
cannot report a CVE, so the correct number is zero permanently. A baseline here
would only make "some repos are deaf" an accepted state.

THE POPULATION COMES FROM `gh repo list`. Writing this, I first hand-typed the
repo list from `ls ~/dev` — which invented a repo that does not exist
(~/dev/revamp-info is a checkout whose remote points at bitbaum/hirnli) and
MISSED 17 that do, including every shared package (ai-kit, ai-forms, bip-kit,
limitkit, threadkit, design-tokens) that is published to npm and consumed
fleet-wide. Archived repos and forks are excluded, matching version-currency so
both audits measure the same population.

Ten tests, each a mutation: a repo with alerts off must exit 1, an UNREADABLE
repo must exit 1 rather than pass, and an empty repo list must exit 2 rather
than read as a clean fleet.

All 41 repos now have alerts and automated security-fix PRs enabled; the audit
reports 41/41.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSLwXsPH8mLYtaM8h3oVto

* chore(ci): the org-drift ratchet fell and its baseline still claimed the violation

`org-drift-audit.sh --check` was failing every PR in this repo — not for
anything in the PR, but because fleetcrown/README.md was fixed and its baseline
line outlived it. The audit is built so that a baseline entry with no matching
violation is itself an error, precisely so the list cannot rot into a claim
about a problem that no longer exists. It did its job; nobody deleted the line.

Unrelated to the Dependabot work on this branch, and separated into its own
commit for that reason. Left alone it blocks everyone.

  46 repos swept, 3 known violations, no new contradictions (was: exit 1).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NSLwXsPH8mLYtaM8h3oVto

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
CatoandClaude Opus 5 authored and GitHub committed 2026-09-10 15:57:27 -07:00
1 parent b6c06c17c5
commit ff79e556b5
5 files changed
+332 -1

No files matched your search

+76
View File
@@ -0,0 +1,76 @@
# Is every repo still able to REPORT a vulnerability?
#
# 2026-09-10: surf-your-life.orangecat.ch served Next 16.2.3 — two critical
# unauthenticated RCEs — plus a critical @auth/core flaw and six more high
# findings, for months. Nothing was ignored; Dependabot alerts were simply off
# for that repo, so no alert was ever raised. 17 of 24 repos were in that state.
#
# The repos with alerts ON were the ones that got fixed: botsmann took a
# Dependabot PR to 16.3.3 on its own, and orangecat's red security job is how
# the whole thing surfaced.
#
# Weekly, not daily: this measures a SETTING, which changes when someone creates
# a repo, not continuously. The alerts themselves arrive in real time once the
# switch is on — this only guards the switch.
name: Dependabot alerts
on:
schedule:
# Mondays, an hour after version-currency. The two are complements: that one
# asks whether we are on the blessed MAJOR, this one asks whether anyone
# would be told if we were not.
- cron: '17 7 * * 1'
workflow_dispatch:
inputs:
fix:
description: 'Enable alerts on any repo found without them'
type: boolean
default: false
permissions:
contents: read
jobs:
alerts:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v7
# The detector before the measurement — a gate that cannot go red is not
# a gate, and this one's whole value is the red case.
- name: Self-test the detector first
run: bash scripts/ci/test-dependabot-alerts-audit.sh
- name: Audit the fleet
env:
# Reading and writing this flag needs repo admin; the default token
# does not have it across the org. Without FLEET_ADMIN_TOKEN every
# repo lands in UNREADABLE — which fails loudly rather than passing
# silently, by design.
GH_TOKEN: ${{ secrets.FLEET_ADMIN_TOKEN || secrets.FLEET_READ_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -uo pipefail
{
echo '## Dependabot alerts'
echo
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
set +e
bash scripts/ci/dependabot-alerts-audit.sh 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"
set -e
echo '```' >> "$GITHUB_STEP_SUMMARY"
- name: Enable alerts where they are missing
if: ${{ inputs.fix == true }}
env:
GH_TOKEN: ${{ secrets.FLEET_ADMIN_TOKEN || secrets.GITHUB_TOKEN }}
run: bash scripts/ci/dependabot-alerts-audit.sh --fix
# A hard floor, not a ratchet. A repo that cannot report a CVE has no
# legitimate version of itself to baseline.
- name: Every repo must be able to report a vulnerability
env:
GH_TOKEN: ${{ secrets.FLEET_ADMIN_TOKEN || secrets.FLEET_READ_TOKEN || secrets.GITHUB_TOKEN }}
run: bash scripts/ci/dependabot-alerts-audit.sh --check
+135
View File
@@ -0,0 +1,135 @@
#!/usr/bin/env bash
#
# Fleet audit: is every repo actually being TOLD about its vulnerabilities?
#
# dependabot-alerts-audit.sh [--check] [--fix]
#
# WHY
#
# 2026-09-10: surf-your-life.orangecat.ch was serving Next 16.2.3 — two
# CRITICAL unauthenticated RCE advisories — plus a critical @auth/core flaw and
# six more high findings. Thirteen in total, on a live site, for months.
#
# Nothing was broken. Nothing was ignored. Dependabot alerts were simply OFF for
# that repo, so GitHub never raised one and no human ever saw a number to act
# on. The correlation across the fleet that day was exact:
#
# botsmann alerts ON -> Dependabot opened #193, next 16.2.12 -> 16.3.3, fixed
# orangecat alerts ON -> its own security job went red, and the RCEs got found
# surf-your-life OFF -> silence, and 1 critical + 6 high sat there
#
# 17 of 24 repos were off. The instrument was missing, not the diligence.
#
# WHY NOT THE CURRENCY SWEEP
#
# version-currency.mjs cannot see this and never could. It compares MAJORS
# parsed out of package.json ranges — `parseMajor("^16.2.12")` is 16, blessed is
# 16, no gap. Every minor and patch is invisible to it, and it reads declared
# RANGES while the lockfile decides what ships. Both vulnerable pins in that
# incident returned zero gaps from it. The two audits are complements: currency
# asks "are we on the blessed major", this asks "would anyone be told if we
# weren't".
#
# WHY GITHUB'S FLAG RATHER THAN RUNNING pnpm audit HERE
#
# `pnpm audit` needs a lockfile, an install, and a registry round-trip per repo
# — minutes of CI to re-derive what GitHub already computes continuously from
# the same lockfiles. The durable property is not "zero vulnerabilities today";
# it is "the alarm is wired". Wire the alarm once and every future advisory
# arrives on its own, including for repos nobody is looking at.
#
# WHY THERE IS NO BASELINE, UNLIKE ITS SIBLINGS
#
# shared-inventory and cicd-hygiene ratchet a count downward because their
# findings are judgement calls with legitimate exceptions. This one has no
# legitimate exception: a repo with alerts off is a repo that cannot report a
# CVE. The correct number is zero, permanently, so the gate is a hard floor. A
# baseline here would only make "some repos are deaf" an accepted state.
#
# ARCHIVED AND FORKS ARE EXCLUDED — same exemptions as version-currency.mjs, so
# both audits measure the same population. Nothing deploys from an archive, and
# a fork's dependency policy belongs to upstream.
#
# THE REPO LIST COMES FROM `gh repo list`, NOT `ls ~/dev`. A local working area
# accumulates stale directories: on the day this was written ~/dev/revamp-info
# was a checkout whose remote pointed at bitbaum/hirnli, and a hand-typed sweep
# built from that listing both invented a repo that does not exist AND missed
# 17 that do — including every shared package (ai-kit, ai-forms, bip-kit,
# limitkit, threadkit, design-tokens), which are published to npm and consumed
# by every app, so a vulnerability in one propagates fleet-wide.
#
set -uo pipefail
OWNER="${GH_OWNER:-bitbaum}"
LIMIT="${GH_LIMIT:-200}"
MODE="report"
for arg in "$@"; do
case "$arg" in
--check) MODE="check" ;;
--fix) MODE="fix" ;;
*) echo "usage: $(basename "$0") [--check] [--fix]" >&2; exit 2 ;;
esac
done
command -v gh >/dev/null 2>&1 || { echo "✗ gh CLI not found"; exit 2; }
# An UNREADABLE repo must not read as a passing one. A 403/500 here means the
# audit could not look — which is a third answer, not a green.
repos=$(gh repo list "$OWNER" --limit "$LIMIT" --json name,isArchived,isFork \
--jq '.[] | select(.isArchived == false and .isFork == false) | .name' 2>/dev/null | sort)
if [ -z "$repos" ]; then
echo "✗ could not list repos for $OWNER — refusing to report a pass over an empty set"
exit 2
fi
off=(); unknown=(); on_count=0
for r in $repos; do
code=$(gh api -i "repos/$OWNER/$r/vulnerability-alerts" 2>/dev/null | head -1 | grep -oE '[0-9]{3}' | head -1)
case "$code" in
204) on_count=$((on_count + 1)) ;;
404) off+=("$r") ;;
*) unknown+=("$r(${code:-no-response})") ;;
esac
done
total=$(echo "$repos" | wc -l | tr -d ' ')
echo "dependabot alerts: $on_count/$total enabled (owner: $OWNER)"
if [ "${#off[@]}" -gt 0 ]; then
echo
echo "OFF — these repos cannot report a CVE to anyone:"
for r in "${off[@]}"; do echo " $r"; done
fi
if [ "${#unknown[@]}" -gt 0 ]; then
echo
echo "UNREADABLE — the audit could not look; this is not a pass:"
for r in "${unknown[@]}"; do echo " $r"; done
fi
if [ "$MODE" = "fix" ]; then
[ "${#off[@]}" -eq 0 ] && { echo; echo "nothing to fix"; exit 0; }
echo
echo "enabling alerts + automated security-fix PRs:"
for r in "${off[@]}"; do
a=$(gh api -X PUT "repos/$OWNER/$r/vulnerability-alerts" >/dev/null 2>&1 && echo ok || echo FAIL)
b=$(gh api -X PUT "repos/$OWNER/$r/automated-security-fixes" >/dev/null 2>&1 && echo ok || echo FAIL)
echo " $r alerts=$a auto-fix-prs=$b"
done
echo
echo "re-run with --check to confirm"
exit 0
fi
if [ "$MODE" = "check" ]; then
if [ "${#off[@]}" -gt 0 ] || [ "${#unknown[@]}" -gt 0 ]; then
echo
echo "✗ every repo must be able to report a vulnerability. Fix with:"
echo " scripts/ci/dependabot-alerts-audit.sh --fix"
exit 1
fi
echo "✓ every repo can report a vulnerability"
fi
exit 0
-1
View File
@@ -8,4 +8,3 @@
bitbaum/CLAUDE.md # historical claim from before register existed
bitbaum/README.md # historical claim from before register existed
crewless/README.md # door disagreement from before apps.conf check existed
fleetcrown/README.md # door disagreement from before apps.conf check existed
+106
View File
@@ -0,0 +1,106 @@
#!/usr/bin/env bash
#
# Tests for dependabot-alerts-audit.sh.
#
# A gate is only worth having if it goes RED for the thing it claims to catch,
# so every case below is a mutation: the audit is handed a fleet that has the
# defect and must fail. Running it once against the real fleet and seeing green
# proves nothing — the real fleet was green the moment it was written.
#
# `gh` is stubbed on PATH rather than called, for three reasons: the test runs
# offline and deterministically, it can express states the real fleet is not
# currently in (a repo with alerts off, an unreadable repo), and it cannot
# accidentally toggle a security setting on a live repository.
#
set -uo pipefail
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
AUDIT="$HERE/dependabot-alerts-audit.sh"
pass=0; fail=0
ok() { # ok <label> <condition-exit-code>
if [ "$2" -eq 0 ]; then pass=$((pass + 1)); else fail=$((fail + 1)); echo " ✗ $1"; fi
}
# Builds a throwaway PATH whose `gh` answers from two fixtures:
# $1 — newline-separated repo names for `gh repo list`
# $2 — newline-separated "<repo> <httpcode>" for `gh api -i .../vulnerability-alerts`
make_stub() {
local dir; dir=$(mktemp -d)
printf '%s\n' "$1" > "$dir/repos"
printf '%s\n' "$2" > "$dir/codes"
cat > "$dir/gh" <<'STUB'
#!/usr/bin/env bash
d="$(dirname "$0")"
if [ "${1:-}" = "repo" ] && [ "${2:-}" = "list" ]; then
grep -v '^$' "$d/repos"; exit 0
fi
if [ "${1:-}" = "api" ]; then
for a in "$@"; do case "$a" in */vulnerability-alerts) target="$a" ;; esac; done
repo="${target%/vulnerability-alerts}"; repo="${repo##*/}"
# -X PUT is the --fix path; report success so the fix branch is exercised.
for a in "$@"; do [ "$a" = "PUT" ] && exit 0; done
code=$(awk -v r="$repo" '$1==r {print $2}' "$d/codes")
echo "HTTP/2.0 ${code:-000}"
exit 0
fi
exit 0
STUB
chmod +x "$dir/gh"
echo "$dir"
}
run() { # run <stubdir> <args...>
local d="$1"; shift
PATH="$d:$PATH" bash "$AUDIT" "$@" 2>&1
}
# ── 1. All enabled → --check passes ─────────────────────────────────────────
d=$(make_stub "alpha
beta" "alpha 204
beta 204")
out=$(run "$d" --check); rc=$?
ok "all-enabled fleet exits 0" "$rc"
grep -q "2/2 enabled" <<<"$out"; ok "reports 2/2 enabled" $?
# ── 2. One repo OFF → --check FAILS and names it ────────────────────────────
# The incident this audit exists for: surf-your-life had alerts off, so 1
# critical and 6 high sat on a live site with nobody told.
d=$(make_stub "alpha
beta" "alpha 204
beta 404")
out=$(run "$d" --check); rc=$?
[ "$rc" -eq 1 ]; ok "a repo with alerts OFF exits 1" $?
grep -q "beta" <<<"$out"; ok "names the offending repo" $?
# ── 3. UNREADABLE is not a pass ─────────────────────────────────────────────
# "Could not look" is a third answer, not green — the failure mode that lets an
# audit report success over repos it never reached.
d=$(make_stub "alpha
beta" "alpha 204
beta 403")
out=$(run "$d" --check); rc=$?
[ "$rc" -eq 1 ]; ok "an unreadable repo exits 1 rather than passing" $?
grep -q "UNREADABLE" <<<"$out"; ok "labels it unreadable, not off" $?
# ── 4. An empty repo list must not read as a clean fleet ────────────────────
d=$(make_stub "" "")
out=$(run "$d" --check); rc=$?
[ "$rc" -eq 2 ]; ok "empty repo list exits 2, refusing a pass over nothing" $?
# ── 5. Archived and forks are excluded from the population ──────────────────
# Asserted through the jq filter the stub receives: the audit must pass
# isArchived/isFork selection to `gh repo list`, not filter afterwards.
grep -q 'isArchived == false and .isFork == false' "$AUDIT"
ok "excludes archived repos and forks, like version-currency.mjs" $?
# ── 6. --fix reports per-repo results and does not claim a check ────────────
d=$(make_stub "alpha
beta" "alpha 204
beta 404")
out=$(run "$d" --fix); rc=$?
ok "--fix exits 0" "$rc"
grep -q "alerts=ok" <<<"$out"; ok "--fix reports what it enabled" $?
echo "$pass passed, $fail failed"
[ "$fail" -eq 0 ]
+15
View File
@@ -33,6 +33,21 @@
* look" and "nothing is stale" are different answers, and collapsing them is
* how a broken detector reports a healthy fleet.
*
* AND IT IS BLIND BELOW THE MAJOR — deliberately, but the blindness has a cost
* worth naming here rather than rediscovering. `parseMajor("^16.2.12")` is 16;
* blessed is 16; no gap. Every minor and patch is invisible. It also reads the
* declared RANGE, while the lockfile decides what actually ships — a caret that
* ALLOWS 16.3.4 sits happily on 16.2.12 forever, because an already-satisfied
* dependency is never upgraded on install.
*
* On 2026-09-10 that combination hid two CRITICAL unauthenticated RCEs in Next
* on a live site for months: this audit returned zero gaps for both
* `"^16.2.12"` and `"16.2.3"`. Do not extend it into a security check — the
* security question is answered by dependabot-alerts-audit.sh, which asks
* whether each repo can REPORT a CVE at all, and by GitHub's own continuous
* scanning of the lockfiles once that switch is on. This one answers a
* different question: are we on the major the fleet agreed to.
*
* Reads each repo's REMOTE default branch via the contents API, never a local
* checkout: clones drift, and this fleet has already shipped a redundant PR
* off a stale clone.