dbs

package
v0.16.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 16, 2026 License: BSD-3-Clause, GPL-3.0 Imports: 40 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

DBs

Client installation

Current clients use /dbs/signed/v1/latest: Ed25519 signatures cover opaque payload bytes binding archive hash/size, layout/schema, source policy and exact review records. signing_root.go pins the offline root. Root-signed publisher certificates last at most 90 days; production releases last 72 hours. Downloads reject expiry, future issue times, lower key epochs/sequences and same-sequence equivocation. Verified installed data remains usable offline after expiry. Explicit registry overrides retain the v3 protocol for private publishers.

/dbs/v3/ stays frozen at the v0.14.0 registry/archive below. /ready checks both channels; /freshness also alerts with less than 24 hours left on an update or less than 14 days on its signing key/source policy. Serving needs no private key.

net util -download-dbs
net util -update-dbs

The client embeds the community signing root independently of downloaded archives. No credentials or trust environment variables are needed for the community release. NC_CONFIG_ROOT changes the installation root; the default is ~/.config/netcap. A repeated download verifies the installed files and skips an unchanged release. -download-dbs -force forces replacement.

Private publishers override both NC_DBS_APPROVALS and NC_DBS_APPROVALS_SHA256; partial or invalid overrides fail rather than falling back. Publishing and serving still require an explicit operator registry. scripts/import-db-trust.py <registry> <independent-sha256> updates the bundled registry for a reviewed compatibility release. Signed community updates use publisher-side source policies instead of requiring a binary per snapshot.

Signed publisher operations

Surface Configuration
Serving image docker/dbs-server/Dockerfile.publisher; non-root, digest-pinned; data mounts only
Public signed objects /srv/netcap-dbs-signed/v3; signed-latest.json is the atomic pointer
Signer Host /usr/local/bin/netcap-dbs-server; /root/netcap-db-publisher/publisher.env selects policy, certificate and private signer
Offline root Operator workstation ../server/secrets/netcap-db-signing/root.key; never deployed or committed
Schedule ../server/schedules/netcap-db-refresh.{service,timer}; daily 00:30 UTC plus up to 15 minutes jitter
Refresh scripts/refresh-databases.sh; flock prevents overlap; failures retain the previous signed pointer and failed acquisition
Previous count scripts/db-previous-count.py authenticates the prior signed release/archive/reviewed SQLite and recounts NVD; missing/stale caches cannot reset the baseline. Requires Python 3.11+ and cryptography. Explicit NC_DBS_BOOTSTRAP_PREVIOUS_COUNT=0 is accepted only for an empty channel.
Policy Explicit source origins, transformations, filenames, static pins, full notices and 60-day expiry; nonempty annual feeds, declared/indexed count agreement, 48-hour current-feed age, minimum 400,000 CVEs and no decrease exceeding 5%

scripts/prepare-db-policy.py prepares operator-reviewable policy from existing rights records and pinned BSD HASSH upstream. Independently pin its SHA-256 in publisher.env. New sources, transformations or terms require policy review. -mode approve emits automation-labelled exact-output records after policy/data validation; -mode sign verifies the complete archive before publishing. Keep policy and signer outside serving mounts; review renewal before policy expiry.

Rotate on the workstation: netcap-dbs-server -mode rotate-key -key /offline/root.key -output /new/key-directory -epoch N, with N greater than the current epoch. Transfer only signer.key and signer.json, update host paths, run the refresh service and verify a download. A new root-authorized epoch can recover from a compromised signer's inflated sequence. Never replace the root based solely on downloaded metadata.

Rollback republishes a previous archive with a new higher sequence; replaying an old signed pointer is rejected. Stage both channels and a full download on a loopback-only port before an image cutover. Retain the previous image digest, mounts, registry pin and args for serving-image rollback. The frozen v0.14 channel is independent of signed publication.

NVD source revisions append ;acquisition= JSON with each feed's compressed hash, acquisition time, upstream timestamp and declared/indexed counts. This extends the opaque revision string without changing the Go/Rust client wire contract. refresh-status.json records credential-free pipeline stages; /freshness distinguishes failed acquisition/policy/pack/sign stages and builds stuck over an hour from release expiry or key/policy renewal. Source-age/count refusal keeps the previous signed publication.

Verified 2026-11-06: Go/Rust accepted delegated key epoch 1 → 2; an older-key replay was rejected before requesting its archive. A loopback-only rollback republished archive e44410a7… with a higher sequence, installed over production snapshot 9fafcd38…, and passed real CVE applicability/reference checks; production stayed on 9fafcd38….

Production deployment

