model

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2026 License: Apache-2.0 Imports: 8 Imported by: ? 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.

Documentation

Overview

Package model is the TokenHound Finding and Report model: statuses and their classes, confidence, grades, targets, locations, warnings, progress events and the canonical JSON Report (docs/schema/report.v1.json).

It imports only the standard library, so every internal package can share it without importing the public tokenhound package. The tokenhound package re-exports every identifier here with type aliases, so tokenhound.Finding and model.Finding are the same type.

Index

Constants

View Source
const (
	// ReasonIgnoreID: an id: rule of an ignore file names the finding.
	ReasonIgnoreID = "ignore_id"
	// ReasonIgnoreDetector: a detector: rule names the winning detector.
	ReasonIgnoreDetector = "ignore_detector"
	// ReasonIgnorePath: every location is covered, at least one by a path: rule.
	ReasonIgnorePath = "ignore_path"
	// ReasonIgnoreLoc: every location is covered, at least one by a loc: rule.
	ReasonIgnoreLoc = "ignore_loc"
	// ReasonInlineAllow: every location is covered, at least one by an inline
	// tokenhound:allow comment.
	ReasonInlineAllow = "inline_allow"
	// ReasonTestMarker: the key carries the generated test key marker (AD-16).
	ReasonTestMarker = "test_marker"
	// ReasonImportedAllowlist: an imported gitleaks or TruffleHog allowlist entry
	// matched (reserved; no importer sets it yet).
	ReasonImportedAllowlist = "imported_allowlist"
)

Suppression reasons of Finding.SuppressionReason, in precedence order: when several apply, the first one in this order is reported.

View Source
const (
	VerificationOn  = "on"
	VerificationOff = "off"
)

Verification values of Meta.Verification.

View Source
const (
	// SurfaceFound: at least one file of the surface exists and was opened (a file
	// that failed to parse or was too large still counts as found).
	SurfaceFound = "found"
	// SurfaceNotInstalled: no file of the surface exists.
	SurfaceNotInstalled = "not_installed"
	// SurfaceUnreadable: a file of the surface exists but none could be read.
	SurfaceUnreadable = "unreadable"
	// SurfaceNotVisited: the scan stopped (timeout or cancel) before this surface was
	// looked for, so nothing is known about it. It never appears on a completed scan.
	SurfaceNotVisited = "not_visited"
)

Surface statuses.

View Source
const (
	// CodeFileUnreadable is a file that could not be opened or read; the rest of the
	// scan continues.
	CodeFileUnreadable = "file_unreadable"
	// CodeInternalError is an error no other code describes.
	CodeInternalError = "internal_error"
	// CodeReadFailed is a file, blob or stream that could not be read.
	CodeReadFailed = "read_failed"
	// CodeRegistryEntrySkipped is a registry file skipped while the rest loaded.
	CodeRegistryEntrySkipped = "registry_entry_skipped"
	// CodeTimeout is a scan stopped by its timeout with partial results.
	CodeTimeout = "timeout"
	// CodeUntrustedConfigKey is a project-tier config value that was not honoured as
	// written. The detail says why: project_tier (a key only the user tier may set:
	// network.*, alerts.*, hook.*, ping), gate_loosening (verification off, timeout,
	// new_only on, a lower limits.* or verify.timeout, a higher grade.f_threshold_usd_per_day or
	// verify.max_concurrency), project_limit_cap (a limit raised above 4x its
	// default) and fail_on_loosening (a fail_on that would loosen the policy) mean
	// the value was ignored; env_reference means a ${NAME} reference was kept as a
	// literal, not expanded.
	CodeUntrustedConfigKey = "untrusted_config_key"
	// CodeConfigPathOutsideRoot is a project config path that escapes the project
	// root (absolute or with ..); it was ignored.
	CodeConfigPathOutsideRoot = "config_path_outside_root"
	// CodeFileTooLarge is a file or stream larger than limits.max_file_bytes; it was
	// skipped.
	CodeFileTooLarge = "file_too_large"
	// CodeGitNotFound is a scan root inside a git repository that was walked without
	// git, because no git binary was found. Files that .gitignore excludes were not
	// skipped.
	CodeGitNotFound = "git_not_found"
	// CodeDecodeDepthLimit is decoding of a chunk that stopped early: max_depth means
	// a span nested deeper than limits.decode_max_depth was not decoded, size_budget
	// means the decoded bytes of one chunk reached their budget. The rest of the scan
	// continues.
	CodeDecodeDepthLimit = "decode_depth_limit"
	// CodeSurfaceParseFailed is an agent surface file that could not be parsed in
	// full: the detail parse_error means the file is corrupt or malformed (it was
	// skipped), unsupported_format means the surface names a parse format this binary
	// has no parser for yet (skipped), partial_parse means a tolerant parser (dotenv)
	// skipped some lines and read the rest, walk_limit means the search for files stopped
	// at its entry budget, budget means the surface files read so far reached the byte
	// budget and the rest were not read. The scan continues.
	CodeSurfaceParseFailed = "surface_parse_failed"
	// CodeNotebookParseFailed is a .ipynb file in the working tree that is not a
	// readable notebook (not JSON, not an object, no cells array, truncated): the file
	// was scanned as plain text instead, without cell locations. The detail is
	// parse_error. The scan continues.
	CodeNotebookParseFailed = "notebook_parse_failed"
	// CodeBaselineMissing is a run with new_only (--new-only) on and no baseline file
	// at the expected path (the location). Every finding then counts for fail_on: the
	// check fails closed. The detail is not_found.
	CodeBaselineMissing = "baseline_missing"
	// CodeBenchmarkNetworkBlocked is a network request a benchmark build (-tags
	// benchmark) refused before any dial: every purpose but verify is blocked, since
	// verification answers come from ground truth. Default builds never emit it.
	CodeBenchmarkNetworkBlocked = "benchmark_network_blocked"
)

Warning codes. Every code is listed in docs/schema/report.v1.json.

View Source
const (
	// ProviderGeneric is the provider id of findings no provider pattern claims.
	ProviderGeneric = "generic"
	// ProviderGenericName is the display name of ProviderGeneric.
	ProviderGenericName = "Generic"
	// GenericValueClass is the character class of a value the generic detector
	// accepts, as a regex bracket expression valid in Go RE2 and Python re.
	GenericValueClass = "[A-Za-z0-9+/=_.~-]"
	// DetectorGenericHighEntropy is the detector id of the generic entropy detector.
	DetectorGenericHighEntropy = "generic.high-entropy"
	// DetectorGenericHighEntropyName is the pattern name of DetectorGenericHighEntropy.
	DetectorGenericHighEntropyName = "high-entropy"
)

The built-in generic entropy detector. It has no registry entry; the engine adds these provider and detector facts to a Report that references them.

View Source
const BaselineSchemaVersion = 1

BaselineSchemaVersion is the version of the baseline file schema (docs/schema/baseline.v1.json) this model reads and writes.

View Source
const ReasonNotInGroundTruth = "not_in_ground_truth"

ReasonNotInGroundTruth is the status_reason of an unknown finding in a benchmark build (-tags benchmark): the ground truth does not list the credential, so no verify call was made. Default builds never set it. Every status_reason is listed in docs/schema/report.v1.json.

View Source
const SchemaVersion = 1

SchemaVersion is the version of the JSON Report schema (docs/schema/report.v1.json) that this model marshals to.

Variables

This section is empty.

Functions

func SuppressionReasons

func SuppressionReasons() []string

SuppressionReasons returns every suppression reason in precedence order.

func SurfaceRank

func SurfaceRank(status string) int

SurfaceRank orders surface statuses for merging: found beats unreadable beats not_installed beats not_visited. An unknown status ranks lowest.

func WarningCodes

func WarningCodes() []string

WarningCodes returns every documented warning code, sorted.

Types

type Baseline

type Baseline struct {
	SchemaVersion    int               `json:"schema_version"`
	ToolVersion      string            `json:"tool_version"`
	RegistrySnapshot string            `json:"registry_snapshot"`
	Findings         []BaselineFinding `json:"findings"`
}

