osv.dev
AGENTS.md3k starsChanged 59 days agoApache-2.0View on GitHub
This file provides guidance for AI coding agents working on the osv.dev repository. It outlines the project structure, setup commands, testing instructions, and coding standards. [!IMPORTANT] Keeping this file up to date: If you (an AI agent) make any major architectural changes, introduce new services, or modify core workflows (like testing or linting), you MUST update this AGENTS.md file to reflect those changes. These models are defined in Python (osv/models.py) and mirrored in Go (go/internal/database/datastore/models.go).
- Installs packages
Trending
Quiet since August.about the whole repository
Who's talking about google/osv.dev
- JuliaLang/SecurityAdvisories.jl“Register as a new data source for osv.dev”GitHub · Sep 24, 2025 · 4 reactions
- pypa/advisory-database“Proposal to remove Git generation from PYSEC records”GitHub · Jul 8, 2026 · 3 reactions
- DependencyTrack/dependency-track“Please consider adopting OpenSSF Scorecard”GitHub · Jul 10, 2024 · 3 reactions
- x-cmd/x-cmd“[FEATURE] Please consider adopting OpenSSF Scorecard ”GitHub · Jul 9, 2024 · 3 reactions
- DependencyTrack/dependency-track“OSV : replace ecosystem hardcoding with list of ecosystems managed by Google”GitHub · Aug 23, 2022 · 3 reactions
The biggest 5 of 18 mentions linking to the repository that our crawl found. Each line is their own headline.
See all 18
Talked about on GitHub and Bluesky (18 times).
On GitHub · 17
- Sep 24, 2025Register as a new data source for osv.dev — JuliaLang/SecurityAdvisories.jl4 reactions · 1 comment
- Jul 8, 2026Proposal to remove Git generation from PYSEC records — pypa/advisory-database3 reactions · 1 comment
- Jul 10, 2024Please consider adopting OpenSSF Scorecard — DependencyTrack/dependency-track3 reactions
- Jul 9, 2024[FEATURE] Please consider adopting OpenSSF Scorecard — x-cmd/x-cmd3 reactions · 6 comments
- Aug 23, 2022OSV : replace ecosystem hardcoding with list of ecosystems managed by Google — DependencyTrack/dependency-track3 reactions · 3 comments
12 more on GitHub
- Aug 3, 2026Data quality at osv.dev / adjust our output — ocaml/security-advisories2 reactions
- May 21, 2026Known upstream issue in OSV for incorrect `last_affected` ranges — pypa/advisory-database2 reactions
- Aug 26, 2024Add Red Hat ecosystem — ossf/osv-schema2 reactions · 1 comment
- Jul 26, 2024Formally include Common Weakness Enumeration (CWE) in the schema — ossf/osv-schema2 reactions · 7 comments
- Jan 24, 2024Inconsistent package identifier format for vulnerabilities in the Swift ecosystem — github/advisory-database2 reactions · 1 comment
- Mar 19, 2026Remove malformed GHSA alias from PYSEC-2022-184.yaml — pypa/advisory-database1 reaction · 1 comment
- Feb 24, 2026Website: Improve light theme — rustsec/rustsec1 reaction · 2 comments
- Dec 18, 2025This PR bumps the osv library version to 0.1.2 for PyPI release to include the fix in osv-schema. — sobytee/Dale-Jeffers1 reaction · 1 comment
- Dec 4, 2025id prefix for local/custom records not added to osv.dev — ossf/osv-schema1 reaction · 2 comments
- Jul 14, 2025feat: add json schema validation into linter — ossf/osv-schema1 reaction · 1 comment
- Nov 11, 2024Set published date to issued date in OSV data — rustsec/advisory-db1 reaction · 2 comments
- Sep 24, 2024Integrate security reports with OSV.dev — artifacthub/hub1 reaction · 4 comments
On Bluesky · 1
- Oct 6, 2025📦 google / osv.dev ⭐ 2,114 (+23) 🗒 Python Open source vulnerability DB and triage service. — @github-trending.bsky.social1 likes and repost
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about checking a change actually works.
Of the AGENTS.md files we read, the 11,773 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repositoryOne other file it gives its agents.
- CLAUDE.mdCLAUDE.md
The file
Show its rules and text
We split this AGENTS.md into the rules it gives an agent
13 rules. About 1 is common, 6 are distinctive, and 6 are very specific to this project.
≈1
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
When AI agents need to understand the exact format, fields, and semantics of vulnerability records, refer to the local osv-schema submodule:
- Distinctive: line 96
Always format and lint your code before proposing changes.
- Very specific: line 128
Rule: When running Python scripts, always use poetry run.
- Very specific: line 132
Running Go Linters: Run golangci-lint using go run directly within the module directory (go/, vulnfeeds/, or bindings/go/), or run …
- Very specific: line 144
Conventional Commits: Commit messages must follow the Conventional Commits specification (e.g., feat:, fix:, docs:, refactor:, chore:).
- Distinctive: line 178
Regenerate Expected Test Outputs: If you make changes that alter expected test outputs, regenerate them using:
- Distinctive: line 182
Regenerate API query snapshots: If you modify API behaviors, update query snapshots using:
- Distinctive: line 186
Always inspect the resulting git diff to ensure the API query output changes are expected.
- Common: line 190
Run the local Go website development server against a live flat mock dataset with hot reloading (no GCP credentials or Datastore emulator …
- Distinctive: line 196
Run the Go website server against production Datastore:
- Very specific: line 217
All Go microservices are compiled using a single, unified multi-target Dockerfile (go/Dockerfile) which shares the workspace compilation …
- Distinctive: line 247
Run as a cron job.
- Very specific: line 281
Run as a cron job (go/cmd/ubuntubinarymapper/).
≈ “Common” is an estimate: at least 1 in 5 of the 16,595 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md
This file provides guidance for AI coding agents working on the osv.dev repository. It outlines the project structure, setup commands, testing instructions, and coding standards.
[!IMPORTANT] Keeping this file up to date: If you (an AI agent) make any major architectural changes, introduce new services, or modify core workflows (like testing or linting), you MUST update this
AGENTS.mdfile to reflect those changes.
Project Overview
This repository (google/osv.dev) contains the backend services, database models, API, and website for the Open Source Vulnerabilities (OSV) database.
Infrastructure & Storage
- Cloud Platform: The entire system runs on Google Cloud Platform (GCP).
- Database (Indexes): We currently use Google Cloud Datastore to store and query indexes.
- Database (Full Records): Full vulnerability records are stored as protocol buffers (protos) in Google Cloud Storage (GCS).
- Future Architecture: There are long-term plans to migrate the database backend to PostgreSQL, but this is not yet concrete. Rule: Any new Go code interacting with the database must be abstracted behind interfaces to facilitate this eventual migration. Much of this abstraction is already in place—refer to the shared domain interfaces defined under
go/internal/models/.
Monorepo Structure
It is structured as a multi-language monorepo:
go/: Go services and utilities (importers, exporter, internal libraries). This is the primary target for active migrations from Python.osv/: Core Python library containing models, repository helpers, and ecosystem-specific logic. Note: Some parts are deprecated as we migrate logic to Go.gcp/: GCP deployment configurations, Cloud Functions, and workers.website/: Frontend assets for the osv.dev website (frontend3usingpnpm) and blog posts (blogusing Hugo).vulnfeeds/: Vulnerability feed utilities (independent Go module).bindings/: API bindings (contains an independent Go module underbindings/go).
OSV Schema Reference
Vulnerabilities across the entire system conform to the Open Source Vulnerability (OSV) schema.
When AI agents need to understand the exact format, fields, and semantics of vulnerability records, refer to the local osv-schema submodule:
- Full Specification:
osv/osv-schema/docs/schema.md - Protobuf Definition:
osv/osv-schema/proto/vulnerability.proto - JSON Schema:
osv/osv-schema/validation/schema.json
Datastore Schema & Entities
We use Google Cloud Datastore to store indices and metadata for fast querying. The primary source of truth for full vulnerability records is GCS (as protobufs), but Datastore holds crucial entities for the API and Website.
These models are defined in Python (osv/models.py) and mirrored in Go (go/internal/database/datastore/models.go).
Key Entities
Vulnerability(Kind:Vulnerability)- Purpose: Serves as the main index for vulnerability metadata (source, modified time, aliases, relations).
- Fields: Stores
source_id(e.g.,source:path),modifiedtime, and relation lists (alias_raw,related_raw,upstream_raw).
AffectedVersions(Kind:AffectedVersions)- Purpose: Used for API matching when querying by package name and version.
- Fields: Contains
ecosystem,name(package name),versions(list of affected versions), andevents(introduced/fixed ranges). - Optimization: Uses
coarse_minandcoarse_maxfor fast range-based filtering.
AffectedCommits(Kind:AffectedCommits)- Purpose: Used for API matching when querying by Git commit.
- Fields: Maps a
bug_id(vulnerability ID, note the legacy field name) to a list of affected Git commit hashes (stored as bytes). - Schema Quirk: The field for vulnerability ID is
bug_idin Datastore but mapped toVulnIDin Go.
ListedVulnerability(Kind:ListedVulnerability)- Purpose: Optimized specifically for the website's
/listpage. - Fields: Contains summary, ecosystems, packages, severities, and search indices.
- Rule: This entity is only used by the website and should not be used for API matching logic.
- Purpose: Optimized specifically for the website's
UbuntuPackageMapping(Kind:UbuntuPackageMapping)- Purpose: Used by the experimental
POST /v1experimental/ubuntu/binary-to-sourceAPI endpoint to resolve Ubuntu binary package names to their corresponding source package names. - Fields: Keyed by binary package name; stores
source_names(unindexed list of corresponding Ubuntu source package names). - Note: Defined in Go (
go/internal/database/datastore/ubuntu_package_mapping.go) and populated byubuntubinarymapper.
- Purpose: Used by the experimental
Setup Commands
The project uses poetry for Python dependency management, pnpm for website frontend, and Standard Go modules for Go.
- Install Python Dependencies:
poetry install - Install Go Dependencies:
There are multiple Go modules in this monorepo. Run
go mod downloadfrom within the respective directory (go/,vulnfeeds/, orbindings/go/) depending on what you are working on:cd go && go mod download - Install Website Dependencies (for frontend development):
cd website/frontend3 && pnpm install - Initialize Git Submodules:
git submodule update --init --recursive - Build Protos:
make build-protos
Code Style & Formatting
Always format and lint your code before proposing changes. The repository provides a unified script to check for style violations with smart incremental checking:
- Run Linters & Format Checks (Smart Auto-Detect):
By default, this automatically checks only the files and Go modules changed relative to
master(or full repo if on clean master):poetry run tools/lint_and_format.sh - Run Full Check on Entire Repo:
poetry run tools/lint_and_format.sh --all - Run on Staged Changes Only:
poetry run tools/lint_and_format.sh --staged - Automatically Fix/Format Files:
poetry run tools/lint_and_format.sh --fix - Lint Specific Files:
poetry run tools/lint_and_format.sh osv/bug.py go/cmd/worker/main.go
Python Standards
- Formatter:
yapf(config:.style.yapf, runs in parallel via-p) - Linter:
pylint(config:.pylintrc, runs in parallel via-j 0) - Formatting Command: To automatically format Python files, run:
(Or runpoetry run yapf -i <path_to_file>.pypoetry run tools/lint_and_format.sh --fix) - Rule: When running Python scripts, always use
poetry run.
Go Standards
- Linter:
golangci-lint - Running Go Linters: Run
golangci-lintusinggo rundirectly within the module directory (go/,vulnfeeds/, orbindings/go/), or runtools/lint_and_format.shwhich automatically maps changed files to the enclosing module:
(Note: Run outside the sandbox socd go && go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.13.0 run ./...go runcan fetch the linter toolchain if not cached). - Formatting Command:
cd go && gofmt -s -w . - Rule: Go code must follow standard Go formatting guidelines.
Git Commit Guidelines
- Conventional Commits: Commit messages must follow the Conventional Commits specification (e.g.,
feat:,fix:,docs:,refactor:,chore:).
Pull Request (PR) Guidelines
- PR Metadata: Feel free to append metadata, tracking notes, or categories inside hidden HTML comments at the very end of your PR descriptions (for example,
<!-- AI-PR -->or other tags). This keeps the rendered description page clean while preserving useful context in the raw markdown.
Testing & Local Development
To run tests and run services locally, configure the Cloud SDK and install the Firestore emulator:
gcloud auth login
gcloud auth application-default login
gcloud components install cloud-firestore-emulatorRunning Test Suites
- All Tests:
make all-tests - Go Tests:
make go-tests(or run./run_tests.shinsidego/) - Python Library Tests:
make lib-tests
Running Specific Tests
To save time during development, you can run specific tests instead of the entire suite:
- Single Go Test: Navigate to
go/and rungo testwith-run:go test -v ./internal/database/datastore -run TestComputeAffectedVersions - Single Python Test: From the root, run using
poetry run python -m unittest:poetry run python -m unittest osv.bug_test.NormalizeTest.test_normalize
Managing Test Expectations & Snapshots
Many tests use expected outputs saved directly in the source tree:
- Regenerate Expected Test Outputs: If you make changes that alter expected test outputs, regenerate them using:
TESTS_GENERATE=1 make all-tests - Regenerate API query snapshots: If you modify API behaviors, update query snapshots using:
Always inspect the resultingmake update-api-snapshotsgit diffto ensure the API query output changes are expected.
Local UI & Website Development
- Website DevServer (Go-native):
Run the local Go website development server against a live flat mock dataset with hot reloading (no GCP credentials or Datastore emulator required):
make run-website-devserver- Mock vulnerability records are located in
go/cmd/website-devserver/testdata/. Add or edit.jsonrecords and.meta.yamlcompanion files to immediately see changes on page refresh.
- Mock vulnerability records are located in
- Run against Cloud Datastore:
Run the Go website server against production Datastore:
Or against staging Datastore:make run-websitemake run-website-staging
Local API Server Development (Go-native)
- To run the public OSV API server locally using the native Go implementation alongside the ESPv2 proxy (which transcodes HTTP/JSON REST requests to gRPC):
make run-api-server
Go Component Architecture (go/)
The Go component contains the active and migrated services for the OSV database. It is structured with executables in cmd/ and shared libraries in internal/.
Go Monorepo Docker Builds
All Go microservices are compiled using a single, unified multi-target Dockerfile (go/Dockerfile) which shares the workspace compilation setup.
- Due to the
replacedirective ingo/go.modpointing to the siblingbindings/library, Go Docker builds must mount thebindings/folder into the build context. - Since the production Cloud Build steps run inside
dir: 'go', they leverage BuildKit's--build-contextflag to cleanly map the sibling folder without importing other monorepo files:docker build -t osv/importer --target importer --build-context bindings=../bindings -f Dockerfile . - For local dev testing, you can use the exact same command inside the
go/directory.
[!IMPORTANT] Python to Go Migration: We are actively migrating core services from Python to Go. For example, the new Go-based worker (
go/cmd/worker/) replaces the legacy Python worker (gcp/workers/worker/). Always prefer modifying the Go implementation if both exist, unless instructed otherwise.
Executables (go/cmd/)
api:- The public OSV gRPC API server.
- Defined in
go/cmd/apias a thin wrapper calling into thego/internal/apilibrary.
api-devserver:- Development orchestrator command for local testing.
- Spawns the Go API server natively in a background thread while concurrently running the
osv-esp(ESPv2) docker container to perform HTTP/JSON to gRPC transcoding.
website:- The public OSV website server implemented in Go.
- Defined in
go/cmd/websiteand deployed to Cloud Run.
website-devserver:- Local development server for the Go website frontend.
- Serves the website using a live flat mock dataset in
go/cmd/website-devserver/testdata/with hot reloading (reads live from disk on every request without requiring GCP credentials or emulator).
importer:- Run as a cron job.
- Reads from each vulnerability data source (defined as
SourceRepositoryin Datastore or mapped insource.yaml/source_test.yaml). - Detects new or deleted vulnerability records.
- Dispatches processing tasks via GCP Pub/Sub to the worker.
worker:- Daemon that subscribes to Pub/Sub tasks.
- Ingests and enriches vulnerability records.
- Computes affected Git ranges for commit-based querying.
- Writes the enriched records to the database (GCS/Datastore).
- Powered by a modular processing pipeline defined in
go/internal/worker/pipeline/.
exporter:- Exports the entire database to a public GCS bucket.
- Generates a root
all.zipfile containing all records. - Generates ecosystem-specific
all.zipfiles (e.g.,PyPI/all.zip). - Outputs individual vulnerability JSON files in their respective ecosystem folders (e.g.,
PyPI/GHSA-abcd-efgh.json).
relations:- Populates relationships between vulnerabilities in the database.
- Calculates transitive and reflective
aliases, reflectiverelatedvulnerabilities, and transitiveupstreamfields.
gitter:- Git client daemon/utility to precompute and cache git operations required by other services.
- Performs intensive Git tasks like computing commit graphs and generating patch IDs.
recoverer:
- Daemon that subscribes to failed task recovery Pub/Sub messages.
- Repairs and retries failed GCS writes, reimports missing vulnerability records from sources (via Gitter, GCS bucket, or REST), and handles GCS generation mismatches.
vanir_signatures:
- Cron job orchestrated in Go (
go/cmd/vanir_signatures/andgo/internal/vanir/) that queries modified vulnerabilities, shells out to a minimal Python helper script (generate_signatures.py) to run Vanir signature generation, and writes enriched signatures back to the database.
ubuntubinarymapper:
- Run as a cron job (
go/cmd/ubuntubinarymapper/). - Reads
Ubuntu/modified_id.csvfrom the exported GCS bucket (gs://osv-vulnerabilities) with a 1-hour lookback window, downloads modified Ubuntu vulnerability records (viaUbuntu/all.zipor individualUbuntu/<id>.jsonfiles), extracts binary-to-source package name mappings fromecosystem_specific, and persists them to Datastore (UbuntuPackageMapping) alongside aJobDataexecution checkpoint (or to a local JSON file via-output-json).
Internal Shared Libraries (go/internal/)
api/: Shared package containing the core gRPC public server implementation of the OSV API.website/: Shared package implementing HTTP handlers, templates, routing, and search logic for the Go website frontend.worker/: Core engine and subscriber logic for the Go worker.recoverer/: Core engine and handlers for the Go recoverer.vanir/: Orchestration, filtering, and domain mutation logic for Vanir signature generation.database/: Shared Datastore client and repository models (specificallygo/internal/database/datastore/).- Design Pattern: Models here mirror the Datastore models defined in the Python library (
osv/models.py). - Consistency Testing: To prevent synchronization drift between Go and Python database models, a database validation test is maintained under
go/internal/database/datastore/internal/validate/(run viarun_validate.sh). - Schema Quirks (Crucial for Agents): In the Datastore database, the legacy term
bugwas used for vulnerabilities. Consequently, many Datastore fields still use names likebug_idorbug_ids. In the Go codebase, these are mapped to Go struct fields likeVulnIDorVulnIDs(e.g.,AffectedCommitshasVulnID string datastore:"bug_id"). Pay close attention to thedatastore:tag when writing queries or defining new fields!
- Design Pattern: Models here mirror the Datastore models defined in the Python library (
gitter/: Client logic to interface with the Gitter caching service.repos/: Shared Git repository management and utilities.
Python Component Architecture (osv/)
The osv folder is a shared Python package. Since the primary API server and some workers are still in Python, this package remains highly active.
models.py: Datastore models (e.g.,Vulnerability,Repository) used by the Python API.- Note on
BugEntity: TheBugentity insidemodels.pyis legacy and retired for core services. It is no longer used by the primary system, except by OSS-Fuzz.
- Note on
bug.py: Helper classes and methods for representing bugs.impact.py: Core engine to calculate the impact of vulnerabilities.ecosystems/: Ecosystem-specific logic (e.g., PyPI, Maven, NPM) for analyzing versions and ranges.
GCP Component Architecture (gcp/)
Contains deployment setups, workers running in GKE, Cloud Functions, and the user-facing website and API.
1. API Server (go/cmd/api/)
- Status: Active (Go).
- Serves the public OSV gRPC API server (transcoded to HTTP/JSON REST via ESPv2).
- Deployment Target: Google Cloud Run (managed via Cloud Deploy pipeline
osv-apideploying toosv-grpc-backend). - Note: Fully migrated from Python to Go. Protobuf definitions and descriptor files are located under
proto/v1/.
2. Website (go/cmd/website/, website/)
- Status: Active (Go).
- Fully migrated to Go backend under
go/cmd/website/andgo/internal/website/. Frontend assets (Hugo blog, pnpm frontend3) are located underwebsite/. - Deployment Target: Google Cloud Run (managed via Cloud Deploy pipeline
osv-website).
3. Workers (gcp/workers/)
worker(gcp/workers/worker/): Base Environment. Retains shared Poetry dependencies and base Dockerfile for legacy Python workers; legacy worker daemon replaced by Go worker undergo/cmd/worker/.- ClusterFuzz Worker (
gcp/workers/oss_fuzz_worker/,gcp/workers/oss_fuzz_importer/): Barely Maintained. Siloed workloads for OSS-Fuzz integration.- Deployment Target: GKE (managed via Cloud Deploy pipeline
oss-fuzz-workers).
- Deployment Target: GKE (managed via Cloud Deploy pipeline
4. Indexer (gcp/indexer/)
- Status: Active (Go).
- Handles indexing, but is not under active development.
- Deployment Target: GKE (managed via Cloud Deploy pipeline
gke-indexer).
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

