A standalone Trivy-to-BigQuery export tool
Trivy is a powerful open-source vulnerability scanner and SBOM generator. Octovy exports Trivy scan results to BigQuery, enabling you to build a centralized SBOM and vulnerability repository for your entire organization—a comprehensive inventory of all dependencies, versions, and known vulnerabilities across repositories, searchable via SQL.
It provides three core functions:
- Insert existing Trivy results (
insert): Import Trivy JSON output files into BigQuery - Scan and insert (
scan): Run Trivy on a local directory and insert results into BigQuery - GitHub App webhook server (
serve): Scan repositories automatically onpushandpull_requestevents
These functions can be used with GitHub Actions or deployed as a GitHub App. Storing results in BigQuery enables organization-wide vulnerability management:
- Measure vulnerability exposure: Query how many packages with known vulnerabilities exist across all repositories in your organization
- Rapid incident response: When a critical vulnerability is announced, search for affected packages by name or version across your organization immediately—before vulnerability databases or scanners are updated
- Continuous monitoring: Set up scheduled queries to check for specific critical vulnerabilities periodically
Before using Octovy, you need to set up BigQuery and configure Google Cloud authentication.
bq mk --dataset your-project-id:octovygcloud auth application-default loginFor detailed setup instructions (service accounts, IAM permissions, etc.), see BigQuery Setup Guide.
Scans repositories with Trivy and inserts results into BigQuery. Has two subcommands:
Scans a local directory. Auto-detects git metadata (owner, repo, commit) from the local repository.
# Scan current directory
octovy scan local --bigquery-project-id your-project-id
# Scan specific directory
octovy scan local --dir /path/to/code --bigquery-project-id your-project-id
# With explicit metadata
octovy scan local \
--bigquery-project-id your-project-id \
--github-owner myorg \
--github-repo myrepo \
--github-commit-id abc123Scans a GitHub repository remotely via GitHub App API. Requires GitHub App configuration.
# Scan a specific repository
octovy scan remote \
--bigquery-project-id your-project-id \
--github-owner myorg \
--github-repo myrepo \
--github-app-id 12345 \
--github-app-private-key "$(cat private-key.pem)"
# Scan all repositories for an organization
octovy scan remote \
--bigquery-project-id your-project-id \
--github-owner myorg \
--all \
--github-app-id 12345 \
--github-app-private-key "$(cat private-key.pem)"Inserts Trivy scan result JSON files into BigQuery. Useful when you already have Trivy workflows or want to decouple scanning from insertion.
# Generate Trivy result and insert
trivy fs --format json --output results.json .
octovy insert -f results.json --bigquery-project-id your-project-id
# Insert with explicit metadata
octovy insert -f results.json \
--bigquery-project-id your-project-id \
--github-owner myorg \
--github-repo myrepoRuns an HTTP server that receives GitHub webhooks and automatically scans repositories on push and pull_request events.
octovy serve \
--addr :8080 \
--bigquery-project-id your-project-id \
--github-app-id 12345 \
--github-app-private-key "$(cat private-key.pem)" \
--github-app-secret your-webhook-secretOnce scan results are in BigQuery, you can run powerful queries for vulnerability management.
SELECT
github.owner,
github.repo_name,
github.commit_id,
vuln.VulnerabilityID,
vuln.PkgName,
vuln.InstalledVersion,
vuln.Severity
FROM `your-project.octovy.scans`
CROSS JOIN UNNEST(report.Results) AS result
CROSS JOIN UNNEST(result.Vulnerabilities) AS vuln
WHERE vuln.Severity = 'CRITICAL'
ORDER BY timestamp DESCWhen a critical vulnerability like Log4Shell is announced, immediately find all affected repositories:
SELECT DISTINCT
github.owner,
github.repo_name,
pkg.Name,
pkg.Version
FROM `your-project.octovy.scans`
CROSS JOIN UNNEST(report.Results) AS result
CROSS JOIN UNNEST(result.Packages) AS pkg
WHERE LOWER(pkg.Name) LIKE '%log4j%'
ORDER BY github.owner, github.repo_nameFor more query examples and detailed schema documentation, see BigQuery Schema Reference.
- BigQuery Setup - Required for all commands
- GitHub App Setup - Required for
serveandscan remotecommands - Firestore Setup - Optional for real-time metadata tracking
See docs/README.md for:
- Detailed command documentation
- Setup guides for all services
- Common workflows and examples
- Troubleshooting guides
- FAQ
Octovy is licensed under the Apache License 2.0. Copyright 2023 Masayoshi Mizutani mizutani@hey.com