Baseline is an accepted set of findings (docs/schema/baseline.v1.json), written by `tokenhound baseline` and compared by the suppress stage: a finding whose final id is in it is not new (Finding.NewVsBaseline false). It holds no status, locations, dollars or timestamps, and never more of a key than its redacted form.

func (Baseline) MarshalJSON

func (b Baseline) MarshalJSON() ([]byte, error)

MarshalJSON marshals findings as [] when nil.

type BaselineFinding

type BaselineFinding struct {
	ID       string `json:"id"`
	Provider string `json:"provider"`
	Detector string `json:"detector"`
	Redacted string `json:"redacted"`
}

BaselineFinding is one accepted finding of a Baseline.

type Confidence

type Confidence string

Confidence is how sure detection is that a match is a real key.

const (
	ConfidenceHigh   Confidence = "high"
	ConfidenceMedium Confidence = "medium"
	ConfidenceLow    Confidence = "low"
)

Confidence levels.

func (Confidence) Valid

func (c Confidence) Valid() bool

Valid reports whether c is a known confidence level.

type CredentialPart

type CredentialPart struct {
	// Name is the registry credential part name, for example "access_key_id".
	Name string `json:"name"`
	// Redacted is the display form of the part, for example "AKIAAB...TEST (20)".
	Redacted string `json:"redacted"`
}

CredentialPart is the redacted form of one part of a multi-part credential.

type DetectorInfo

type DetectorInfo struct {
	Provider string `json:"provider"`
	Name     string `json:"name"`
	// RevokeURL is where keys of this detector are revoked, when it differs from the
	// provider's RevokeURL (the registry pattern fix.revoke_url).
	RevokeURL string `json:"revoke_url,omitempty"`
	// EnvVar is the environment variable keys of this detector belong in, when it
	// differs from the provider's EnvVar (the registry pattern fix.env_vars[0]).
	EnvVar string `json:"env_var,omitempty"`
	// NoEnvVar is true when keys of this detector belong in no environment variable
	// (a browser session key), so the provider's EnvVar does not apply.
	NoEnvVar bool `json:"no_env_var,omitempty"`
}

DetectorInfo describes a detector referenced by a finding.

type DollarsMethod

type DollarsMethod struct {
	// Formula is the arithmetic applied, as text.
	Formula string `json:"formula"`
	// Tier is the spend registry tier id the figure uses.
	Tier string `json:"tier"`
	// TierSource is "verified" when verification saw the tier, else "default".
	TierSource string `json:"tier_source"`
	// Assumed is true when the tier is the registry default, not one verification saw.
	Assumed bool `json:"assumed"`
	// LimitPerMin is the rate limit in LimitUnit per minute.
	LimitPerMin int64 `json:"limit_per_min"`
	// LimitSource is "verified" when LimitPerMin came from verify_evidence.limits,
	// else "tier".
	LimitSource string `json:"limit_source"`
	// LimitUnit is "tokens" or "requests".
	LimitUnit string `json:"limit_unit"`
	// UnitPriceUSD is the price of PriceUnitSize limit units.
	UnitPriceUSD USD `json:"unit_price_usd"`
	// PriceUnitSize is how many limit units UnitPriceUSD buys (1000000 for token
	// prices written per million tokens).
	PriceUnitSize int64 `json:"price_unit_size"`
	// Model is the most expensive model the tier reaches.
	Model string `json:"model"`
	// CapUSDPerDay is the tier spend cap, when the registry knows one.
	CapUSDPerDay *USD `json:"cap_usd_per_day,omitempty"`
	// SpendAsOf is the date of the spend registry figures, YYYY-MM-DD.
	SpendAsOf string `json:"spend_as_of"`
}

DollarsMethod lists the inputs behind a dollars-at-risk figure, so a reader can check or challenge it.

type Event

type Event struct {
	Kind     EventKind `json:"kind"`
	ID       string    `json:"id"`
	Provider string    `json:"provider"`
	Detector string    `json:"detector"`
	Redacted string    `json:"redacted"`
	Location *Location `json:"location,omitempty"`
}

Event is a scan progress event. It carries the redacted form of a key only, never key material. Location is the sighting that caused the event, when there is one.

type EventKind

type EventKind string

