Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 64 additions & 0 deletions .github/workflows/advisory-watch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# SPDX-FileCopyrightText: 2026 Sudo Apt Holdings LLC
# SPDX-License-Identifier: Apache-2.0
#
# THE ADVISORY WATCH: the lock on main, held every week to every advisory published against it,
# by two readers. A lock goes bad by the calendar alone: nothing in this tree moves when a
# dependency publishes an advisory, and the gate's audit runs only on a push or a pull request.
# From late October to 2026-11-29 main's lock carried fourteen published advisories (bandit
# 1.13.1, plug 1.20.3, plug_crypto 2.2.0) and nobody was told: only Dependabot's pull requests
# went red, and a red pull request alerts nobody.
#
# Two readers, because neither sees everything:
# - tools/audit.sh: `mix hex.audit`, retired packages and OSV's advisories (the EEF CNA's
# among them, which a package's repository may never publish);
# - tools/advisory_watch.exs: each locked package's own GitHub repository's published
# advisories, held to the locked version, each finding saying whether OSV has it yet.
# Bandit's GHSA-j9wq-h5xx-5qx5 and GHSA-fmr8-qrvr-4ww5 were in its repository and not in
# OSV for 1.13.1 on 2026-11-29: the audit alone passed a lock both cover.
#
# NOT A REQUIRED CHECK, BY DESIGN, as the flake hunt: it runs on a schedule and by hand, never
# on a push or a pull request (the gate's own audit covers those). A finding is a failed
# scheduled run, which GitHub reports to the maintainer; its log names each advisory, its
# range and the version that fixes it.

name: advisory-watch

on:
schedule:
- cron: "47 5 * * 1"
workflow_dispatch:

permissions:
contents: read

jobs:
watch:
name: Advisory watch - the lock against OSV and each dependency's repository
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: erlef/setup-beam@54075bcc5e249e4758d363f27d099f55d843f124 # v1.24.1
with:
otp-version: "28"
elixir-version: "1.18"
- run: mix deps.get
- name: the range reader against fixed cases (offline)
run: elixir tools/advisory_watch.exs --self-test
- name: the audit (OSV, retired packages)
id: audit
continue-on-error: true
run: bash tools/audit.sh
- name: each dependency's repository advisories
id: repos
continue-on-error: true
env:
GITHUB_TOKEN: ${{ github.token }}
run: elixir tools/advisory_watch.exs
- name: the verdict, both readers measured and clean
env:
AUDIT: ${{ steps.audit.outcome }}
REPOS: ${{ steps.repos.outcome }}
run: |
echo "audit: ${AUDIT}; repositories: ${REPOS}"
[ "${AUDIT}" = "success" ] && [ "${REPOS}" = "success" ]
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,18 @@ All notable changes to this project are documented here. The format follows

## [Unreleased]

### Added: a weekly advisory watch on main (instruments; no public entry)

- `.github/workflows/advisory-watch.yml` reads the lock on `main` every Monday, and by hand,
with two readers: `mix hex.audit` (OSV and retired packages, `tools/audit.sh`), and
`tools/advisory_watch.exs`, which reads each locked package's GitHub repository's published
advisories and holds the locked version to each one's range. The second exists because OSV
imports a repository's advisory some time after the repository publishes it: on 2026-11-29 two
of Bandit's advisories against 1.13.1 were in its repository and not in OSV, so the audit
alone passed a lock they cover. Each finding says whether OSV has it yet. A finding is a failed
scheduled run, which GitHub reports to the maintainer; it never runs on a push or a pull
request, where the gate's own audit runs.

## [0.11.0] - 2026-11-29

Freeze-readiness, and a security floor. Two documented breaks, each with how to tell whether
Expand Down
14 changes: 14 additions & 0 deletions test/beam_mcp/governance_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ defmodule BeamMCP.GovernanceTest do
refute triggers =~ ~r/^\s+(push|pull_request)/m
end

# The lock goes bad by the calendar, not by a commit: the advisory watch is the one run that
# reads it on main when nothing is pushed, and it must read both sources (G-164's lift).
test "the advisory watch runs weekly, never on a push or a pull request, and reads both the audit and each repository" do
wf = File.read!(".github/workflows/advisory-watch.yml")
[triggers, _] = String.split(wf, ~r/^permissions:/m, parts: 2)

assert triggers =~ ~r/^\s+schedule:/m
refute triggers =~ ~r/^\s+(push|pull_request)/m
assert wf =~ "run: bash tools/audit.sh"
assert wf =~ "run: elixir tools/advisory_watch.exs --self-test"
assert wf =~ ~r/run: elixir tools\/advisory_watch\.exs\s*$/m
assert wf =~ ~r/\[ "\$\{AUDIT\}" = "success" \] && \[ "\$\{REPOS\}" = "success" \]/
end

test "every workflow declares top-level permissions, and write permissions live on the job that needs them" do
for wf <- @workflows do
text = File.read!(wf)
Expand Down
Loading