BaGet

Vulnerability scanning

Artifacts are checked against vulnerability databases; findings are shown on every package page and in an administrator dashboard, feed NuGet’s vulnerability resource, and a per-repository policy can warn about them or refuse downloads and deploys with 403 and the reason. Off by default (Scanning:Enabled): scanning calls OSV.dev.

What is scanned, and by what

Format Scanned Source
NuGet the package and each dependency at the lowest version of its range (the version NuGet restores); a dependency without a lower bound is skipped OSV, ecosystem NuGet
npm the version and its dependencies that name one exact version (1.2.3); ranges (^1.2.0) are resolved by the client and cannot be judged here OSV, npm
Maven the artifact and the POM’s compile and runtime dependencies with a literal version (1.2.3, or the lower bound of [1.2,2.0)); property, managed, test, provided and optional dependencies are skipped OSV, Maven (group:artifact)
Docker each image manifest (not indexes, signatures or other artifacts that refer to an image; each platform’s manifest is) Trivy, optional

A remote repository scans what it has cached (the first download of a version is served before it can be scanned); a virtual repository holds nothing and has no results of its own (its members do). Azure Table storage (no relational database) cannot scan.

Data sources and licensing (B5)

Source Use Licence and attribution
OSV.dev API (POST /v1/querybatch, GET /v1/vulns/{id}) default, online the API is free; each record keeps the licence of its source (GitHub Advisory Database: CC-BY 4.0; others per OSV’s data licences). Every advisory in the UI shows its id and links to its source; the pages name OSV.dev
An offline copy of the OSV data (Scanning:OsvOfflinePath) no internet a directory (searched recursively for *.json) or a .zip of OSV records, e.g. https://osv-vulnerabilities.storage.googleapis.com/NuGet/all.zip (also npm, Maven); same licences. Reloaded when the path changes (checked every 30 s). When set, the online API is never contacted
Trivy container images Apache-2.0; run as an external executable, its databases are Trivy’s

OSV answers per package and version, so a record is matched by the server, not by BaGet. In an offline copy BaGet matches affected ranges itself (SEMVER/ECOSYSTEM events, explicit versions; GIT ranges are ignored). Severity: the record’s database_specific.severity (GitHub), else the CVSS v3 base score computed from its vector, else ecosystem_specific.severity, else Moderate (CVSS v4 vectors carry no number and are not computed).

Configuration

Key Default Meaning
Scanning:Enabled false master switch: nothing is scanned, no policy is enforced, package pages show no section. Live
Scanning:ScanOnDeploy true queue a scan when a version is stored (publish, push, deploy, cache fill). Off: the schedule and Scan now only
Scanning:RescanInterval 1.00:00:00 a background sweep (every 10 minutes) scans versions whose last scan is older; zero or negative: never
Scanning:OsvUrl https://api.osv.dev the OSV API root
Scanning:OsvOfflinePath empty directory or zip of OSV records (offline mode)
Scanning:OsvTimeout 00:00:30 one OSV request
Scanning:OsvCacheLifetime 01:00:00 answers per component are reused this long (in memory, per node)
Scanning:TrivyPath empty the trivy executable; without it (or the registry host) images are not scanned and the UI says so
Scanning:TrivyRegistryHost empty this server’s registry address as Docker clients use it (registry.example.com, host:port); images are named {host}/{repository}/{image}@{digest}
Scanning:TrivyServerUrl empty passed as --server: Trivy’s database and analysis live on a trivy server; the executable is still run
Scanning:TrivyInsecure false --insecure and TRIVY_NON_SSL, for a registry without TLS
Scanning:TrivyRegistryUser, Scanning:TrivyRegistryPassword empty credentials Trivy pulls with (an API key as the password when accounts are on); passed in TRIVY_USERNAME/TRIVY_PASSWORD, never on the command line; the password is a sensitive setting. Multi-node deployments must set the user: without one, the scanner’s pull is recognised from an in-memory, per-process list of running scans, so a pull answered by another node is not exempt
Scanning:TrivyTimeout 00:10:00 one Trivy run

Policies

One policy per repository or project (ScanPolicies; deleting the repository or the project deletes its policy); a repository’s own policy replaces its project’s. Each threshold is Low, Moderate, High or Critical (“and above”), or off.

Setting Effect
Warn the package page shows a warning for a version with a finding at or above the threshold
Block download such a version cannot be downloaded: 403 with the reason (below)
Block deploy an artifact whose own coordinates or declared dependencies have such a finding is refused with 403 before anything is stored (NuGet, npm, Maven); a container image cannot be inspected before it is stored, so it is scanned right after the push and removed again when it reaches the threshold. A vulnerability source that is down lets the deploy through (logged)
Block unscanned a stored, scannable version with no successful scan cannot be downloaded (a scan is queued; the first download of a version a remote repository has not fetched yet is not refused, since fetching it is what lets it be scanned). Not enforced while no engine can scan the repository (Trivy not configured, scanning off), for Docker indexes and artifacts whose config is not an image config (a manifest is an image by its media type and its config’s media type; the self-declared artifactType and subject are ignored, as the runtimes ignore them), or for the scanner’s own pull (the user named by Scanning:TrivyRegistryUser; without one, any pull while an image with no successful scan is being scanned; the severity block is never lifted for an image already scanned). Through a virtual repository the member that stores the version applies its own setting, scanned or not

Only stored results decide a download, so a new advisory takes effect at the next scan (schedule, Scan now, or the operation). Policy lookups are remembered for 5 seconds per node.

Where a refusal shows

Format Download refused Deploy refused
NuGet GET v3/package/{id}/{version}/{id}.{version}.nupkg (metadata, nuspec, readme and icon stay readable): 403, plain text PUT api/v2/package and the Upload page: 403 plus the reason
npm tarball GET npm/{name}/-/{file}: 403 {"error": reason} (the packument stays readable) PUT npm/{name} and the Upload page
Maven any file of the version except maven-metadata.xml: 403, plain text PUT of a POM (dependencies) or any file (the artifact itself), and the Upload page
Docker GET/HEAD manifests/{tag or digest} of an image: 403 {"errors":[{"code":"DENIED"…}]}. An index is not refused (its platform manifests are). Layers are content-addressed and are not blocked on their own PUT manifests: the image is scanned, removed again and answered 403 DENIED when it reaches the threshold

In a virtual repository the first member the caller can read that has a result for the version decides, under that member’s policy (the same members the content is served from).

NuGet’s vulnerability resource

What a scan finds about the package version itself is written to PackageVulnerabilities (Source = osv) and so appears in v3/vulnerabilities/* and in registration (vulnerabilities) and search results; a client matches its own restore graph against it. Entries set by hand (the metadata API, the Manage page) have no Source and are never touched by a scan; setting the list by hand replaces the manual entries only, and the Manage page lists the scanner’s as read-only. Advisories about dependencies are those packages’ own entries.

Web UI

Page What
Package pages (/packages/{id}/{version}, /npm-packages/{name}, /maven-artifacts/{group}/{artifact}/{version}, /docker-images/{image}?digest=) Vulnerabilities section: state (clean, findings with severity, advisory link, component, fixed-in, summary; not scanned; scanning unavailable, e.g. “Trivy is not configured”), the policy’s warning or refusal, Scan now for people who may manage the package
/scan-artifact?name=&version= Scan now of one version (signed in, may manage the package; an image is queued, the rest scanned before the answer); also at /r/{repo}/scan-artifact
/admin/scanning engines in use, every repository with its counts and policy, projects
/admin/scanning/{repository} counts by severity, versions with findings (filter, paging), the policy editor (password asked), Scan the whole repository now (the vulnerability-scan operation, also on Operations)
/admin/scanning/projects/{name} the project’s policy (password asked)
Admin Settings every Scanning:* key

Scanning a version needs the Manage permission on the package (the access model plus ownership), a repository dashboard or a policy needs an administrator; without accounts only the schedule and scan-on-deploy scan. Every write is refused with 503 while the server is read-only.

Limits