EventKind is the kind of a scan progress event.

const (
	// EventFindingDetected is sent the first time a credential is seen.
	EventFindingDetected EventKind = "finding-detected"
	// EventLocationAdded is sent for every later sighting of a known credential.
	EventLocationAdded EventKind = "location-added"
	// EventStatusUpdated is sent when verification changes a finding's status.
	EventStatusUpdated EventKind = "status-updated"
)

Event kinds.

type Finding

type Finding struct {
	// ID is the fingerprint "th_" plus 16 lowercase hex characters.
	ID            string     `json:"id"`
	Provider      string     `json:"provider"`
	Detector      string     `json:"detector"`
	AlsoMatchedBy []string   `json:"also_matched_by,omitempty"`
	Confidence    Confidence `json:"confidence"`
	// Redacted is the display form, for example "sk-pro...a1b2 (51)".
	Redacted string `json:"redacted"`
	// CredentialParts are the redacted forms of every part of a multi-part credential,
	// in registry part order; empty for a single-part key.
	CredentialParts   []CredentialPart `json:"credential_parts,omitempty"`
	Locations         []Location       `json:"locations"`
	Suppressed        bool             `json:"suppressed"`
	SuppressionReason string           `json:"suppression_reason,omitempty"`
	NewVsBaseline     *bool            `json:"new_vs_baseline,omitempty"`
	Status            Status           `json:"status"`
	StatusReason      string           `json:"status_reason,omitempty"`
	Verified          bool             `json:"verified"`
	VerifyEvidence    *VerifyEvidence  `json:"verify_evidence,omitempty"`
	Tier              string           `json:"tier,omitempty"`
	Scopes            []string         `json:"scopes,omitempty"`
	Org               string           `json:"org,omitempty"`
	FirstSeen         *FirstSeen       `json:"first_seen,omitempty"`
	AgeDays           *int             `json:"age_days,omitempty"`
	// DollarsAtRiskPerDay is set for verified keys; dead keys carry 0.
	DollarsAtRiskPerDay *USD `json:"dollars_at_risk_per_day,omitempty"`
	// PotentialDollarsAtRiskPerDay is set for unverified keys and never graded.
	PotentialDollarsAtRiskPerDay *USD           `json:"potential_dollars_at_risk_per_day,omitempty"`
	DollarsMethod                *DollarsMethod `json:"dollars_method,omitempty"`
	FixPlan                      *FixPlan       `json:"fix_plan,omitempty"`
}

Finding is one unique credential with every place it was seen. It never holds key material: only the redacted form.

func (Finding) MarshalJSON

func (f Finding) MarshalJSON() ([]byte, error)

MarshalJSON marshals locations as [] when nil.

type FirstSeen

type FirstSeen struct {
	Commit string    `json:"commit"`
	Author string    `json:"author"`
	Date   Timestamp `json:"date"`
}

FirstSeen is the earliest commit that introduced a key.

type FixKind

type FixKind string

FixKind is the kind of a fix plan step.

const (
	FixRevoke      FixKind = "revoke"
	FixReplace     FixKind = "replace"
	FixPurge       FixKind = "purge"
	FixCheckUsage  FixKind = "check_usage"
	FixScopeKeeper FixKind = "scopekeeper"
)

Fix step kinds, in plan order. The set is closed.

func (FixKind) Valid

func (k FixKind) Valid() bool

Valid reports whether k is a known fix step kind.

type FixPlan

type FixPlan struct {
	Steps []FixStep `json:"steps"`
}

FixPlan is the ordered list of steps to contain a finding.

func (FixPlan) MarshalJSON

func (p FixPlan) MarshalJSON() ([]byte, error)

MarshalJSON marshals steps as [] when nil.

type FixStep

type FixStep struct {
	// N is the 1-based step number.
	N     int     `json:"n"`
	Kind  FixKind `json:"kind"`
	Title string  `json:"title"`
	// Detail is plain text; lines are separated by "\n".
	Detail  string `json:"detail,omitempty"`
	URL     string `json:"url,omitempty"`
	Command string `json:"command,omitempty"`
	// Locations are the places the step applies to, in Report location order.
	Locations []Location `json:"locations,omitempty"`
}

FixStep is one fix plan step. It holds links and commands only, never key material beyond the redacted form.

type Grade

type Grade string

Grade is an A to F exposure grade for a target or the whole report.

const (
	GradeA Grade = "A"
	GradeB Grade = "B"
	GradeC Grade = "C"
	GradeD Grade = "D"
	GradeF Grade = "F"
)

Grades, best to worst.

func (Grade) Valid

func (g Grade) Valid() bool

Valid reports whether g is a known grade.

type IgnoreKind

type IgnoreKind string

IgnoreKind is the kind of an ignore rule.

const (
	// IgnorePath matches locations whose path matches a glob (location-level).
	IgnorePath IgnoreKind = "path"
	// IgnoreID matches a finding by its id (finding-level).
	IgnoreID IgnoreKind = "id"
	// IgnoreDetector matches a finding by its winning detector (finding-level).
	IgnoreDetector IgnoreKind = "detector"
	// IgnoreLoc matches locations by exact path and line (location-level).
	IgnoreLoc IgnoreKind = "loc"
)

Ignore rule kinds (docs/schema/ignore.v1.md).

func (IgnoreKind) Valid

func (k IgnoreKind) Valid() bool

Valid reports whether k is a known ignore rule kind.

type IgnoreRule

type IgnoreRule struct {
	Kind       IgnoreKind  `json:"kind"`
	Pattern    string      `json:"pattern"`
	Line       int         `json:"line,omitempty"`
	Scope      IgnoreScope `json:"scope"`
	Source     string      `json:"source,omitempty"`
	SourceLine int         `json:"source_line,omitempty"`
}

IgnoreRule is one parsed ignore rule. Pattern is the forward-slash glob of a path rule (relative to the scan root, "~/"-prefixed for the machine scope), the exact path of a loc rule, the id of an id rule or the detector id of a detector rule. Line is the line of a loc rule. Source and SourceLine say where the rule was written, for display only.

type IgnoreScope

type IgnoreScope string

IgnoreScope says which locations the path: and loc: rules of an ignore file match.

const (
	// IgnoreScopeProject rules match locations whose target is not the machine.
	IgnoreScopeProject IgnoreScope = "project"
	// IgnoreScopeMachine rules (the user-tier ignore file) match machine locations.
	IgnoreScopeMachine IgnoreScope = "machine"
)

Ignore scopes.

func (IgnoreScope) Valid

func (s IgnoreScope) Valid() bool

Valid reports whether s is a known ignore scope.

type Location

type Location struct {
	Target Target       `json:"target"`
	Kind   LocationKind `json:"kind"`
	// Path uses forward slashes; machine paths start with "~/" (or with
	// "$CLAUDE_CONFIG_DIR/" for Claude Code files moved outside the home directory)
	// and archive members are joined with "!/".
	Path      string    `json:"path"`
	Line      int       `json:"line,omitempty"`
	Column    int       `json:"column,omitempty"`
	Commit    string    `json:"commit,omitempty"`
	Author    string    `json:"author,omitempty"`
	Date      Timestamp `json:"date,omitzero"`
	Branch    string    `json:"branch,omitempty"`
	Layer     string    `json:"layer,omitempty"`
	SurfaceID string    `json:"surface_id,omitempty"`
	Field     string    `json:"field,omitempty"`
	Cell      int       `json:"cell,omitempty"`
}

Location is one place a finding was seen. It never carries file content. Line, Column and Cell are 1-based and omitted when 0.

type LocationKind

type LocationKind string

LocationKind is where in a target a finding was seen.

const (
	LocationFile     LocationKind = "file"
	LocationStaged   LocationKind = "staged"
	LocationCommit   LocationKind = "commit"
	LocationImage    LocationKind = "image"
	LocationArchive  LocationKind = "archive"
	LocationNotebook LocationKind = "notebook"
	LocationSurface  LocationKind = "surface"
	LocationStdin    LocationKind = "stdin"
)

Location kinds.

func (LocationKind) Valid

func (k LocationKind) Valid() bool

Valid reports whether k is a known location kind.

type Meta

type Meta struct {
	SchemaVersion    int       `json:"schema_version"`
	ToolVersion      string    `json:"tool_version"`
	RegistrySnapshot string    `json:"registry_snapshot"`
	GeneratedAt      Timestamp `json:"generated_at"`
	DurationMS       int64     `json:"duration_ms"`
	// FilesScanned counts the files and streams whose content reached detection.
	FilesScanned int `json:"files_scanned"`
	// Verification is "on" when keys were verified with read-only calls and "off"
	// when the run was offline (--no-verify); empty when unknown.
	Verification string `json:"verification,omitempty"`
	// HistoryScanned is true when git history was scanned.
	HistoryScanned bool `json:"history_scanned,omitempty"`
	// CommitsScanned counts the commits of the scanned history.
	CommitsScanned int `json:"commits_scanned,omitempty"`
	// BinarySkipped counts the files skipped because a NUL byte appears in their first
	// 8 KiB. They are not warnings and do not count in FilesScanned.
	BinarySkipped int `json:"binary_skipped,omitempty"`
	// PathPrefix is the slash path of the scan root relative to the top level of its
	// git work tree ("sub/dir" for `scan sub/dir`), so file Location paths, which are
	// relative to the scan root, can be turned into repository paths. Empty (omitted)
	// at the top level, outside git or without a path source.
	PathPrefix string `json:"path_prefix,omitempty"`
}

Meta describes the run that produced a Report.

type ProviderInfo

type ProviderInfo struct {
	Name      string `json:"name"`
	RevokeURL string `json:"revoke_url,omitempty"`
	RotateDoc string `json:"rotate_doc,omitempty"`
	// VerifyHost is the host a read-only verification call goes to ("*" marks a
	// templated label), for providers that have a verify block.
	VerifyHost string `json:"verify_host,omitempty"`
	// VerifyNote says in one short phrase how keys are checked, for example
	// "read-only GET call to api.openai.com (models)".
	VerifyNote string `json:"verify_note,omitempty"`
	// EnvVar is the conventional environment variable that holds the provider's key
	// (the registry's first env_vars entry), for messages that suggest where a key
	// belongs.
	EnvVar string `json:"env_var,omitempty"`
}

ProviderInfo describes a provider referenced by a finding, so a Report is self-sufficient.

type Report

type Report struct {
	Meta    Meta     `json:"meta"`
	Targets []Target `json:"targets"`
	// Providers and Detectors are keyed by id and hold every id a finding references.
	Providers    map[string]ProviderInfo `json:"providers"`
	Detectors    map[string]DetectorInfo `json:"detectors"`
	Findings     []Finding               `json:"findings"`
	Warnings     []Warning               `json:"warnings"`
	Grades       []TargetGrade           `json:"grades"`
	Grade        Grade                   `json:"grade"`
	GradeReasons []string                `json:"grade_reasons"`
	// SurfacesChecked lists every agent surface a surface scan looked at and whether
	// its files were there. It is omitted when no surface was scanned, so Reports of
	// other scans do not change.
	SurfacesChecked []SurfaceStatus `json:"surfaces_checked,omitempty"`
}

Report is the canonical result of a scan.

func (*Report) EnvVarOf

func (r *Report) EnvVarOf(id, provider string) string

