Skip to content

Start every malware alert's email subject with the cluster's name - #1894

Merged
rdimitrov merged 1 commit into
mainfrom
rdimitrov-osv-malware-checks
Nov 22, 2026
Merged

rdimitrov merged 1 commit into
mainfrom
rdimitrov-osv-malware-checks

Conversation

@rdimitrov

Copy link
Copy Markdown
Member

What

tools/admin/configure-malware-alerts.py now sets each policy's own email subject, starting with the cluster's name, for example [mcp-registry-prod] Registry malware sweep missing for 25 hours.

Why

Staging and production send their alerts to the same address, and the default subjects did not tell them apart:

  • The two log-match alerts name the cluster late in the subject, where the mail client cuts it off.
  • The freshness alert named no cluster at all. Its condition has no resource, so the subject read "No completed malware sweep in 25 hours on __missing__".

deploy/README.md is updated to match.

Already applied

The script has been re-run against both projects. The three policies in each were updated in place, with the same ids, and the stored subjects were read back.

Not checked

No alert has fired since, so the new subject has not been seen in an email. A probe on staging did not produce one: the publish-match alert there is still open from this morning, and a further match does not open a second one.

What merging will do

It deploys to staging, as every merge to main does. The script is not part of any deployment. It does not deploy to production.

Staging and production send their alerts to the same address. The
default subject names the cluster late, where mail clients cut it off,
and the freshness alert's named none: its condition has no resource, so
it read "on __missing__". Set each policy's own subject line instead.

Co-authored-by: Copilot App <[email protected]>
@rdimitrov
rdimitrov merged commit 0f024d4 into main Nov 22, 2026
9 checks passed
@rdimitrov
rdimitrov deleted the rdimitrov-osv-malware-checks branch November 22, 2026 11:27
rdimitrov added a commit that referenced this pull request Nov 22, 2026
Sets `mcp-registry:imageTag` to `1.8.13`. Nothing else in the stack file
changes.

## What production gets

v1.8.13 is `main` at 57332f3. Since v1.8.12:

- **#1895**: the daily malware sweep also asks npm, PyPI, NuGet and
crates.io whether each listed package still exists, and ends with one
JSON report line. The registry server itself is unchanged by it: the new
code runs only in the `registry-malware-sweep` CronJob.
- **#1893**: the three operational Grafana dashboards. This is `deploy/`
code already on `main`, so the production deploy applies it with this
PR.
- #1892 and #1894 touch documentation and the alert script only.

Both images exist: `ghcr.io/modelcontextprotocol/registry:1.8.13` and
`registry-usage-collector:1.8.13`.

## Measured on staging

Two hand-run sweeps of the same build on 2026-11-22, on a copy of
production's data (280,909 server versions, 23,945 distinct packages):

| | v1.8.12 sweep | this build |
|---|---|---|
| Duration | 2 min 54 s | 5 min 58 s and 5 min 51 s |
| Sweep pod, peak | about 120 MiB | 273m CPU, 124 MiB |
| Packages left unknown | n/a | 0 |

The extra three minutes are requests to the package registries; the
registry and Postgres see the same listing read as before. The report
arrived in Cloud Logging as `jsonPayload` (10 KB, inside one log line),
and the new alert fired with the report's summary attached.

## After this deploys

1. Run `tools/admin/configure-malware-alerts.py` for the production
project. Until a production sweep has written a report, it keeps the
current per-hit policy, so production is watched throughout.
2. The first sweep on this build is the next 03:40 UTC run, or one
started by hand.

## What to expect

The first report will list about 650 server versions (206 servers) that
point at a package that is gone, and send the warning email every day
until they are dealt with. That backlog is existing data, not something
this change causes.

## Rollback

Set `imageTag` back to `1.8.12`. The freshness and publish alerts work
with either build. If the alert script has by then removed the per-hit
policy, a v1.8.12 sweep that finds malware would send no email, because
it writes no report: check its log by hand, or roll forward again.

Co-authored-by: Copilot App <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant