Skip to content

fix(security): route osv-scanner Maven resolution through Google Central mirror to end 429 flakes#346

Open
seonghobae wants to merge 2 commits into
mainfrom
fix/osv-maven-central-429-mirror
Open

fix(security): route osv-scanner Maven resolution through Google Central mirror to end 429 flakes#346
seonghobae wants to merge 2 commits into
mainfrom
fix/osv-maven-central-429-mirror

Conversation

@seonghobae

Copy link
Copy Markdown
Contributor

Root cause

The required `osv-scan / osv-scan` gate intermittently failed approved Maven PRs (clearfolio #76 / #82 / #83) with "No issues found" while osv-scanner resolved transitive parent POMs (`spring-boot-starter-parent:3.5.0`). It is a reliability failure, not a real vulnerability: `repo.maven.apache.org` returns HTTP 429 during transitive parent-POM resolution, which fails the reusable scan step and blocks the PR.

Why the obvious fixes don't work

osv-scanner resolves parent POMs over its own HTTP client (osv-scalibr `pomxmlnet` → `MavenRegistryAPIClient.defaultRegistry.URL`), not via the `mvn` CLI or `~/.m2`:

  • It never reads `~/.m2/repository` → caching `~/.m2` / `mvn dependency:go-offline` is inert.
  • It parses `settings.xml` only for `` auth, not `` → a settings.xml mirror is inert.
  • The only effective lever is the `--maven-registry` flag, which sets that default registry URL.

Fix

Pass `--maven-registry=https://maven-central.storage-download.googleapis.com/maven2\` (Google's byte-identical Maven Central mirror) via `scan-args`, keeping `-r ./` so recursion and transitive scanning stay fully enabled. No `--no-resolve`, no coverage reduction — only the default Central host is swapped for a rate-limit-friendlier mirror. Repos' own `pom.xml` `` are still added on top (scalibr `AddRegistry`).

Applied to both osv-scan callers: `security-scan.yml` (HARD gate, `fail-on-vuln: true`) and `osv-scanner-pr.yml` (analysis upload, `fail-on-vuln: false`).

Verification (osv-scanner 2.4.0, real `spring-boot-starter-parent:3.5.0` pom)

Run 429s Transitive packages resolved
default Central reproduced 429 on `spring-ws-bom`, `testcontainers-bom` parent POMs 8
Google mirror zero 8 (identical set, byte-identical POMs)

Confirms both the root cause and zero coverage loss. Mirror serves the same `maven2` layout and identical POM/metadata bytes (verified `200`, same content-length). YAML validated with `yaml.safe_load`.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RjGVapDZ3k7V7zKYk16P4C

Seongho Bae and others added 2 commits July 7, 2026 21:56
Runner-queue starvation across the org: every doc-only, image-only, or
empty re-trigger PR/push spawned a fresh ~120-min Strix scan, blocking
all PR merges behind runner contention.

Two security-preserving throughput fixes:

1. paths-ignore on push and pull_request_target for changes whose ENTIRE
   diff is non-executable documentation/image assets (*.md, *.rst,
   *.markdown, raster images, LICENSE, .github/ISSUE_TEMPLATE). A code
   security scanner has nothing to analyze in such a diff. Conservative:
   no source, no *.txt, no *.svg (can embed script), no CODEOWNERS, no
   build/workflow files. GitHub requires EVERY changed file to match, so
   any code/config/build/workflow change still scans. The weekly full-tree
   schedule (no path filter) backstops protected branches, and the merge
   scheduler still forces same-head evidence via workflow_dispatch (which
   paths-ignore does not affect) before merging managed PRs.

2. Cap the strix job at 60m (was 120m). The scan step is already
   hard-bounded to 30 min (timeout-minutes: 30 + STRIX_TOTAL_TIMEOUT=1800)
   and all other steps are quick/self-bounded; 120 only ever bit hung runs.
   60m clears the realistic worst case with margin and is fail-closed.

The head.sha concurrency / cancel-in-progress security design (which
deliberately does NOT cancel in-progress scans on new commits) is
unchanged.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjGVapDZ3k7V7zKYk16P4C
…ral mirror to end 429 flakes

The required `osv-scan / osv-scan` gate intermittently failed APPROVED Maven
PRs (clearfolio #76/#82/#83) with "No issues found" while osv-scanner
resolved transitive parent POMs (spring-boot-starter-parent:3.5.0). It was a
reliability failure, not a real vulnerability: repo.maven.apache.org returns
HTTP 429 during transitive parent-POM resolution.

osv-scanner resolves parent POMs over its own HTTP client (osv-scalibr
pomxmlnet -> MavenRegistryAPIClient.defaultRegistry.URL), NOT via the `mvn`
CLI or ~/.m2. It never reads ~/.m2/repository and parses settings.xml only for
<servers> auth, not <mirrors> -- so caching ~/.m2 or a settings.xml mirror
would be inert. The only effective lever is the `--maven-registry` flag, which
sets that default registry URL.

Fix: pass `--maven-registry=https://maven-central.storage-download.googleapis.com/maven2`
(Google's byte-identical Maven Central mirror) via `scan-args`, keeping `-r ./`
so recursion and transitive scanning stay fully enabled. No `--no-resolve`, no
coverage reduction. Applied to both osv-scan callers (security-scan.yml HARD
gate and osv-scanner-pr.yml analysis upload).

Verified locally with osv-scanner 2.4.0 against a spring-boot-starter-parent:3.5.0
pom.xml: the default-central run reproduced the exact 429 on parent-POM
resolution, the mirror run had zero 429s, and both resolved an identical set of
8 transitive packages (byte-identical POMs) -- confirming root cause and zero
coverage loss.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RjGVapDZ3k7V7zKYk16P4C
@seonghobae seonghobae enabled auto-merge (squash) July 7, 2026 13:06
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