Verified 2026-11-06: https://dbs.netcap.io/dbs/v3/latest serves layout 3; legacy /dbs/* and /dbs/v2/* metadata and archives return HTTP 410.

The signed publisher image is signed-190061c1 at digest sha256:b91afb7197703a72799a4b77604eb7d2fe61e7ee65fd374696df8e17b1980208; the serving container contains no signing credential or executable bind mount. Go v0.15.2 and Rust v0.1.9 are the released signed-update clients. Their actual archives passed clean Windows/macOS qualification; the generated Homebrew install also passed. Mac DPI requires 26+, nodpi 15+; all Linux variants include their runtime and supplier inventory.

docs.netcap.io still needs external GitBook access: GitHub hook 104064290 targets hooks.gitbook.com and returns 404. The site retains a legacy attachment at /files/-M6158bOQF_mI5dN6UjM; reconnect Git Sync/publish current docs and delete the attachment, then verify its direct URL. Repository docs alone do not retire that separately hosted copy. The legacy LFS batch route returns Traefik HTTP 404.

Item Value
Dokploy workload Compose fWFhMHd-o2Zuw9r8Kd_Zd, project netcap-dbs-readonly-ssbahz, service publisher; docker/dbs-server/compose.publisher.yml pins all three serving binds read-only. Prior application ZrG0UFSYLc1AvaAu1nUE4 remains stopped at 0/0 for rollback.
Runtime Dedicated non-root netcap-dbs-server image; /netcap-dbs-server is part of the image, not a bind mount
Compatibility registry /srv/netcap-dbs-v3-runtime/approvals-schema2.json, mounted at /run/netcap-trust/approvals.json and pinned in Dokploy args
Registry SHA-256 0a71e6b0bb4f4c3513dca4051e54b1b457d480b2e54b857ffa9568952dccf441
Archive SHA-256 1e2cd4e3f605d0044c8d6b45f4da9a7c8bd3ef3eef68c996ba91c3df26759298
Contents NVD (420,062 records; 85,687 CVE-2026 IDs; 25 annual feeds, 2002–2026), DB-IP City/ASN, IANA, uap-core; zero Exploit-DB records
Retained acquisition /srv/netcap-dbs-v3-candidates/candidate-1306206749; published objects under /srv/netcap-dbs-schema2/v3
Automation Frozen v3 compatibility archive; systemd refreshes the separate signed channel daily

The full public archive and the current Go client's installation were verified; SQLite integrity and foreign-key checks passed. Clients before v0.14 must upgrade. The retired repository is no longer a generator source; HASSH requires a separately verified replacement in this compatibility snapshot. The signed channel restores HASSH from a pinned BSD-licensed upstream.

Layout 3 contract

V3Layout=3 and VulnDBSchema=vulndb.SchemaVersion (2) are defined in v3_policy.go. Client community approvals are pinned in community_registry_generated.go. A generated candidate is not an approval.

Surface Contract
Build BuildCandidate(root, year) uses a new private directory and requires every NVD year through the current year. It retains SOURCE_CANDIDATE.json for review.
Review NC_DBS_APPROVALS names a separate operator-controlled JSON array of ReviewedSource records, outside candidates/releases/caches. NC_DBS_APPROVALS_SHA256 independently pins its exact bytes. Publication, startup and installation require that pin; a manifest cannot authorize itself.
Evidence Each review requires decision: approved-for-publication, opaque public reviewer/review IDs, RFC3339 review time, exact source evidence and exact output hashes/sizes. SourceEvidence binds origin, immutable revision/hash, transformation, grant_origin, grant_revision, complete grant_text/hash and copyright/notice text. No private review notes are part of the schema.
Policy CandidateFiles() is the positive allowlist. SQLite is required and must contain NVD entries and zero exploits. Unknown files, directories, symlinks and stale derived indexes fail publication.
Publication PackV3(candidate, output, approvals) verifies the complete archive before publishing <sha256>.tar.gz and immutable <sha256>.json, then atomically commits regular-file latest.json. Inputs and previous releases are retained.
HTTP /dbs/v3/latest, /dbs/v3/list, /dbs/v3/<sha256>.json, /dbs/v3/<sha256>.tar.gz. version equals archive SHA-256; metadata also binds manifest_sha256, approval_registry_sha256, size, NVD start/end years, layout and SQLite schema.
Archive Flat regular members only: reviewed files, RELEASE_MANIFEST.json (Candidate, reviews, approval_registry_sha256) and DATABASE_NOTICES.txt containing every complete supplied primary grant/notice with acquisition origin, revision and hash. Embedded reviews must exactly match the independently pinned registry.
Startup net util --serve-dbs validates cached v3 bodies before serving. No ambient import or automatic startup build. NC_DBS_REBUILD=1 opts into nightly builds; /health exposes the last build error.
Legacy All v1/v2 metadata and download bodies return 410 once v3 is ready, otherwise 503. Files on disk are not pruned or repacked.
Client DownloadDBsWithProgress uses bundled community trust or an explicit operator registry/path pin, verifies into a new managed directory before switching dbs, and retains ambient data only in an inactive backup. ManagedReleaseMetadata(dir) uses the same trust gate for dbs/.release.json; the old root .db-version is not authoritative.

SQLite uses schema 2 and keeps its built_at key, with an empty value rather than inventing a reproducible timestamp. Release metadata supplies created_at; input_sha256 binds the exact NVD feed inventory. Identical inputs rebuild to identical SQLite bytes (TestV3SQLiteRebuildReproducesReviewedBytes). nvd_inputs records every contiguous year with its primary feed URL, SHA-256 and compressed size, in both SQLite metadata and SourceEvidence. Indexing reads private frozen copies; start/end-year claims are checked against that inventory and the pinned exact output review.

For private publishers, supply the registry path and pin through operator configuration, never by copying a pin announced by a download. CLI equivalents are --dbs-approvals and --dbs-approvals-sha256, also supported by serving/downloading commands.

net util --generate-dbs --nvd-start-year 2002
# Review the retained candidate and supply actual snapshot-specific records.
net util --pack-dbs /path/to/candidate/dbs --dbs-output /path/to/server/v3 \
  --dbs-approvals /path/to/reviewed-records.json \
  --dbs-approvals-sha256 "$NC_DBS_APPROVALS_SHA256"
# Equivalent wrapper; NETCAP_BIN may select the freshly built executable.
zeus/scripts/pack-dbs.sh -d /path/to/candidate/dbs -o /path/to/server/v3 \
  -a /path/to/reviewed-records.json --approvals-sha256 "$NC_DBS_APPROVALS_SHA256"

The wrapper performs no deployment or release cleanup. CMS, DHCP fingerprints, macaddress.io, Exploit-DB, Nmap, Alexa, JA3 corpora and GeoLite2 are not v3 publication candidates. CandidateFiles() retains HASSH, UA regexes, IANA and DB-IP candidates without asserting snapshot clearance. Reviewed, independently authored service-signatures.json is optional, mapped to source ID netcap-service-signatures and validated by the runtime parser. There is no recurring approval policy: fresh or changed nightly bytes remain blocked until their exact snapshot/output records enter the operator registry; changing a registry also requires an independently configured new pin. The initial implementation trusts one registry identity at a time. Old artifact files are retained across rotation, but an archive bound to a different registry identity is not silently grandfathered into the new trust configuration.

The material below describes the historical v1/v2 implementation and source inventory; use the layout-3 contract above for current operating instructions.

Usage Options

Users have three options for obtaining netcap databases:

  1. Download from server (Recommended): net util -download-dbs
  2. Generate locally: net util -generate-dbs
  3. Set up your own database server: See Database Server section below

Database Server

Netcap now includes a built-in HTTP server that automatically rebuilds and serves databases with nightly updates.

Starting the Server
# Start the database server
net util -serve-dbs

# Specify custom address
net util -serve-dbs -serve-addr :9090

# With verbose logging
net util -serve-dbs -verbose

See docker/dbs-server/README.md for complete documentation.

# Quick start with docker-compose
cd docker/dbs-server
docker-compose up -d
Downloading Databases
# Download from default URL (dbs.netcap.io)
net util -download-dbs

# Download from custom server
net util -download-dbs -dbs-url http://your-server:8080

# Using environment variable
export NETCAP_DBS_URL=http://your-server:8080
net util -download-dbs

# Force re-download
net util -download-dbs -force
Geolocation providers

Layout 2 bundles dbip-city-lite.mmdb and dbip-asn-lite.mmdb from DB-IP Lite, licensed under CC BY 4.0. Layout 1 excludes them. geoip-sources.json records each release month, source URL and SHA-256. The generator and nightly server try the current month, then the previous month; a verified cache survives an upstream outage. Invalid MMDB types or modified files prevent packaging. The packer uses v2/ when netcap.sqlite is present; legacy input goes to dbs/ and excludes DB-IP. Packing v2 DB-IP inputs requires Python 3 for manifest/hash verification.

-geoProviders / NC_GEO_PROVIDERS Use
dbip,geolite2 Default: DB-IP first, then optional GeoLite2
geolite2,dbip Prefer user-installed GeoLite2, fall back to DB-IP
dbip Load DB-IP only
geolite2 Load GeoLite2 only

-geoDB=false disables all geolocation. Location (country/city together) and ASN fall back independently; country, city and ASN output formats are unchanged. Each selected provider requires its City and ASN pair. Missing or corrupt providers are skipped; an unselected provider is never used. Reloading providers clears the lookup cache. Startup logs and /api/dbs/status show loaded providers and build timestamps. The Databases page saves its order in $NC_CONFIG_ROOT/geoip-settings.json (normally ~/.config/netcap/), for new captures. Precedence: explicit CLI/config value, environment, saved UI order, default. UI changes override the running server's startup order for new jobs.

City estimates are approximate and monthly DB-IP Lite has lower accuracy than its commercial edition. Anycast/mobile addresses need particular care. DB-IP IPv6 city results with no matching DB-IP ASN are suppressed to avoid its broad unallocated-address fallback; GeoLite2 can supply the next result. This may also suppress legitimate IPv6 city data where the ASN database has a coverage gap. The shared web UI footer credits DB-IP and GeoNames. Applications redistributing or displaying the data must retain attribution and the licence link.

Optional user-installed databases

The community archives exclude nmap-service-probes and every GeoLite2-*.mmdb. The retired Alexa feed (domain-whitelist.csv) is no longer fetched or shipped. The generator, server and pack-dbs.sh also exclude user-installed copies when creating an archive.

Existing installations can fetch the republished archive with net util -download-dbs -force. Extraction preserves existing local files; remove an old community-supplied domain-whitelist.csv yourself if present. Keep any whitelist you maintain locally. Nmap and MaxMind files already installed by the user remain local.

Set DBS_DIR to the database directory reported by Netcap (normally $HOME/.config/netcap/dbs, or $NC_CONFIG_ROOT/dbs when configured).

Data Install locally
Nmap service probes Review NPSL, including §3's reader conditions. Copy nmap-service-probes from your Nmap installation (often /usr/share/nmap/), or use the command below. Separate downloading does not settle Netcap/NPSL compatibility.
MaxMind GeoLite2 Register at MaxMind, accept its terms and download GeoLite2 ASN and City. Extract GeoLite2-ASN.mmdb and GeoLite2-City.mmdb into DBS_DIR. Alternatively, set NETCAP_GEOLITE_API_KEY to your own license key and run net util -download-geolite. Do not republish these downloads.
DBS_DIR="$HOME/.config/netcap/dbs" # replace with your configured directory
mkdir -p "$DBS_DIR"
curl --fail --location https://svn.nmap.org/nmap/nmap-service-probes \
  --output "$DBS_DIR/nmap-service-probes"
API Endpoints
  • GET /health - Health check (reports layout)
  • GET /dbs/v2/latest - Latest version metadata (JSON: version, tarball, layout, vulndb_schema, sha256, size)
  • GET /dbs/v2/list - List all available versions (JSON)
  • GET /dbs/v2/latest.tar.gz, GET /dbs/v2/YYYY-MM-DD.tar.gz - Download a tarball
  • GET /dbs/latest, GET /dbs/<file> - Frozen layout 1 (bleve) revision for netcap < v0.10, marked Deprecation: true

Layout 2 (netcap ≥ v0.10) replaces nvd.bleve and exploit-db.bleve with one netcap.sqlite, readable from Go and Rust (internal/vulndb/SCHEMA.md). Clients refuse a tarball whose sha256 does not match the metadata.

Database Storage
netcap-dbs-server/          # Root directory (NC_CONFIG_ROOT)
├── v2/                     # Published layout 2 revisions, only the latest kept
│   ├── 2026-10-04.tar.gz
│   ├── 2026-10-04.json
│   ├── latest.tar.gz       # symlink, replaced atomically
│   └── latest.json
├── dbs/                    # Legacy layout 1; data-source removals may be republished
├── staging/                # Private to a rebuild: build/ downloads, dbs/ tarball content
├── geoip-cache/             # Verified monthly DB-IP pair and source manifest
└── build/

A rebuild publishes only when netcap.sqlite was built, so a failed NVD download keeps the previous revision.

Configuration:

  • Set NC_CONFIG_ROOT environment variable to change the root directory
  • Default: netcap-dbs-server (relative to current working directory)
  • Docker default: /data/netcap-dbs-server

Using Pre-existing Databases:

