Documentation
¶
Index ¶
- Constants
- func ApproveCandidate(dir, policyPath, policyPin, registryPath string, previousCount int) error
- func BuildCandidate(root string, startYear int) (string, error)
- func BuildVulnDB(buildPath, outDir string, nvdStart int, verbose bool) error
- func CandidateFiles() map[string]string
- func CommunitySigningRoot() (ed25519.PublicKey, error)
- func DisableFlagsForMissingDBs(selection ...string) []string
- func DownloadDBs(serverURL string, force bool) error
- func DownloadDBsWithProgress(serverURL string, force bool, progress ProgressFunc) error
- func DownloadDBsWithRegistry(serverURL string, force bool, progress ProgressFunc, path, pin string) error
- func DownloadGeoLite() error
- func GenerateDBs(startYear int) error
- func GenerateDBsWithApprovals(startYear int, approvalsPath string) error
- func GenerateDBsWithRegistry(startYear int, approvalsPath, registrySHA256 string) error
- func GenerateSigningKeys(dir string) error
- func ListAvailableVersions(serverURL string) error
- func RotateSigningKey(rootPath, output string, epoch uint64) error
- func SignPublication(meta DBMetadata, registryPath, policyPath, keyPath, certPath, output string, ...) error
- func UpdateDBs() error
- func VerifyV3Archive(path string, meta *DBMetadata) error
- func WriteCandidate(dir string, evidence []SourceEvidence) error
- type Candidate
- type DBMetadata
- type DBServer
- type DownloadProgress
- type DownloadStage
- type GeoIPSource
- type NVD2
- type NVDInput
- type ProgressFunc
- type ReleaseFile
- type ReleaseManifest
- type ReleasePayload
- type RequiredDB
- type ReviewedSource
- type SignedBytes
- type SignedRelease
- type SigningKey
- type SourceEvidence
- type SourcePolicy
- type SourceRule
Constants ¶
const ( V3Layout = 3 VulnDBSchema = vulndb.SchemaVersion CandidateFile = "SOURCE_CANDIDATE.json" ManifestFile = "RELEASE_MANIFEST.json" )
const ( ApprovalRegistryEnv = "NC_DBS_APPROVALS" ApprovalRegistryPinEnv = "NC_DBS_APPROVALS_SHA256" )
const Layout = V3Layout
Layout is the current reviewed database distribution format.
Variables ¶
This section is empty.
Functions ¶
func ApproveCandidate ¶
ApproveCandidate evaluates operator-reviewed policies, never inferred grants. The resulting record states automation as its reviewer and binds exact outputs.
func BuildCandidate ¶
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 ¶
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 ¶
CandidateFiles is a copy of the positive publication policy. Presence here permits review; it is not a redistribution grant.
func CommunitySigningRoot ¶
CommunitySigningRoot returns the existing public trust anchor for separately scoped optional channels.
func DisableFlagsForMissingDBs ¶
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 ¶
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 GenerateDBsWithRegistry ¶
func GenerateSigningKeys ¶
GenerateSigningKeys writes an offline root and a separately deployable signer. Existing keys are never overwritten. The serving container needs neither key.
func ListAvailableVersions ¶
ListAvailableVersions lists all available database versions from the server
func RotateSigningKey ¶
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 ¶
NewDBServer creates a new database server instance
func NewDBServerWithRegistry ¶
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 ProgressFunc ¶
type ProgressFunc func(DownloadProgress)
ProgressFunc receives download progress observations. It is called from the downloading goroutine and must not block.
type ReleaseFile ¶
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.
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 ¶
Signatures cover opaque payload bytes; readers never reserialize signed JSON.
type SignedRelease ¶
type SignedRelease struct {
Certificate SignedBytes `json:"certificate"`
SignedBytes
}
type SigningKey ¶
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"`
}
Source Files
¶
- community_registry_generated.go
- dbip.go
- download.go
- enrichment_root.go
- generate.go
- geolite.go
- hassh.go
- index.go
- notices.go
- nvd.go
- nvd_provenance.go
- required.go
- server.go
- signed.go
- signed_download.go
- signed_server.go
- signing_root.go
- source_policy.go
- tarball.go
- update.go
- utils.go
- v3_archive.go
- v3_build.go
- v3_download.go
- v3_nvd.go
- v3_policy.go
- v3_trust.go