EnvVarOf returns the environment variable keys of detector id belong in: the detector's own, none when the detector says so, else the provider's (provider is the finding's provider, used when the detector is not in the Report).

func (Report) MarshalJSON

func (r Report) MarshalJSON() ([]byte, error)

MarshalJSON marshals nil arrays as [] and nil maps as {}.

func (*Report) RevokeURLOf

func (r *Report) RevokeURLOf(id string) string

RevokeURLOf returns the revoke URL of keys of detector id: the detector's own, else its provider's, else "".

type Status

type Status string

Status is the verification status of a finding.

const (
	StatusLive        Status = "live"
	StatusDead        Status = "dead"
	StatusUnknown     Status = "unknown"
	StatusRateLimited Status = "rate-limited"
	StatusNotVerified Status = "not-verified"
)

Verification statuses.

func (Status) Class

func (s Status) Class() StatusClass

Class returns the class of s, or "" when s is not a known status.

func (Status) Valid

func (s Status) Valid() bool

Valid reports whether s is a known status.

type StatusClass

type StatusClass string

StatusClass groups statuses for ranking, grading and fail_on.

const (
	ClassLive       StatusClass = "live"
	ClassUnverified StatusClass = "unverified"
	ClassDead       StatusClass = "dead"
)

Status classes. Unverified covers not-verified, unknown and rate-limited.

type SurfaceStatus

type SurfaceStatus struct {
	// SurfaceID is the registry id of the surface, for example "codex".
	SurfaceID string `json:"surface_id"`
	// Status is SurfaceFound, SurfaceNotInstalled, SurfaceUnreadable or SurfaceNotVisited.
	Status string `json:"status"`
}

SurfaceStatus is the outcome of looking for one agent surface.

type Target

type Target struct {
	Kind       TargetKind `json:"kind"`
	ID         string     `json:"id"`
	Visibility Visibility `json:"visibility"`
}

Target is one scanned thing: a repo, this machine, an image, an org repo or stdin.

type TargetGrade

type TargetGrade struct {
	Target  Target   `json:"target"`
	Grade   Grade    `json:"grade"`
	Reasons []string `json:"reasons"`
}

TargetGrade is the grade of one target with the reasons that set it.

func (TargetGrade) MarshalJSON

func (g TargetGrade) MarshalJSON() ([]byte, error)

MarshalJSON marshals reasons as [] when nil.

type TargetKind

type TargetKind string

TargetKind is the kind of thing a scan target is.

const (
	TargetRepo    TargetKind = "repo"
	TargetMachine TargetKind = "machine"
	TargetImage   TargetKind = "image"
	TargetOrgRepo TargetKind = "org-repo"
	TargetStdin   TargetKind = "stdin"
)

Target kinds.

func (TargetKind) Valid

func (k TargetKind) Valid() bool

Valid reports whether k is a known target kind.

type Timestamp

type Timestamp time.Time

Timestamp is a point in time that marshals as RFC 3339 in UTC with whole seconds, for example "2026-11-13T00:00:00Z".

func (Timestamp) IsZero

func (t Timestamp) IsZero() bool

IsZero reports whether t is the zero time.

func (Timestamp) MarshalJSON

func (t Timestamp) MarshalJSON() ([]byte, error)

MarshalJSON marshals t as an RFC 3339 UTC string with whole seconds.

func (Timestamp) Time

func (t Timestamp) Time() time.Time

Time returns t as a time.Time in UTC, truncated to whole seconds.

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(b []byte) error

UnmarshalJSON reads any RFC 3339 string and keeps it in UTC with whole seconds.

type USD

type USD float64

USD is an amount in US dollars. It marshals as a JSON number with exactly two decimals, rounded half away from zero.

func (USD) MarshalJSON

func (u USD) MarshalJSON() ([]byte, error)

MarshalJSON marshals u with exactly two decimals. Negative amounts are an error: every money field in the report schema has minimum 0. Negative zero marshals as 0.00.

type VerifyEvidence

type VerifyEvidence struct {
	Tier    string            `json:"tier,omitempty"`
	Org     string            `json:"org,omitempty"`
	Project string            `json:"project,omitempty"`
	Scopes  []string          `json:"scopes,omitempty"`
	Limits  map[string]string `json:"limits,omitempty"`
}

VerifyEvidence is what a live verification response revealed.

type Visibility

type Visibility string

Visibility is whether a target is publicly readable.

const (
	VisibilityPublic  Visibility = "public"
	VisibilityPrivate Visibility = "private"
	VisibilityUnknown Visibility = "unknown"
)

Visibilities.

func (Visibility) Valid

func (v Visibility) Valid() bool

Valid reports whether v is a known visibility.

type Warning

type Warning struct {
	Code       string `json:"code"`
	Location   string `json:"location"`
	DetailCode string `json:"detail_code"`
}

Warning is a non-fatal problem in the AD-3 shape: a documented code, a location and a detail code. It never carries error text or file content. Build warnings from errors with internal/warnx.

Jump to

Keyboard shortcuts

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