The server can use pre-existing databases instead of rebuilding on startup. Mount or copy a layout 2 tarball and its JSON into v2/ before starting the server. The server will:

  1. Detect existing database tarballs (YYYY-MM-DD.tar.gz format)
  2. Use the most recent version as the initial revision
  3. Create latest symlinks automatically
  4. Skip initial rebuild and start serving immediately
  5. Continue with scheduled nightly rebuilds

For detailed instructions on mounting databases with Docker, see docker/dbs-server/README.md.

TODOs

  • integrate https://github.com/malware-traffic/indicators

  • initJa3Resolver: load ja3 json dbs into netcap.sqlite and bundle with dbs

  • merge PR to add fault tolerance to build process

  • integrate Ja4+ and deprecate Ja3

  • add generic interface for netcap dbs, so that custom data or feeds can be easily integrated

  • deprecate netcap-dbs repo

Additiontal Data

NETCAP DBs

This is a collection of various open sourced databases with information that netcap uses for audit record enrichment and correlation.

Some data sources are used in original form, some are preprocessed.

Index

TODOs

Installation

To clone this repo you need to install the LFS git plugin to handle large files.

Apt/deb: sudo apt-get install git-lfs
Yum/rpm: sudo yum install git-lfs
MacOS: brew install git-lfs
Windows: ???

If you want to contribute to the repository, you will need to install the lfs and license checker hooks with:

./install-hooks.sh

Data Sources

The following catalogue includes historical sources; DATABASE_NOTICES.txt describes the distributed files. Optional and retired sources are marked below.

Wappalyzer Technologies Database

Provides common attributes of web frameworks for identification.

Source: https://github.com/AliasIO/wappalyzer/blob/master/src/technologies.json

License: MIT

Fingerbank Open Sourced DHCP Fingerprints

Fingerprinted DHCP devices will be enriched with information from: https://raw.githubusercontent.com/karottc/fingerbank/master/upstream/startup/fingerprints.csv

It can be used to get a small fraction of the Fingerbank database for offline lookups, however beware these are likely outdated.

It is also possible to authenticate to the Fingerbank API via API key for more accurate lookups.

License: Commercial

Domain Whitelist (Alexa Top 1 million)

The Alexa feed and domain-whitelist.csv are retired. New signed database releases include unchanged netapi-top1m.csv from NetAPI Top 1M, licensed CC BY 4.0 by NetAPI / CodeRockers LTD. ToS §4.3 (2026-11-07) and the provider's clarification permit redistribution with attribution. The publisher records the exact CSV hash and retains the dataset link in archive notices.

Filtered Maltego transforms use this list by default; --no-domain-popularity disables suppression, and --domain-popularity-list selects an external override. See resolver configuration.

MaxMind GeoLite2 CC Databases

For retrieving geographic City and ASN information about an IP address.

User-installed only; community archives exclude all GeoLite2-*.mmdb, including the historical 2019 snapshots. See installation instructions for account-based downloads under MaxMind's terms.

HASSHDB from AdelKa

Various SSH fingerprints, used to enrich SSH audit records.

Source: https://raw.githubusercontent.com/0x4D31/hassh-utils/master/hasshdb

License: BSD3

Ja3 associated Client and Server Fingerprints

Associated Ja3 client and server fingerprints for a handful of OS and browser variants.

Recorded in our lab environment during our research project for the Offensive Technologies course.

Used to increase accuracy for software identification.

Filename: ja_3_3s.json

License: MIT

Ja3 Fingerprints and UserAgents from Ja3er.com

TLS client and server hashes and associated user agents for threat hunting, from https://ja3er.com.

Source Hashes: https://ja3er.com/getAllHashesJson

Source UserAgents: https://ja3er.com/getAllUasJson

License: None provided

Trisul Ja3 Fingerprints

https://github.com/trisulnsm/trisul-scripts/blob/master/lua/frontend_scripts/reassembly/ja3/prints/ja3fingerprint.json

TODO: integrate new repo https://github.com/trisulnsm/ja3prints

License: None provided

Macaddress.io Database

Mac OUI to Vendor Names and registered addresses.

Source: https://macaddress.io/database-download

License: https://macaddress.io/terms-of-service

Nmap Service Probes

User-installed only; community archives exclude nmap-service-probes. See installation instructions.

https://svn.nmap.org/nmap/nmap-service-probes

License: NPSL (https://nmap.org/npsl)

User Agent Parser Regexes

Regular expressions to identify the software behind a useragent more accurately.

Used to create additional software audit records based on HTTP user agent observations.

Source: https://raw.githubusercontent.com/tobie/ua-parser/master/regexes.yaml

License: Apache 2

IANA Service Names to Port Numbers

Ports mapped to services for TCP and UDP, used to enrich the service audit records.

Source: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.csv

NVD vulnerabilities in netcap.sqlite

Used to lookup identified software products and search for known vulnerabilities.

Stored in netcap.sqlite with an FTS5 full-text index; format in internal/vulndb/SCHEMA.md.

Source: https://nvd.nist.gov/vuln/data-feeds#JSON_FEED

License:

The entire NVD database can be downloaded from this web page for public use. All NIST publications are available in the public domain according to Title 17 of the United States Code, however acknowledgement of the NVD when using our information is always appreciated.
Exploit-db in netcap.sqlite

Used to lookup identified software products and search for applicable exploit PoC code.

Stored in netcap.sqlite with an FTS5 full-text index; format in internal/vulndb/SCHEMA.md.

Source: https://github.com/offensive-security/exploitdb

LICENSE: GPL-2

Further Licensing Details

The LICENSES file contains all licenses of data sources that provide one.
If you think that something should not be listed here please get in touch.

Documentation

Index

Constants

View Source
const (
	V3Layout      = 3
	VulnDBSchema  = vulndb.SchemaVersion
	CandidateFile = "SOURCE_CANDIDATE.json"
	ManifestFile  = "RELEASE_MANIFEST.json"
)
View Source
const (
	ApprovalRegistryEnv    = "NC_DBS_APPROVALS"
	ApprovalRegistryPinEnv = "NC_DBS_APPROVALS_SHA256"
)
View Source
const Layout = V3Layout

Layout is the current reviewed database distribution format.

Variables

This section is empty.

Functions

func ApproveCandidate

func ApproveCandidate(dir, policyPath, policyPin, registryPath string, previousCount int) error

ApproveCandidate evaluates operator-reviewed policies, never inferred grants. The resulting record states automation as its reviewer and binds exact outputs.

func BuildCandidate

func BuildCandidate(root string, startYear int) (string, error)

BuildCandidate always uses new inputs. An incomplete fetch/index is an error; existing releases and ambient database directories are never used as inputs. The returned directory is deliberately unapproved and retained for review.

func BuildVulnDB

func BuildVulnDB(buildPath, outDir string, nvdStart int, verbose bool) error

BuildVulnDB builds current-schema SQLite from every required NVD year, without Exploit-DB input. Normalized metadata makes identical inputs reproducible. Only a completed, normalized database replaces a prior output.

func CandidateFiles

func CandidateFiles() map[string]string

CandidateFiles is a copy of the positive publication policy. Presence here permits review; it is not a redistribution grant.

func CommunitySigningRoot

func CommunitySigningRoot() (ed25519.PublicKey, error)

CommunitySigningRoot returns the existing public trust anchor for separately scoped optional channels.

func DisableFlagsForMissingDBs

func DisableFlagsForMissingDBs(selection ...string) []string

DisableFlagsForMissingDBs returns the capture flags that switch off every feature whose database is absent, deduplicated and in registry order.

Passing these lets a run proceed with reduced enrichment rather than aborting, which is the difference between a usable app and one that cannot open a single capture until a 91 MB download completes.

func DownloadDBs

func DownloadDBs(serverURL string, force bool) error

DownloadDBs downloads the latest databases from the configured server.

func DownloadDBsWithProgress

func DownloadDBsWithProgress(serverURL string, force bool, progress ProgressFunc) error

DownloadDBsWithProgress installs only a completely verified managed release. Ambient data is retained as a backup, never merged into the active release.

func DownloadDBsWithRegistry

func DownloadDBsWithRegistry(serverURL string, force bool, progress ProgressFunc, path, pin string) error

func DownloadGeoLite

func DownloadGeoLite() error

DownloadGeoLite will download the GeoLite Database if the API key is set in the environment

func GenerateDBs

func GenerateDBs(startYear int) error

func GenerateDBsWithApprovals

func GenerateDBsWithApprovals(startYear int, approvalsPath string) error

func GenerateDBsWithRegistry

func GenerateDBsWithRegistry(startYear int, approvalsPath, registrySHA256 string) error

func GenerateSigningKeys

func GenerateSigningKeys(dir string) error

GenerateSigningKeys writes an offline root and a separately deployable signer. Existing keys are never overwritten. The serving container needs neither key.

func ListAvailableVersions

func ListAvailableVersions(serverURL string) error

ListAvailableVersions lists all available database versions from the server

func RotateSigningKey

func RotateSigningKey(rootPath, output string, epoch uint64) error

RotateSigningKey requires the offline root; a replacement signer cannot certify itself.

func SignPublication

func SignPublication(meta DBMetadata, registryPath, policyPath, keyPath, certPath, output string, sequence uint64) error

func UpdateDBs

func UpdateDBs() error

UpdateDBs installs a verified managed release, preserving ambient data only in an inactive backup directory.

func VerifyV3Archive

func VerifyV3Archive(path string, meta *DBMetadata) error

VerifyV3Archive checks the complete archive body, member inventory, reviewed rights records and database contents. No workstation data is consulted.

func WriteCandidate

func WriteCandidate(dir string, evidence []SourceEvidence) error

WriteCandidate records unapproved evidence for review, never an approval.

Types

type Candidate

type Candidate struct {
	Layout       int              `json:"layout"`
	VulnDBSchema int              `json:"vulndb_schema"`
	Files        []ReleaseFile    `json:"files"`
	Sources      []SourceEvidence `json:"sources"`
}

type DBMetadata

type DBMetadata struct {
	Version                string `json:"version"`
	CreatedAt              string `json:"created_at"`
	Tarball                string `json:"tarball"`
	NVDStartYear           int    `json:"nvd_start_year"`
	Layout                 int    `json:"layout"`
	VulnDBSchema           int    `json:"vulndb_schema"`
	SHA256                 string `json:"sha256"`
	Size                   int64  `json:"size"`
	ManifestSHA256         string `json:"manifest_sha256,omitempty"`
	ApprovalRegistrySHA256 string `json:"approval_registry_sha256"`
	NVDEndYear             int    `json:"nvd_end_year"`
}

DBMetadata represents metadata about a database version

func ManagedReleaseMetadata

func ManagedReleaseMetadata(dir string) (*DBMetadata, error)

ManagedReleaseMetadata reads the authoritative marker inside the atomically switched data directory. A root-level legacy .db-version is not v3 evidence.

func PackV3

func PackV3(dir, out, approvalsPath string) (*DBMetadata, error)

PackV3 publishes immutable objects, then commits latest.json as the sole mutable release pointer. It never changes the candidate or prunes history.

func PackV3WithRegistry

func PackV3WithRegistry(dir, out, approvalsPath, registrySHA256 string) (*DBMetadata, error)

type DBServer

type DBServer struct {
	// contains filtered or unexported fields
}

DBServer represents the database server

func NewDBServer

func NewDBServer(addr string, nvdStartYear int, verbose bool) *DBServer

NewDBServer creates a new database server instance

func NewDBServerWithRegistry

func NewDBServerWithRegistry(addr string, year int, verbose bool, path, pin string) *DBServer

func (*DBServer) Handler

func (s *DBServer) Handler() http.Handler

Handler returns an isolated mux, also usable by hermetic HTTP tests.

func (*DBServer) Start

func (s *DBServer) Start() error

type DownloadProgress

type DownloadProgress struct {
	Stage      DownloadStage `json:"stage"`
	Version    string        `json:"version,omitempty"`
	Downloaded int64         `json:"downloaded"`
	Total      int64         `json:"total"`
	Percent    float64       `json:"percent"`
	Message    string        `json:"message,omitempty"`
}

DownloadProgress is one observation of an in-flight database download.

type DownloadStage

type DownloadStage string

DownloadStage names the phase a download is in. The UI distinguishes these because extraction of a 91 MB tarball is slow enough that a bar frozen at 100% reads as a hang.

const (
	StageMetadata  DownloadStage = "metadata"
	StageDownload  DownloadStage = "download"
	StageExtract   DownloadStage = "extract"
	StageCompleted DownloadStage = "completed"
)

Download stages, in the order they occur.

type GeoIPSource

type GeoIPSource struct {
	File    string `json:"file"`
	Release string `json:"release"`
	URL     string `json:"url"`
	SHA256  string `json:"sha256"`
	License string `json:"license"`
}

type NVD2

type NVD2 struct {
	ResultsPerPage  int       `json:"resultsPerPage"`
	StartIndex      int       `json:"startIndex"`
	TotalResults    int       `json:"totalResults"`
	Format          string    `json:"format"`
	Version         string    `json:"version"`
	Timestamp       string    `json:"timestamp"`
	Vulnerabilities []nvdItem `json:"vulnerabilities"`
}

type NVDInput

type NVDInput struct {
	Year   int    `json:"year"`
	URL    string `json:"url"`
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
}

type ProgressFunc

type ProgressFunc func(DownloadProgress)

ProgressFunc receives download progress observations. It is called from the downloading goroutine and must not block.

type ReleaseFile

type ReleaseFile struct {
	Path   string `json:"path"`
	Source string `json:"source"`
	SHA256 string `json:"sha256"`
	Size   int64  `json:"size"`
}

type ReleaseManifest

type ReleaseManifest struct {
	Candidate
	Reviews                []ReviewedSource `json:"reviews"`
	ApprovalRegistrySHA256 string           `json:"approval_registry_sha256"`
}

func VerifyCandidate

func VerifyCandidate(dir, approvalsPath string) (ReleaseManifest, error)

VerifyCandidate is shared by generator, nightly and manual publication. approvalsPath is an explicitly supplied, separate reviewed-record file.

type ReleasePayload

type ReleasePayload struct {
	Format          string     `json:"format"`
	Channel         string     `json:"channel"`
	Sequence        uint64     `json:"sequence"`
	IssuedAt        int64      `json:"issued_at"`
	ExpiresAt       int64      `json:"expires_at"`
	PolicySHA256    string     `json:"policy_sha256"`
	Metadata        DBMetadata `json:"metadata"`
	Registry        []byte     `json:"registry"`
	PolicyExpiresAt int64      `json:"policy_expires_at"`
}

type RequiredDB

type RequiredDB struct {
	// File is the basename inside resolvers.DataBaseFolderPath.
	File string
	// Flag is the capture flag that switches this dependency off. A caller
	// that cannot obtain the database can disable the feature instead of
	// failing, which is what keeps analysis possible offline.
	Flag string
	// Feature names the capability lost when the flag is used.
	Feature string
}

RequiredDB describes an enrichment file and the flag that disables its feature.

func MissingDBs

func MissingDBs(selection ...string) []RequiredDB

MissingDBs returns every required and recommended database that is absent, for reporting. Capture flags come from MissingRequiredDBs alone.

func MissingRequiredDBs

func MissingRequiredDBs(selection ...string) []RequiredDB

MissingRequiredDBs returns unavailable files only when no selected pair is usable.

func RecommendedDBs

func RecommendedDBs() []RequiredDB

RecommendedDBs returns a copy of the recommended registry.

func RequiredDBs

func RequiredDBs() []RequiredDB

RequiredDBs returns a copy of the registry.

type ReviewedSource

type ReviewedSource struct {
	Evidence   SourceEvidence `json:"evidence"`
	Outputs    []ReleaseFile  `json:"outputs"`
	Decision   string         `json:"decision"`
	Reviewer   string         `json:"reviewer"`
	ReviewID   string         `json:"review_id"`
	ReviewedAt string         `json:"reviewed_at"`
}

ReviewedSource is supplied separately by an operator's rights-review process. The generator never creates these records. Outputs scope the exact bytes permitted by that review, including derived SQLite and provenance files.

type SignedBytes

type SignedBytes struct {
	Payload   []byte `json:"payload"`
	Signature []byte `json:"signature"`
}

Signatures cover opaque payload bytes; readers never reserialize signed JSON.

type SignedRelease

type SignedRelease struct {
	Certificate SignedBytes `json:"certificate"`
	SignedBytes
}

type SigningKey

type SigningKey struct {
	Format    string `json:"format"`
	PublicKey []byte `json:"public_key"`
	Epoch     uint64 `json:"epoch"`
	NotBefore int64  `json:"not_before"`
	NotAfter  int64  `json:"not_after"`
}

type SourceEvidence

type SourceEvidence struct {
	ID             string     `json:"id"`
	Origin         string     `json:"origin"`
	Revision       string     `json:"revision"`
	SHA256         string     `json:"sha256"`
	Transformation string     `json:"transformation"`
	GrantText      string     `json:"grant_text"`
	GrantSHA256    string     `json:"grant_sha256"`
	NoticeText     string     `json:"notice_text"`
	GrantOrigin    string     `json:"grant_origin"`
	GrantRevision  string     `json:"grant_revision"`
	NVDInputs      []NVDInput `json:"nvd_inputs,omitempty"`
}

SourceEvidence describes the actual snapshot and transformation, without implying that its rights have been reviewed. GrantText must contain the full applicable terms; NoticeText includes copyright and upstream acknowledgements.

type SourcePolicy

type SourcePolicy struct {
	Format                string       `json:"format"`
	ExpiresAt             int64        `json:"expires_at"`
	Rules                 []SourceRule `json:"rules"`
	MinimumNVDCount       int          `json:"minimum_nvd_count"`
	MaximumCurrentFeedAge int64        `json:"max_current_feed_age_seconds"`
}

type SourceRule

type SourceRule struct {
	Evidence       SourceEvidence `json:"evidence"`
	Files          []string       `json:"files"`
	PinnedRevision string         `json:"pinned_revision,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL