Skip to content

Promote registry v1.8.12 to production and switch on the malware sweep - #1891

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

@rdimitrov rdimitrov commented Nov 22, 2026 •

Copy link
Copy Markdown
Member

What

Three lines in deploy/Pulumi.gcpProd.yaml:

  • imageTag 1.8.11 → 1.8.12, and registryRolloutCommit to that release's commit.
  • mcp-registry:malwareSweep: "true".

Merging this deploys to production.

What the deploy will do

  1. Roll the registry to 1.8.12. Beyond 1.8.11 the registry image carries two changes:
  2. Move the usage collector to its 1.8.12 image. It follows imageTag. Its code is unchanged since 1.8.11; it is rebuilt with the same dependency bump.
  3. Create one CronJob, registry-malware-sweep, in default. It runs the registry's own image with -malware-sweep daily at 03:40 UTC. It has no Secret, database role or service account. It reads the listing from the mcp-registry Service and sends package names and versions to api.osv.dev.

The infrastructure code in between was already applied to production by hand at cb2710c, so nothing else is pending.

What changes for publishers

  • Malware matches are logged, not refused. mcp-registry:malwareCheckMode is not set, so the check runs in report mode. A publish or edit that names a package OSV lists as malware goes through, and is logged as REGISTRY_MALWARE_PUBLISH_MATCH action=allowed.
  • npm dist-tags are refused from this deploy on. A publish whose npm package version is a tag such as next gets a 400 naming the version to use. latest was already refused, and no production entry names any other tag.
  • A publish with an npm, PyPI, NuGet or Cargo package takes about 0.3 seconds longer, 2 seconds at most, for the OSV call. If OSV does not answer, the publish goes ahead.

What the sweep does

It only reports. It never changes an entry. A match is written to its log as REGISTRY_MALWARE_SWEEP_HIT; taking the entry down stays a maintainer's decision.

Evidence from staging

Staging has run this build since 02:04 UTC on 2026-11-22.

  • Registry: no warnings or errors in its log. Its pod was replaced once, at 06:02 UTC, by the weekly staging database restore.
  • Sweep, twice: by hand at 02:06 UTC and on schedule at 03:40 UTC. Each read 255,401 server versions in about 3 minutes, using about 100 MiB. Both reported the one entry in staging's data that pointed at a known-malware release, which production had already taken down.
  • Load during the scheduled sweep: the registry pod averaged at most 0.18 CPU in any minute, and Postgres 0.14 CPU, for about two minutes. Production's two registry pods were at 40% of their CPU request against a 60% autoscaling target when last read.
  • Publish check in the cluster: a publish naming the known-malware release was logged as allowed, and a re-publish of an existing clean version passed validation. Neither stored anything.

Not checked

  • No preview of this change. The production workflow previews main only. What the deploy will do is read from the code and from staging's deploy of the same code.
  • No organic publish traffic in staging. Real publishes meet the check for the first time in production, in report mode.
  • The 1.8.12 release image has not run anywhere. Staging runs the main build of the same commit.

After the deploy

  1. Create the alerts first. They go to an email address through Cloud Monitoring and never to Discord. Until they exist, matches are only in the logs:
    python3 tools/admin/configure-malware-alerts.py \
      --project mcp-registry-prod --cluster mcp-registry-prod --email YOUR_EMAIL --dry-run
    # Review, then rerun without --dry-run.
  2. Then run the sweep once and read its log. It should end with REGISTRY_MALWARE_SWEEP_SUCCESS:
    kubectl -n default create job --from=cronjob/registry-malware-sweep registry-malware-sweep-manual
    kubectl -n default logs -l job-name=registry-malware-sweep-manual --tail=-1 --prefix
    The alerts come first because the "sweep missing" alert counts only sweeps that finish after it was created. It may fire once in the minutes between the two steps and close when the sweep finishes.
  3. Fired alerts can be read without email:
    curl -s -H "Authorization: Bearer $(gcloud auth print-access-token)" \
      "https://monitoring.googleapis.com/v3/projects/mcp-registry-prod/alerts?pageSize=50" \
      | jq -r '.alerts[]? | select(.policy.displayName | test("malware"; "i")) | "\(.openTime) \(.state) \(.policy.displayName)"'
  4. deploy/README.md still says the sweep is not on in production and has not been timed in a cluster. That needs a follow-up.

To undo

  • Sweep: remove mcp-registry:malwareSweep. The CronJob is deleted.
  • Publish check: set mcp-registry:malwareCheckMode: off.
  • Everything: set imageTag back to 1.8.11.

Set imageTag to 1.8.12 and registryRolloutCommit to that release's
commit, and set mcp-registry:malwareSweep to "true".

The release carries the publish-time malware check, which starts in
report mode, and the refusal of npm dist-tags as package versions. The
sweep is the daily CronJob that checks every listed package against OSV
malware records and reports matches without changing any entry.

Co-authored-by: Copilot App <[email protected]>
@rdimitrov
rdimitrov merged commit cc1a1ba into main Nov 22, 2026
9 checks passed
@rdimitrov
rdimitrov deleted the rdimitrov-osv-malware-checks branch November 22, 2026 08:56
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