Description
Maven Central rate limiting can return HTTP 429 while Trivy resolves pom.xml dependencies during a scan.
Trivy already honors <mirrors> from Maven settings.xml, but users should also be able to configure mirrors directly in trivy.yaml — without modifying the shared Maven build settings (for example, in CI).
The proposal is a scan.maven.mirrors map in trivy.yaml that maps a source repository URL to an ordered list of mirror URLs.
Trivy tries the mirrors in order and falls back to the next one when a mirror cannot provide the requested artifact.
scan:
maven:
mirrors:
https://repo.maven.apache.org/maven2/:
- https://my-internal-mirror/maven2/
- https://backup-mirror/maven2/
Details
- Applies to Maven dependency resolution in filesystem and repository scans; it is not applied to image or VM scanning.
trivy.yaml mirrors are applied after settings.xml/pom.xml resolution, so an existing mapping such as repo1 -> repo2 is preserved, and repo2 can then be mapped to repo3 by trivy.yaml.
- Mirror URLs are validated at startup (fail-fast).
- The GCS mirror is not enabled by default.
Acceptance criteria
References
Description
Maven Central rate limiting can return
HTTP 429while Trivy resolvespom.xmldependencies during a scan.Trivy already honors
<mirrors>from Mavensettings.xml, but users should also be able to configure mirrors directly intrivy.yaml— without modifying the shared Maven build settings (for example, in CI).The proposal is a
scan.maven.mirrorsmap intrivy.yamlthat maps a source repository URL to an ordered list of mirror URLs.Trivy tries the mirrors in order and falls back to the next one when a mirror cannot provide the requested artifact.
Details
trivy.yamlmirrors are applied aftersettings.xml/pom.xmlresolution, so an existing mapping such asrepo1 -> repo2is preserved, andrepo2can then be mapped torepo3bytrivy.yaml.Acceptance criteria
trivy.yaml.settings.xml/pom.xmlrepository configuration is not unexpectedly overridden.References