schemas

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package schemas ports every pydantic model and enum SEC-AF exchanges over a JSON boundary: `src/sec_af/schemas/*.py` (compliance, gates, hunt, input, output, prove, recon, views) plus `PolicyEvalResult` from `src/sec_af/policies.py`, which `evaluate_policy` hands to `app.harness(schema=...)`.

Parity rules (docs/DESIGN.md §0.2, §2, §3)

Struct name == pydantic class name, json tag == pydantic field name, and Go field declaration order == Python field declaration order (encoding/json emits struct fields in declaration order, so a marshaled Go value reproduces `model_dump()`'s key order exactly — the parity test in model_keys_test.go asserts the ordered key list, not just the set).

NO `omitempty` anywhere. Python reasoners return `model_dump()`, which emits every field including the ones that are None. Where Python uses `model_dump(exclude_none=True)` the call site drops nulls through afx.DropNulls; it is never a property of the struct.

`Optional[X]` / `X | None` maps to a Go pointer (`*string`, `*int`, `*float64`, `*bool`, `*SomeModel`) so an unset value marshals to JSON null exactly as pydantic does. The two exceptions are `list[X] | None` and `dict[K, V] | None`: a nil Go slice/map already marshals to null and a non-nil empty one to `[]` / `{}`, which is precisely the pydantic behavior, so those stay plain slices/maps (a pointer would only add a second nil to reason about).

Default seeding (the pr-af `schemas/defaults.go` pattern)

Go's json.Unmarshal leaves an absent key at the Go zero value; pydantic fills the declared default. Every struct with at least one non-zero pydantic default therefore gets, in defaults.go:

  • an exported constructor `NewX() X` returning the pydantic-default value. Use it whenever Go code BUILDS an X — a zero-value `X{}` marshals `default_factory=list` fields as `null` where pydantic emits `[]`, and misses the non-zero scalar defaults (`AuditInput.Depth == "standard"`, `ArchitectureMapRaw.AppType == "unknown"`, …).
  • an `UnmarshalJSON` that seeds `NewX()` before decoding, so an absent key keeps the default while a present key — `false`, `0`, `""` — overrides it.

An explicit `null` is the ONE case seeding cannot get right on its own, and it goes the other way: encoding/json treats a null as a no-op for a scalar and as ZERO-THE-VALUE for a slice/map/pointer, so `{"findings": null}` binds cleanly AND wipes the seeded `[]`, emitting `"findings": null` — a shape pydantic can never produce for a non-Optional field (`HuntResult(findings= None)` raises). Only `X | None` fields accept a null, plus the handful of required fields whose `mode="before"` validator maps None onto a value (`DataFlowTrace.source` -> "unknown"). That distinction is generated ground truth (`accepts_null` in testdata/model_keys.json) and is enforced one layer up, by internal/phases' checked binders — so `afx.Bind[X](map)` alone is NOT `X.model_validate(dict)`; `phases.BindX` is.

The `type alias X` trick inside each UnmarshalJSON strips X's methods so the inner json.Unmarshal does not recurse; nested field types keep their own UnmarshalJSON and therefore their own seeding.

Models whose every field is required or zero-defaulted have no constructor and no UnmarshalJSON — their zero value already matches pydantic. The parity test enumerates all 80 distinct models and fails if one that needs seeding lacks it.

`default_factory=lambda: str(uuid4())` fields (`RawFinding.ID`, `RawFinding.Fingerprint`, `PotentialChain.ChainID`, `SecretFinding.ID`, `MisconfigFinding.ID`, `VerifiedFinding.ID`) are seeded by the constructors with a fresh RFC 4122 v4 string from NewUUID4 (uuid.go, crypto/rand — the port takes no new third-party dependency). They are deliberately NOT seeded in UnmarshalJSON: decoding is how a value crosses a reasoner boundary, and a payload that omits `id` should not silently mint a NEW identity on every hop. Python has the same hazard; the live path always carries the field.

Enums

Python's `class X(str, Enum)` maps to `type X string` with one constant per member; `class EvidenceLevel(IntEnum)` maps to `type EvidenceLevel int`. Each has `Valid()` and a `ParseX` helper. Note that `HuntStrategy` has a value alias — Python's `LOGIC_BUGS = "business_logic"` is the SAME member as `BUSINESS_LOGIC`, not a distinct one (`HuntStrategy.LOGIC_BUGS is HuntStrategy.BUSINESS_LOGIC` is True) — so Go declares both constants with the same value and `AllHuntStrategies` lists the value once.

Python parity: `str(Severity.HIGH)` is "Severity.HIGH", not "high" (3.11 Enum.__str__ on a str mixin), while `str(EvidenceLevel.FULL_EXPLOIT)` is "6" (3.11 IntEnum.__str__ == int.__str__). Go's string/int enums print their value, so any prompt builder that interpolates an enum must use `.value` / `int(...)` on the Python side to match — none of the ported prompt builders interpolate a bare enum member.

Name collisions

`prove.py` re-declares `Location`, `CvssV4Score`, `EpssScore` and `ReproductionStep` byte-identically to `output.py`; the Go package keeps one struct each (declared in output.go, which is what `schemas/__init__.py` re-exports) and the parity test asserts both Python declarations really do have the same shape. `recon.DataFlowStep` and `prove.DataFlowStep` are DIFFERENT models sharing a name; Go follows `schemas/__init__.py`, which re-exports prove's as `DataFlowStep` and recon's as `ReconDataFlowStep`.

Index

Constants

This section is empty.

Variables

AllConfidences lists every Confidence in Python declaration order.

AllEvidenceLevels lists every EvidenceLevel in Python declaration order.

AllFindingTypes lists every FindingType in Python declaration order.

AllHuntStrategies lists every distinct HuntStrategy value in Python declaration order — i.e. `[s.value for s in HuntStrategy]`, which excludes the LOGIC_BUGS alias.

AllSeverities lists every Severity in Python declaration order.

AllVerdicts lists every Verdict in Python declaration order.

Functions

func Interruption

func Interruption(metadata map[string]any) string

Interruption is a global stop after a partial result was produced. It is separate from hunt coverage because a ceiling or refusal can arrive later.

func NewUUID4

func NewUUID4() string

NewUUID4 returns a random RFC 4122 version-4 UUID in the canonical 8-4-4-4-12 lowercase hex form, e.g. "1b4e28ba-2fa1-4d1d-883f-9e0d5a1e0f2b".

Ports Python's `default_factory=lambda: str(uuid4())` (schemas/hunt.py, schemas/recon.py, schemas/prove.py). The port takes no new third-party dependency (docs/DESIGN.md §0.6), so this builds the value from crypto/rand directly: 16 random bytes with the version nibble forced to 4 and the variant bits forced to 10xx, exactly as CPython's `uuid.uuid4()` does.

It panics only if the system CSPRNG fails, which crypto/rand documents as unrecoverable — the same posture as `uuid.uuid4()`, which has no failure mode a caller could act on.

Types

type APIEndpoint

type APIEndpoint struct {
	Method       string `json:"method"`
	Path         string `json:"path"`
	Handler      string `json:"handler"`
	FilePath     string `json:"file_path"`
	Line         int    `json:"line"`
	AuthRequired *bool  `json:"auth_required"`
	RateLimited  *bool  `json:"rate_limited"`
}

APIEndpoint is one exposed API surface entry (DESIGN.md §4.3).

Ports schemas/recon.py APIEndpoint.

type ArchitectureMap

type ArchitectureMap struct {
	AppType         *string         `json:"app_type"`
	Modules         []Module        `json:"modules"`
	EntryPoints     []EntryPoint    `json:"entry_points"`
	TrustBoundaries []TrustBoundary `json:"trust_boundaries"`
	Services        []Service       `json:"services"`
	APISurface      []APIEndpoint   `json:"api_surface"`
}

ArchitectureMap is the architecture mapper output (DESIGN.md §4.3).

Ports schemas/recon.py ArchitectureMap. Seeded (defaults.go): all five list fields default to `[]`.

func NewArchitectureMap

func NewArchitectureMap() ArchitectureMap

NewArchitectureMap returns ArchitectureMap's pydantic defaults (five empty lists; app_type stays nil).

func (*ArchitectureMap) UnmarshalJSON

func (a *ArchitectureMap) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ArchitectureMap's five list defaults.

type ArchitectureMapRaw

type ArchitectureMapRaw struct {
	// AppType is one of: web_api, cli_tool, library, microservice, monolith.
	AppType string `json:"app_type"`
	// Modules: one string per module, "name | path | language | description".
	Modules []string `json:"modules"`
	// EntryPoints: "kind | route_or_id | file_path:line | auth_required".
	EntryPoints []string `json:"entry_points"`
	// TrustBoundaries: "name | source_zone | target_zone | description".
	TrustBoundaries []string `json:"trust_boundaries"`
	// Services: "name | type | endpoint | auth_mechanism".
	Services []string `json:"services"`
	// APIEndpoints: "method | path | handler | file_path:line | auth_required | rate_limited".
	APIEndpoints []string `json:"api_endpoints"`
}

ArchitectureMapRaw is the flat harness output for the architecture mapper.

Ports schemas/recon.py ArchitectureMapRaw. Seeded (defaults.go): app_type="unknown", all five list fields `[]`.

func NewArchitectureMapRaw

func NewArchitectureMapRaw() ArchitectureMapRaw

NewArchitectureMapRaw returns ArchitectureMapRaw's pydantic defaults (app_type="unknown", five empty lists).

func (*ArchitectureMapRaw) UnmarshalJSON

func (a *ArchitectureMapRaw) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ArchitectureMapRaw's defaults.

type AttackChain

type AttackChain struct {
	ChainID            string         `json:"chain_id"`
	Title              string         `json:"title"`
	Description        string         `json:"description"`
	Findings           []string       `json:"findings"`
	CombinedSeverity   Severity       `json:"combined_severity"`
	CombinedImpact     string         `json:"combined_impact"`
	MitreAttackMapping []MitreMapping `json:"mitre_attack_mapping"`
}

AttackChain is a verified multi-step exploit chain (DESIGN.md §7.2).

Ports schemas/output.py AttackChain. Seeded (defaults.go): findings `[]`. `mitre_attack_mapping` is `list[MitreMapping] | None` with NO default_factory, so a nil Go slice marshaling to null is exactly right.

func NewAttackChain

func NewAttackChain() AttackChain

NewAttackChain returns AttackChain's pydantic defaults (findings=[]).

func (*AttackChain) UnmarshalJSON

func (a *AttackChain) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds AttackChain.Findings=[].

type AuditInput

type AuditInput struct {
	// RepoURL is the git repository URL to audit. REQUIRED.
	RepoURL string `json:"repo_url"`
	// Branch to audit.
	Branch string `json:"branch"`
	// CommitSha to audit.
	CommitSha *string `json:"commit_sha"`
	// BaseCommitSha is the base commit for diff-aware PR scanning.
	BaseCommitSha *string `json:"base_commit_sha"`
	// Depth is the scan depth profile: quick|standard|thorough.
	Depth string `json:"depth"`
	// SeverityThreshold is the minimum severity to report:
	// critical|high|medium|low|info.
	SeverityThreshold    string   `json:"severity_threshold"`
	ScanTypes            []string `json:"scan_types"`
	OutputFormats        []string `json:"output_formats"`
	ComplianceFrameworks []string `json:"compliance_frameworks"`
	// MaxCostUsd is the budget cap in USD.
	MaxCostUsd *float64 `json:"max_cost_usd"`
	// MaxProvers caps parallel provers.
	MaxProvers *int `json:"max_provers"`
	// MaxDurationSeconds caps execution time.
	MaxDurationSeconds *int `json:"max_duration_seconds"`
	// IncludePaths restricts the scan to these repository paths.
	IncludePaths []string `json:"include_paths"`
	ExcludePaths []string `json:"exclude_paths"`
	// IsPr reports whether the scan is for a pull request.
	IsPr bool `json:"is_pr"`
	// PrID is the pull request identifier.
	PrID *string `json:"pr_id"`
	// PostPrComments posts findings as PR comments.
	PostPrComments bool `json:"post_pr_comments"`
	// FailOnFindings returns a non-zero status for CI gating.
	FailOnFindings bool `json:"fail_on_findings"`
	// DastEnabled turns on DAST-like runtime exploit verification (sandbox).
	DastEnabled bool `json:"dast_enabled"`
	// RepoUrls are additional repository URLs for cross-service analysis.
	RepoUrls []string `json:"repo_urls"`
	// MonitoringMode enables continuous monitoring (compare against baseline).
	MonitoringMode bool `json:"monitoring_mode"`
	// BaselinePath points at baseline scan results for regression detection.
	BaselinePath *string `json:"baseline_path"`
	// CustomPolicies are org-specific security policy rules to evaluate,
	// e.g. 'All endpoints must require authentication'.
	CustomPolicies []string `json:"custom_policies"`
}

AuditInput is the input for a `sec-af.audit` execution (DESIGN.md §8.2).

Ports schemas/input.py AuditInput. Seeded (defaults.go): branch="main", depth="standard", severity_threshold="low", scan_types=["sast","sca","secrets","config"], output_formats=["json"], exclude_paths=["tests/","vendor/","node_modules/",".git/"], and compliance_frameworks / repo_urls / custom_policies `[]`.

`repo_url` is the only REQUIRED field — binding a payload without it must fail (ported from tests/test_schemas.py::test_schema_validation_and_required_fields); see Validate.

func NewAuditInput

func NewAuditInput() AuditInput

NewAuditInput returns AuditInput's pydantic defaults: branch="main", depth="standard", severity_threshold="low", scan_types=["sast","sca","secrets","config"], output_formats=["json"], exclude_paths=["tests/","vendor/","node_modules/",".git/"], and empty compliance_frameworks / repo_urls / custom_policies.

func (*AuditInput) UnmarshalJSON

func (a *AuditInput) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds AuditInput's pydantic defaults before decoding, so afx.Bind[AuditInput](payload) behaves like AuditInput.model_validate(payload).

func (AuditInput) Validate

func (a AuditInput) Validate() error

Validate reproduces the one required-field constraint pydantic enforces on AuditInput: `repo_url` has no default, so `AuditInput(branch="main")` raises ValidationError. Go's json.Unmarshal cannot express "required", so the binding call site calls Validate.

Python parity: this is the ONLY constraint on AuditInput — the schema declares no ge/le bounds and no Literal, so depth / severity_threshold / scan_types are free-form strings validated (or not) downstream, exactly as in Python.

type AuditMetrics

type AuditMetrics struct {
	DurationSeconds     float64            `json:"duration_seconds"`
	AgentInvocations    int                `json:"agent_invocations"`
	CostUsd             float64            `json:"cost_usd"`
	CostBreakdown       map[string]float64 `json:"cost_breakdown"`
	BudgetExhausted     bool               `json:"budget_exhausted"`
	FindingsNotVerified int                `json:"findings_not_verified"`
}

AuditMetrics holds run-level performance and budget metrics (DESIGN.md §7.3, §9.1).

Ports schemas/output.py AuditMetrics. Seeded (defaults.go): cost_breakdown `{}`.

func NewAuditMetrics

func NewAuditMetrics() AuditMetrics

NewAuditMetrics returns AuditMetrics's pydantic defaults (cost_breakdown={}).

func (*AuditMetrics) UnmarshalJSON

func (a *AuditMetrics) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds AuditMetrics.CostBreakdown={}.

type AuditProgress

type AuditProgress struct {
	Phase                     string  `json:"phase"`
	PhaseProgress             float64 `json:"phase_progress"`
	AgentsTotal               int     `json:"agents_total"`
	AgentsCompleted           int     `json:"agents_completed"`
	AgentsRunning             int     `json:"agents_running"`
	FindingsSoFar             int     `json:"findings_so_far"`
	ElapsedSeconds            float64 `json:"elapsed_seconds"`
	EstimatedRemainingSeconds float64 `json:"estimated_remaining_seconds"`
	CostSoFarUsd              float64 `json:"cost_so_far_usd"`
}

AuditProgress is an orchestrator phase progress event (DESIGN.md §12.3).

Ports schemas/output.py AuditProgress. Every field is required.

type CWEExpansion

type CWEExpansion struct {
	// AdditionalCwes are CWE IDs to add beyond the hunter's baseline, e.g.
	// ['CWE-918', 'CWE-611'].
	AdditionalCwes []string `json:"additional_cwes"`
	Rationale      string   `json:"rationale"`
}

CWEExpansion carries AI-suggested CWE additions derived from recon context.

Ports schemas/gates.py CWEExpansion.

type ChainCorrelationResult

type ChainCorrelationResult struct {
	// Chains: one entry per multi-step attack chain, formatted
	// "title | finding_id1,finding_id2,... | combined_impact | severity".
	Chains []string `json:"chains"`
	// DuplicateIDs are finding IDs the programmatic dedup missed (to drop).
	DuplicateIDs []string `json:"duplicate_ids"`
}

ChainCorrelationResult is the flat harness schema for chain correlation: the LLM identifies chains only.

Ports schemas/hunt.py ChainCorrelationResult. Seeded (defaults.go): both list fields `[]`.

func NewChainCorrelationResult

func NewChainCorrelationResult() ChainCorrelationResult

NewChainCorrelationResult returns ChainCorrelationResult's pydantic defaults.

func (*ChainCorrelationResult) UnmarshalJSON

func (c *ChainCorrelationResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ChainCorrelationResult's two list defaults.

type ChainStep

type ChainStep struct {
	StepNumber  int    `json:"step_number"`
	FindingID   string `json:"finding_id"`
	Description string `json:"description"`
	Enables     string `json:"enables"`
}

ChainStep is a chain evidence link across findings (DESIGN.md §6.4).

Ports schemas/prove.py ChainStep.

type ComplianceGap

type ComplianceGap struct {
	Framework    string   `json:"framework"`
	ControlID    string   `json:"control_id"`
	ControlName  string   `json:"control_name"`
	FindingCount int      `json:"finding_count"`
	MaxSeverity  string   `json:"max_severity"`
	CweIDs       []string `json:"cwe_ids"`
}

ComplianceGap is an aggregate: one framework control with unresolved findings against it.

Ports schemas/compliance.py ComplianceGap. Python parity: `cwe_ids` is a REQUIRED `list[str]` (no default_factory), so a zero-value Go struct marshals it as null — which is what Python does too when the caller passes nothing, because pydantic refuses to construct the model at all. Callers always supply it.

type ComplianceGate

type ComplianceGate struct {
	Mappings   []ComplianceSuggestion `json:"mappings"`
	Confidence string                 `json:"confidence"`
}

ComplianceGate is the AI half of get_compliance_mappings_hybrid.

Ports schemas/gates.py ComplianceGate.

type ComplianceMapping

type ComplianceMapping struct {
	Framework   string `json:"framework"`
	ControlID   string `json:"control_id"`
	ControlName string `json:"control_name"`
}

ComplianceMapping maps a finding onto one control of one framework.

Ports schemas/compliance.py ComplianceMapping.

type ComplianceSuggestion

type ComplianceSuggestion struct {
	Framework   string `json:"framework"`
	ControlID   string `json:"control_id"`
	ControlName string `json:"control_name"`
}

ComplianceSuggestion is one AI-suggested framework control mapping.

Ports schemas/gates.py ComplianceSuggestion. It has the same shape as ComplianceMapping but is a distinct pydantic class (and therefore a distinct harness/ai schema fixture), so Go keeps it distinct too.

type Confidence

type Confidence string

Confidence is the confidence scale for provisional findings (DESIGN.md §5.4).

Ports schemas/hunt.py Confidence (`class Confidence(str, Enum)`).

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

Confidence members, in Python declaration order.

func ParseConfidence

func ParseConfidence(s string) (Confidence, error)

ParseConfidence is the Go equivalent of `Confidence(s)`.

func (Confidence) Valid

func (c Confidence) Valid() bool

Valid reports whether c is one of the declared members.

type ConfigReport

type ConfigReport struct {
	Secrets    []SecretFinding    `json:"secrets"`
	Misconfigs []MisconfigFinding `json:"misconfigs"`
}

ConfigReport is the config scanner output (DESIGN.md §4.3).

Ports schemas/recon.py ConfigReport. Seeded (defaults.go): secrets and misconfigs default to `[]`.

func NewConfigReport

func NewConfigReport() ConfigReport

NewConfigReport returns ConfigReport's pydantic defaults (secrets=[], misconfigs=[]).

func (*ConfigReport) UnmarshalJSON

func (c *ConfigReport) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ConfigReport's two list defaults.

type ConfigReportRaw

type ConfigReportRaw struct {
	// Secrets: "type | file_path:line | match_preview | confidence | is_test(true/false)".
	Secrets []string `json:"secrets"`
	// Misconfigs: "category | file_path:line | key | risk | remediation".
	Misconfigs []string `json:"misconfigs"`
}

ConfigReportRaw is the flat harness output for the config scanner.

Ports schemas/recon.py ConfigReportRaw. Seeded (defaults.go): both list fields `[]`.

func NewConfigReportRaw

func NewConfigReportRaw() ConfigReportRaw

NewConfigReportRaw returns ConfigReportRaw's pydantic defaults.

func (*ConfigReportRaw) UnmarshalJSON

func (c *ConfigReportRaw) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ConfigReportRaw's two list defaults.

type CrossServiceFinding

type CrossServiceFinding struct {
	ChainDescription string   `json:"chain_description"`
	ServicesInvolved []string `json:"services_involved"`
	EntryPoint       string   `json:"entry_point"`
	Impact           string   `json:"impact"`
}

CrossServiceFinding is the flat schema for cross-service attack chain analysis.

Ports schemas/output.py CrossServiceFinding.

type CryptoUsage

type CryptoUsage struct {
	Algorithm    string  `json:"algorithm"`
	KeySize      *int    `json:"key_size"`
	Mode         *string `json:"mode"`
	UsageContext *string `json:"usage_context"`
	IsWeak       *bool   `json:"is_weak"`
}

CryptoUsage is one cryptography usage profile entry (DESIGN.md §4.3).

Ports schemas/recon.py CryptoUsage.

type CvssV4Score

type CvssV4Score struct {
	Vector           string  `json:"vector"`
	BaseScore        float64 `json:"base_score"`
	Severity         string  `json:"severity"`
	Automatable      bool    `json:"automatable"`
	SubsequentImpact bool    `json:"subsequent_impact"`
}

CvssV4Score holds CVSS v4 scoring details (DESIGN.md §7.1).

Ports schemas/output.py CvssV4Score (== schemas/prove.py CvssV4Score).

type DastVerificationResult

type DastVerificationResult struct {
	PayloadSent      string `json:"payload_sent"`
	ResponseSummary  string `json:"response_summary"`
	ExploitConfirmed bool   `json:"exploit_confirmed"`
	SafetyNotes      string `json:"safety_notes"`
}

DastVerificationResult is the flat schema for DAST-like runtime verification.

Ports schemas/prove.py DastVerificationResult.

type DataFlow

type DataFlow struct {
	Source    string              `json:"source"`
	Path      []ReconDataFlowStep `json:"path"`
	Sink      string              `json:"sink"`
	Sanitized bool                `json:"sanitized"`
	Files     []string            `json:"files"`
}

DataFlow is one input-to-sink path (DESIGN.md §4.3).

Ports schemas/recon.py DataFlow. Seeded (defaults.go): path and files default to `[]`.

func NewDataFlow

func NewDataFlow() DataFlow

NewDataFlow returns DataFlow's pydantic defaults (path=[], files=[]).

func (*DataFlow) UnmarshalJSON

func (d *DataFlow) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DataFlow's two list defaults.

type DataFlowEvidence

type DataFlowEvidence struct {
	Steps       []DataFlowStep `json:"steps"`
	Source      *string        `json:"source"`
	Sink        *string        `json:"sink"`
	SinkReached bool           `json:"sink_reached"`
}

DataFlowEvidence is the grouped data-flow evidence artifact (DESIGN.md §6.4).

Ports schemas/prove.py DataFlowEvidence. Seeded (defaults.go): steps `[]`.

func NewDataFlowEvidence

func NewDataFlowEvidence() DataFlowEvidence

NewDataFlowEvidence returns DataFlowEvidence's pydantic defaults (steps=[]).

func (*DataFlowEvidence) UnmarshalJSON

func (d *DataFlowEvidence) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DataFlowEvidence.Steps=[].

type DataFlowMap

type DataFlowMap struct {
	Flows              []DataFlow          `json:"flows"`
	SanitizationPoints []SanitizationPoint `json:"sanitization_points"`
	Sinks              []Sink              `json:"sinks"`
}

DataFlowMap is the aggregated data-flow analysis output (DESIGN.md §4.3).

Ports schemas/recon.py DataFlowMap. Seeded (defaults.go): all three list fields default to `[]`.

func NewDataFlowMap

func NewDataFlowMap() DataFlowMap

NewDataFlowMap returns DataFlowMap's pydantic defaults (three empty lists).

func (*DataFlowMap) UnmarshalJSON

func (d *DataFlowMap) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DataFlowMap's three list defaults.

type DataFlowMapRaw

type DataFlowMapRaw struct {
	// Flows: "source | sink | sanitized(true/false) | file1, file2, ...".
	Flows []string `json:"flows"`
	// SanitizationPoints: "file_path:line | function_name | type | protects_against".
	SanitizationPoints []string `json:"sanitization_points"`
	// Sinks: "sink_type | file_path:line | function_name | notes".
	Sinks []string `json:"sinks"`
}

DataFlowMapRaw is the flat harness output for the data flow mapper.

Ports schemas/recon.py DataFlowMapRaw. Seeded (defaults.go): all three list fields `[]`.

func NewDataFlowMapRaw

func NewDataFlowMapRaw() DataFlowMapRaw

NewDataFlowMapRaw returns DataFlowMapRaw's pydantic defaults (three empty lists).

func (*DataFlowMapRaw) UnmarshalJSON

func (d *DataFlowMapRaw) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DataFlowMapRaw's three list defaults.

type DataFlowStep

type DataFlowStep struct {
	File        string `json:"file"`
	Line        int    `json:"line"`
	Description string `json:"description"`
	Tainted     bool   `json:"tainted"`
}

DataFlowStep is one step in a source-to-sink proof trace (DESIGN.md §6.4).

Ports schemas/prove.py DataFlowStep — the model schemas/__init__.py re-exports under the bare name. recon.py's same-named model is ReconDataFlowStep.

type DataFlowTrace

type DataFlowTrace struct {
	// Source is where tainted input enters, e.g. "request.params.id".
	Source string `json:"source"`
	// Sink is the security-sensitive operation reached, e.g. "sql.execute(query)".
	Sink string `json:"sink"`
	// Steps is an ordered list of file:line descriptions showing the flow path.
	Steps []string `json:"steps"`
	// SinkReached reports whether tainted data actually reaches the sink.
	SinkReached bool `json:"sink_reached"`
}

DataFlowTrace is the flat schema for the data-flow tracing sub-agent.

Ports schemas/prove.py DataFlowTrace, including its three `mode="before"` field_validators (see UnmarshalJSON).

func NewDataFlowTrace

func NewDataFlowTrace() DataFlowTrace

NewDataFlowTrace returns DataFlowTrace with a non-nil Steps slice. Python declares `steps` as REQUIRED (no default_factory), so this is not a pydantic default — it exists so Go code that builds a trace does not emit null where the model always carries a list.

func (*DataFlowTrace) UnmarshalJSON

func (d *DataFlowTrace) UnmarshalJSON(b []byte) error

UnmarshalJSON ports DataFlowTrace's `_coerce_to_str` / `_coerce_steps` before-validators: LLMs sometimes return dicts or lists where a flat string (or list of strings) is declared, and Python coerces rather than failing.

type DeduplicatedResult

type DeduplicatedResult struct {
	Findings          []RawFinding     `json:"findings"`
	Chains            []PotentialChain `json:"chains"`
	DroppedDuplicates int              `json:"dropped_duplicates"`
	KeptFindings      int              `json:"kept_findings"`
}

DeduplicatedResult is the dedup lane output before PROVE prioritization (DESIGN.md §5.5).

Ports schemas/hunt.py DeduplicatedResult. Seeded (defaults.go): findings and chains `[]`.

func NewDeduplicatedResult

func NewDeduplicatedResult() DeduplicatedResult

NewDeduplicatedResult returns DeduplicatedResult's pydantic defaults.

func (*DeduplicatedResult) UnmarshalJSON

func (d *DeduplicatedResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DeduplicatedResult's two list defaults.

type Dependency

type Dependency struct {
	Name      string  `json:"name"`
	Version   string  `json:"version"`
	Ecosystem string  `json:"ecosystem"`
	Direct    bool    `json:"direct"`
	License   *string `json:"license"`
}

Dependency is one software bill-of-materials entry (DESIGN.md §4.3).

Ports schemas/recon.py Dependency.

type DependencyReport

type DependencyReport struct {
	Sbom            []Dependency  `json:"sbom"`
	KnownCves       []KnownCVE    `json:"known_cves"`
	Outdated        []OutdatedDep `json:"outdated"`
	DirectCount     int           `json:"direct_count"`
	TransitiveCount int           `json:"transitive_count"`
}

DependencyReport is the dependency auditor output (DESIGN.md §4.3).

Ports schemas/recon.py DependencyReport. Seeded (defaults.go): sbom, known_cves and outdated default to `[]`.

func NewDependencyReport

func NewDependencyReport() DependencyReport

NewDependencyReport returns DependencyReport's pydantic defaults (three empty lists, zeroed counters).

func (*DependencyReport) UnmarshalJSON

func (d *DependencyReport) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DependencyReport's three list defaults.

type DependencyReportRaw

type DependencyReportRaw struct {
	// Sbom: "name | version | ecosystem | direct(true/false) | license".
	Sbom []string `json:"sbom"`
	// KnownCves: "cve_id | package | installed_version | fixed_version | cvss_score | direct | reachable".
	KnownCves []string `json:"known_cves"`
	// Outdated: "package | current_version | latest_version | direct(true/false)".
	Outdated []string `json:"outdated"`
}

DependencyReportRaw is the flat harness output for the dependency auditor.

Ports schemas/recon.py DependencyReportRaw. Seeded (defaults.go): all three list fields `[]`.

func NewDependencyReportRaw

func NewDependencyReportRaw() DependencyReportRaw

NewDependencyReportRaw returns DependencyReportRaw's pydantic defaults.

func (*DependencyReportRaw) UnmarshalJSON

func (d *DependencyReportRaw) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds DependencyReportRaw's three list defaults.

type DuplicateCheck

type DuplicateCheck struct {
	IsDuplicate bool    `json:"is_duplicate"`
	DuplicateOf *string `json:"duplicate_of"`
	Reason      string  `json:"reason"`
}

DuplicateCheck is the quick duplicate-check gate for dedup decisions (DESIGN.md §5.5).

Ports schemas/gates.py DuplicateCheck.

type EnrichedFinding

type EnrichedFinding struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	CweID       string `json:"cwe_id"`
	// Severity is one of: "critical", "high", "medium", "low", "info".
	Severity string `json:"severity"`
	// Confidence is one of: "high", "medium", "low".
	Confidence string `json:"confidence"`
	// DataFlowSummary is a natural-language summary (string, not nested).
	DataFlowSummary string `json:"data_flow_summary"`
}

EnrichedFinding is the flat schema for hunt Step 2 (finding enrichment).

Ports schemas/hunt.py EnrichedFinding. Severity/Confidence are plain strings here (not the enums) because this is a raw harness output schema.

type EntryPoint

type EntryPoint struct {
	Kind         string  `json:"kind"`
	Identifier   string  `json:"identifier"`
	FilePath     string  `json:"file_path"`
	Line         int     `json:"line"`
	Method       *string `json:"method"`
	Route        *string `json:"route"`
	AuthRequired *bool   `json:"auth_required"`
}

EntryPoint is an executable entry point (HTTP, CLI, event) (DESIGN.md §4.3).

Ports schemas/recon.py EntryPoint.

type EnumValueError

type EnumValueError struct {
	Enum  string
	Value string
}

EnumValueError is what the ParseX helpers return for an unknown value. It stands in for the `ValueError: 'x' is not a valid Severity` pydantic/Enum raises.

func (*EnumValueError) Error

func (e *EnumValueError) Error() string

type EpssScore

type EpssScore struct {
	Score      float64 `json:"score"`
	Percentile float64 `json:"percentile"`
	Date       string  `json:"date"`
}

EpssScore holds EPSS probability details (DESIGN.md §7.1).

Ports schemas/output.py EpssScore (== schemas/prove.py EpssScore).

type EvidenceLevel

type EvidenceLevel int

EvidenceLevel is the six-level evidence strength hierarchy (DESIGN.md §6.3).

Ports schemas/prove.py EvidenceLevel (`class EvidenceLevel(IntEnum)`), so it is an INT on the wire — `model_dump(mode="json")` emits 1..6, and `EvidenceLevel.FULL_EXPLOIT == 6` is True in Python.

const (
	EvidenceLevelStaticMatch              EvidenceLevel = 1
	EvidenceLevelFlowIdentified           EvidenceLevel = 2
	EvidenceLevelReachabilityConfirmed    EvidenceLevel = 3
	EvidenceLevelSanitizationBypassable   EvidenceLevel = 4
	EvidenceLevelExploitScenarioValidated EvidenceLevel = 5
	EvidenceLevelFullExploit              EvidenceLevel = 6
)

EvidenceLevel members, in Python declaration order (increasing strength).

func ParseEvidenceLevel

func ParseEvidenceLevel(i int) (EvidenceLevel, error)

ParseEvidenceLevel is the Go equivalent of `EvidenceLevel(i)`.

func (EvidenceLevel) Name

func (e EvidenceLevel) Name() string

Name returns the Python member name ("FULL_EXPLOIT"), or "" for an undeclared value.

func (EvidenceLevel) String

func (e EvidenceLevel) String() string

String renders the level the way Python 3.11 renders an IntEnum: as the decimal number, NOT as "EvidenceLevel.FULL_EXPLOIT" (3.11 gave IntEnum int.__str__). Use Name() for the symbolic form.

func (EvidenceLevel) Valid

func (e EvidenceLevel) Valid() bool

Valid reports whether e is one of the six declared levels.

type ExploitHypothesis

type ExploitHypothesis struct {
	// Hypothesis is a natural-language description of the exploit scenario.
	Hypothesis string `json:"hypothesis"`
	// Payload is a concrete exploit payload or input.
	Payload *string `json:"payload"`
	// ExpectedOutcome is what would happen if the exploit succeeds.
	ExpectedOutcome string `json:"expected_outcome"`
}

ExploitHypothesis is the flat schema for the exploit construction sub-agent.

Ports schemas/prove.py ExploitHypothesis, including its before-validators.

func (*ExploitHypothesis) UnmarshalJSON

func (e *ExploitHypothesis) UnmarshalJSON(b []byte) error

UnmarshalJSON ports ExploitHypothesis's `_coerce_to_str` / `_coerce_payload` before-validators. Python parity: `_coerce_payload` maps None to None but stringifies anything else (including a falsy 0 or "" — unlike `_coerce_to_str`, which maps falsy values to "unknown").

type ExploitVerdict

type ExploitVerdict string

ExploitVerdict is the exploitability verdict vocabulary (DESIGN.md §6.3).

Ports schemas/prove.py Verdict (`class Verdict(str, Enum)`). The Go name differs from the pydantic one because codeaf keeps exactly one type called Verdict, in internal/taxonomy (a law in that package enforces it); this one is never a harness destination, so no schema fixture is keyed by its name.

const (
	VerdictConfirmed      ExploitVerdict = "confirmed"
	VerdictLikely         ExploitVerdict = "likely"
	VerdictInconclusive   ExploitVerdict = "inconclusive"
	VerdictNotExploitable ExploitVerdict = "not_exploitable"
)

Verdict members, in Python declaration order.

func ParseVerdict

func ParseVerdict(s string) (ExploitVerdict, error)

ParseVerdict is the Go equivalent of `Verdict(s)`.

func (ExploitVerdict) Valid

func (v ExploitVerdict) Valid() bool

Valid reports whether v is one of the declared members.

type FindingForDedup

type FindingForDedup struct {
	ID                string `json:"id"`
	Fingerprint       string `json:"fingerprint"`
	Title             string `json:"title"`
	FilePath          string `json:"file_path"`
	StartLine         int    `json:"start_line"`
	CweID             string `json:"cwe_id"`
	FindingType       string `json:"finding_type"`
	EstimatedSeverity string `json:"estimated_severity"`
}

FindingForDedup is what the deduplicator needs. 8 fields.

Ports schemas/views.py FindingForDedup. Every field is required.

type FindingForReachability

type FindingForReachability struct {
	Title       string `json:"title"`
	Description string `json:"description"`
	CweID       string `json:"cwe_id"`
	FilePath    string `json:"file_path"`
	StartLine   int    `json:"start_line"`
	Verdict     string `json:"verdict"`
}

FindingForReachability is what the reachability gate needs. 6 fields.

Ports schemas/views.py FindingForReachability. (Its docstring says "5 fields"; the class declares 6 — Python parity: the docstring is stale, the field list is authoritative.) Every field is required.

type FindingForVerifier

type FindingForVerifier struct {
	ID           string  `json:"id"`
	Title        string  `json:"title"`
	Description  string  `json:"description"`
	FilePath     string  `json:"file_path"`
	StartLine    int     `json:"start_line"`
	EndLine      int     `json:"end_line"`
	CodeSnippet  string  `json:"code_snippet"`
	CweID        string  `json:"cwe_id"`
	FunctionName *string `json:"function_name"`
	// DataFlowSummary is the flattened data flow path.
	DataFlowSummary string `json:"data_flow_summary"`
}

FindingForVerifier is what the verifier pipeline needs from a RawFinding.

Ports schemas/views.py FindingForVerifier. Seeded (defaults.go): data_flow_summary="" — which is the Go zero value, so the struct needs no constructor; it is listed here for completeness.

type FindingType

type FindingType string

FindingType is the finding taxonomy (DESIGN.md §5.4).

Ports schemas/hunt.py FindingType (`class FindingType(str, Enum)`).

const (
	FindingTypeSast    FindingType = "sast"
	FindingTypeSca     FindingType = "sca"
	FindingTypeSecrets FindingType = "secrets"
	FindingTypeConfig  FindingType = "config"
	FindingTypeLogic   FindingType = "logic"
	FindingTypeAPI     FindingType = "api"
)

FindingType members, in Python declaration order.

func ParseFindingType

func ParseFindingType(s string) (FindingType, error)

ParseFindingType is the Go equivalent of `FindingType(s)`: it returns the member with value s, or an error (pydantic raises ValidationError).

func (FindingType) Valid

func (f FindingType) Valid() bool

Valid reports whether f is one of the declared members.

type HttpEvidence

type HttpEvidence struct {
	Method             *string           `json:"method"`
	URL                *string           `json:"url"`
	Headers            map[string]string `json:"headers"`
	Body               *string           `json:"body"`
	HighlightedSegment *string           `json:"highlighted_segment"`
}

HttpEvidence is the HTTP request/response evidence artifact (DESIGN.md §6.4).

Ports schemas/prove.py HttpEvidence. `headers` is `dict[str, str] | None`; a nil Go map already marshals to null, so no pointer is needed.

type HuntCoverage

type HuntCoverage struct {
	Attempted int           `json:"attempted"`
	Failures  []HuntFailure `json:"failures"`
	// Unknown marks unreadable persisted accounting, never a measured count.
	Unknown bool `json:"unknown,omitempty"`
}

HuntCoverage is measured by the phase, never inferred from a model's answer or the number of findings. Each selected strategy invocation is one attempt, including repeated strategies; failures stay in selection order.

func Coverage

func Coverage(metadata map[string]any) HuntCoverage

Coverage reads the optional report metadata after either a local run or JSON round trip. Malformed accounting cannot become a claim of completed analysis.

func (HuntCoverage) AllFailed

func (c HuntCoverage) AllFailed() bool

func (HuntCoverage) Description

func (c HuntCoverage) Description() string

func (HuntCoverage) Incomplete

func (c HuntCoverage) Incomplete() bool

type HuntFailure

type HuntFailure struct {
	Strategy string `json:"strategy"`
	Reason   string `json:"reason"`
}

type HuntResult

type HuntResult struct {
	Findings            []RawFinding     `json:"findings"`
	Chains              []PotentialChain `json:"chains"`
	TotalRaw            int              `json:"total_raw"`
	DeduplicatedCount   int              `json:"deduplicated_count"`
	ChainCount          int              `json:"chain_count"`
	StrategiesRun       []string         `json:"strategies_run"`
	HuntDurationSeconds float64          `json:"hunt_duration_seconds"`
	// Coverage is measured by codeaf's phase. Complete hunts omit this optional
	// extension, preserving the original model's wire shape and goldens.
	Coverage *HuntCoverage `json:"hunt_coverage,omitempty"`
}

HuntResult is the deduplicated and correlated hunt output (DESIGN.md §5.5).

Ports schemas/hunt.py HuntResult. Seeded (defaults.go): findings, chains and strategies_run `[]`; the counters and duration default to the Go zero value.

func NewHuntResult

func NewHuntResult() HuntResult

NewHuntResult returns HuntResult's pydantic defaults (three empty lists, zeroed counters).

func (*HuntResult) UnmarshalJSON

func (h *HuntResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds HuntResult's three list defaults.

type HuntStrategy

type HuntStrategy string

HuntStrategy is the strategy catalog for hunters (DESIGN.md §5.2, §5.3).

Ports schemas/hunt.py HuntStrategy (`class HuntStrategy(str, Enum)`).

Python parity: `LOGIC_BUGS = "business_logic"` repeats BUSINESS_LOGIC's value, so Python's Enum machinery makes LOGIC_BUGS an ALIAS for the same member — `HuntStrategy.LOGIC_BUGS is HuntStrategy.BUSINESS_LOGIC` is True and `list(HuntStrategy)` yields the value once. Go declares both constants (so call sites can use either spelling) but AllHuntStrategies lists "business_logic" once, matching `list(HuntStrategy)`.

const (
	HuntStrategyInjection          HuntStrategy = "injection"
	HuntStrategyXSS                HuntStrategy = "xss"
	HuntStrategyDos                HuntStrategy = "dos"
	HuntStrategySSRF               HuntStrategy = "ssrf"
	HuntStrategyAuth               HuntStrategy = "auth"
	HuntStrategyCrypto             HuntStrategy = "crypto"
	HuntStrategyBusinessLogic      HuntStrategy = "business_logic"
	HuntStrategyLogicBugs          HuntStrategy = "business_logic" // Python alias of BUSINESS_LOGIC
	HuntStrategyDataExposure       HuntStrategy = "data_exposure"
	HuntStrategySupplyChain        HuntStrategy = "supply_chain"
	HuntStrategyConfigSecrets      HuntStrategy = "config_secrets"
	HuntStrategyAPISecurity        HuntStrategy = "api_security"
	HuntStrategyPythonSpecific     HuntStrategy = "python_specific"
	HuntStrategyJavascriptSpecific HuntStrategy = "javascript_specific"
)

HuntStrategy members, in Python declaration order.

func ParseHuntStrategy

func ParseHuntStrategy(s string) (HuntStrategy, error)

ParseHuntStrategy is the Go equivalent of `HuntStrategy(s)`.

func (HuntStrategy) Valid

func (h HuntStrategy) Valid() bool

Valid reports whether h is one of the declared members.

type KnownCVE

type KnownCVE struct {
	CveID            string   `json:"cve_id"`
	Package          string   `json:"package"`
	InstalledVersion string   `json:"installed_version"`
	FixedVersion     *string  `json:"fixed_version"`
	CvssV4Score      *float64 `json:"cvss_v4_score"`
	EpssScore        *float64 `json:"epss_score"`
	Direct           bool     `json:"direct"`
	Reachable        *bool    `json:"reachable"`
}

KnownCVE is a known CVE affecting a dependency (DESIGN.md §4.3).

Ports schemas/recon.py KnownCVE.

type Location

type Location struct {
	FilePath     string  `json:"file_path"`
	StartLine    int     `json:"start_line"`
	EndLine      int     `json:"end_line"`
	StartColumn  *int    `json:"start_column"`
	EndColumn    *int    `json:"end_column"`
	FunctionName *string `json:"function_name"`
	CodeSnippet  *string `json:"code_snippet"`
}

Location is source-location metadata for a finding reference (DESIGN.md §7.1).

Ports schemas/output.py Location (== schemas/prove.py Location).

type MisconfigFinding

type MisconfigFinding struct {
	ID          string  `json:"id"`
	Category    string  `json:"category"`
	FilePath    string  `json:"file_path"`
	Line        *int    `json:"line"`
	Key         *string `json:"key"`
	Value       *string `json:"value"`
	Risk        string  `json:"risk"`
	Remediation *string `json:"remediation"`
}

MisconfigFinding is an insecure configuration finding (DESIGN.md §4.3).

Ports schemas/recon.py MisconfigFinding. Seeded (defaults.go): ID gets a fresh uuid4 from NewMisconfigFinding.

func NewMisconfigFinding

func NewMisconfigFinding() MisconfigFinding

NewMisconfigFinding returns MisconfigFinding's pydantic defaults (fresh uuid4 ID).

type MissingFieldError

type MissingFieldError struct {
	Model string
	Field string
}

MissingFieldError stands in for pydantic's ValidationError on a missing required field.

func (*MissingFieldError) Error

func (e *MissingFieldError) Error() string

type MitreMapping

type MitreMapping struct {
	Tactic        string `json:"tactic"`
	TechniqueID   string `json:"technique_id"`
	TechniqueName string `json:"technique_name"`
}

MitreMapping is a MITRE ATT&CK mapping for an attack chain (DESIGN.md §7.2).

Ports schemas/output.py MitreMapping.

type Module

type Module struct {
	Name         string   `json:"name"`
	Path         string   `json:"path"`
	Language     string   `json:"language"`
	Description  *string  `json:"description"`
	Dependencies []string `json:"dependencies"`
}

Module is a module-level architecture element (DESIGN.md §4.3).

Ports schemas/recon.py Module.

func NewModule

func NewModule() Module

NewModule returns Module's pydantic defaults (dependencies=[]).

func (*Module) UnmarshalJSON

func (m *Module) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds Module.Dependencies=[].

type MonitoringResult

type MonitoringResult struct {
	BaselineCommit     string              `json:"baseline_commit"`
	CurrentCommit      string              `json:"current_commit"`
	NewFindings        []RegressionFinding `json:"new_findings"`
	FixedFindings      []RegressionFinding `json:"fixed_findings"`
	UnchangedCount     int                 `json:"unchanged_count"`
	RegressionDetected bool                `json:"regression_detected"`
}

MonitoringResult is the result of comparing the current scan against a baseline.

Ports schemas/output.py MonitoringResult. Seeded (defaults.go): new_findings and fixed_findings `[]`.

func NewMonitoringResult

func NewMonitoringResult() MonitoringResult

NewMonitoringResult returns MonitoringResult's pydantic defaults.

func (*MonitoringResult) UnmarshalJSON

func (m *MonitoringResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds MonitoringResult's two list defaults.

type OutdatedDep

type OutdatedDep struct {
	Package        string `json:"package"`
	CurrentVersion string `json:"current_version"`
	LatestVersion  string `json:"latest_version"`
	Direct         bool   `json:"direct"`
}

OutdatedDep is a dependency that lags behind the latest available version (DESIGN.md §4.3).

Ports schemas/recon.py OutdatedDep.

type PolicyEvalResult

type PolicyEvalResult struct {
	// Violated reports whether the policy is violated.
	Violated bool `json:"violated"`
	// Description explains how the policy is violated, or is 'No violation'.
	Description string `json:"description"`
	// FilePath is the primary file where the violation occurs, or 'N/A'.
	FilePath string `json:"file_path"`
	// Severity is "high", "medium" or "low".
	Severity string `json:"severity"`
}

PolicyEvalResult is the flat schema for AI policy evaluation. 4 fields.

Ports policies.py PolicyEvalResult. Every field is required.

type PolicyViolation

type PolicyViolation struct {
	// Policy is the policy rule that was violated.
	Policy string `json:"policy"`
	// ViolationDescription explains how the code violates the policy.
	ViolationDescription string `json:"violation_description"`
	FilePath             string `json:"file_path"`
	Severity             string `json:"severity"`
}

PolicyViolation is a violation of an org-specific security policy.

Ports schemas/output.py PolicyViolation. Seeded (defaults.go): severity="medium".

func NewPolicyViolation

func NewPolicyViolation() PolicyViolation

NewPolicyViolation returns PolicyViolation's pydantic defaults (severity="medium").

func (*PolicyViolation) UnmarshalJSON

func (p *PolicyViolation) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds PolicyViolation.Severity="medium".

type PotentialChain

type PotentialChain struct {
	ChainID           string   `json:"chain_id"`
	Title             string   `json:"title"`
	FindingIDs        []string `json:"finding_ids"`
	CombinedImpact    string   `json:"combined_impact"`
	EstimatedSeverity Severity `json:"estimated_severity"`
}

PotentialChain is a potential multi-step attack chain before proof (DESIGN.md §5.5).

Ports schemas/hunt.py PotentialChain. Seeded (defaults.go): finding_ids `[]` and NewPotentialChain mints ChainID as a fresh uuid4.

func NewPotentialChain

func NewPotentialChain() PotentialChain

NewPotentialChain returns PotentialChain's pydantic defaults: fresh uuid4 ChainID, finding_ids=[].

func (*PotentialChain) UnmarshalJSON

func (p *PotentialChain) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds PotentialChain.FindingIDs=[]. ChainID is NOT seeded.

type Proof

type Proof struct {
	ExploitHypothesis    string                `json:"exploit_hypothesis"`
	VerificationMethod   string                `json:"verification_method"`
	EvidenceLevel        EvidenceLevel         `json:"evidence_level"`
	DataFlowTrace        []DataFlowStep        `json:"data_flow_trace"`
	DataFlowEvidence     *DataFlowEvidence     `json:"data_flow_evidence"`
	SanitizationAnalysis *SanitizationAnalysis `json:"sanitization_analysis"`
	VulnerableCode       *string               `json:"vulnerable_code"`
	ExploitPayload       *string               `json:"exploit_payload"`
	ExpectedOutcome      *string               `json:"expected_outcome"`
	PocCode              *string               `json:"poc_code"`
	PocExecutionOutput   *string               `json:"poc_execution_output"`
	HTTPRequest          *HttpEvidence         `json:"http_request"`
	HTTPResponse         *HttpEvidence         `json:"http_response"`
	Reachability         *ReachabilityEvidence `json:"reachability"`
	ChainSteps           []ChainStep           `json:"chain_steps"`
}

Proof is the evidence artifact supporting a final verdict (DESIGN.md §6.4).

Ports schemas/prove.py Proof. Every optional field is `X | None` with NO default_factory, so a nil slice marshaling to null is exactly right.

type ProverSignal

type ProverSignal struct {
	Expand            bool    `json:"expand"`
	ExpansionReason   *string `json:"expansion_reason"`
	ExpansionStrategy *string `json:"expansion_strategy"`
	ExpansionTarget   *string `json:"expansion_target"`
}

ProverSignal is the depth-first expansion signal from a prover (DESIGN.md §6.6).

Ports schemas/prove.py ProverSignal.

type RawFinding

type RawFinding struct {
	ID                string              `json:"id"`
	HunterStrategy    string              `json:"hunter_strategy"`
	Title             string              `json:"title"`
	Description       string              `json:"description"`
	FindingType       FindingType         `json:"finding_type"`
	CweID             string              `json:"cwe_id"`
	CweName           string              `json:"cwe_name"`
	OwaspCategory     *string             `json:"owasp_category"`
	FilePath          string              `json:"file_path"`
	StartLine         int                 `json:"start_line"`
	EndLine           int                 `json:"end_line"`
	FunctionName      *string             `json:"function_name"`
	CodeSnippet       string              `json:"code_snippet"`
	EstimatedSeverity Severity            `json:"estimated_severity"`
	Confidence        Confidence          `json:"confidence"`
	DataFlow          []ReconDataFlowStep `json:"data_flow"`
	RelatedFiles      []string            `json:"related_files"`
	Fingerprint       string              `json:"fingerprint"`
}

RawFinding is a potential vulnerability produced by a hunter (DESIGN.md §5.4).

Ports schemas/hunt.py RawFinding. Seeded (defaults.go): related_files `[]`, and NewRawFinding mints ID and Fingerprint as fresh uuid4 strings (Python's `default_factory=lambda: str(uuid4())` on BOTH fields — the fingerprint is a random uuid by default, NOT a content hash; agents/hunt overwrites it with a real fingerprint before dedup).

func NewRawFinding

func NewRawFinding() RawFinding

NewRawFinding returns RawFinding's pydantic defaults: fresh uuid4 ID and Fingerprint, related_files=[]. data_flow stays nil (Python default None).

func (RawFinding) ForDedup

func (r RawFinding) ForDedup() FindingForDedup

ForDedup projects the finding onto what the deduplicator needs.

Ports schemas/hunt.py RawFinding.for_dedup(). Python passes `self.finding_type.value` / `self.estimated_severity.value`; the Go enums already ARE their values.

func (RawFinding) ForVerifier

func (r RawFinding) ForVerifier() FindingForVerifier

ForVerifier projects the finding onto what the verifier pipeline needs.

Ports schemas/hunt.py RawFinding.for_verifier(). Python parity: the data_flow summary joins `f"{step.file_path}:{step.line} {step.operation}"` with "\n", and is "" when data_flow is empty or None — note Python tests `if self.data_flow:`, so an EMPTY list yields "" just like None does.

func (*RawFinding) UnmarshalJSON

func (r *RawFinding) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds RawFinding.RelatedFiles=[]. ID and Fingerprint are NOT seeded (see the file header).

type ReachabilityEvidence

type ReachabilityEvidence struct {
	VulnerableFunction string   `json:"vulnerable_function"`
	CallChain          []string `json:"call_chain"`
	Reachable          bool     `json:"reachable"`
	DirectDependency   bool     `json:"direct_dependency"`
}

ReachabilityEvidence is the reachability evidence for dependency findings (DESIGN.md §6.4).

Ports schemas/prove.py ReachabilityEvidence. Seeded (defaults.go): call_chain `[]`.

func NewReachabilityEvidence

func NewReachabilityEvidence() ReachabilityEvidence

NewReachabilityEvidence returns ReachabilityEvidence's pydantic defaults (call_chain=[]).

func (*ReachabilityEvidence) UnmarshalJSON

func (r *ReachabilityEvidence) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ReachabilityEvidence.CallChain=[].

type ReachabilityGate

type ReachabilityGate struct {
	// Reachability is one of: "externally_reachable", "requires_auth",
	// "internal_only", "unreachable".
	Reachability string `json:"reachability"`
	Rationale    string `json:"rationale"`
	// Confidence is one of: "high", "medium", "low".
	Confidence string `json:"confidence"`
}

ReachabilityGate is the reachability assessment for findings that carry no explicit reachability tag.

Ports schemas/gates.py ReachabilityGate.

type ReachabilityProof

type ReachabilityProof struct {
	// VulnerableFunction is the vulnerable function/method in the dependency.
	VulnerableFunction string `json:"vulnerable_function"`
	// CallChain is the import/call chain from app code to that function.
	CallChain []string `json:"call_chain"`
	// Reachable reports whether the vulnerable function is actually called.
	Reachable bool `json:"reachable"`
	// Direct reports whether the dependency is direct or transitive.
	Direct bool `json:"direct"`
}

ReachabilityProof is the flat schema for dependency reachability analysis.

Ports schemas/prove.py ReachabilityProof, including its two before-validators.

func NewReachabilityProof

func NewReachabilityProof() ReachabilityProof

NewReachabilityProof returns ReachabilityProof with a non-nil CallChain. As with DataFlowTrace, `call_chain` is REQUIRED in Python.

func (*ReachabilityProof) UnmarshalJSON

func (r *ReachabilityProof) UnmarshalJSON(b []byte) error

UnmarshalJSON ports ReachabilityProof's `_coerce_to_str` / `_coerce_call_chain` before-validators.

Python parity: `_coerce_to_str` here does NOT have the dict-key probing that DataFlowTrace's version has — a dict lands on `str(v)`. coerceToStr handles both by taking a `probeDictKeys` flag; ReachabilityProof passes false.

type ReconDataFlowStep

type ReconDataFlowStep struct {
	FilePath  string `json:"file_path"`
	Line      int    `json:"line"`
	Component string `json:"component"`
	Operation string `json:"operation"`
}

ReconDataFlowStep is an intermediate transformation step in a data flow (DESIGN.md §4.3).

Ports schemas/recon.py DataFlowStep, which `schemas/__init__.py` re-exports as `ReconDataFlowStep` to leave the bare name to prove.py's different model. This is the one used by DataFlow.path and RawFinding.data_flow.

type ReconResult

type ReconResult struct {
	Architecture         ArchitectureMap  `json:"architecture"`
	DataFlows            DataFlowMap      `json:"data_flows"`
	Dependencies         DependencyReport `json:"dependencies"`
	Config               ConfigReport     `json:"config"`
	SecurityContext      SecurityContext  `json:"security_context"`
	Languages            []string         `json:"languages"`
	Frameworks           []string         `json:"frameworks"`
	LinesOfCode          int              `json:"lines_of_code"`
	FileCount            int              `json:"file_count"`
	ReconDurationSeconds float64          `json:"recon_duration_seconds"`
}

ReconResult is the comprehensive RECON context (DESIGN.md §4.3).

Ports schemas/recon.py ReconResult. Seeded (defaults.go): languages and frameworks default to `[]`; the five nested models are REQUIRED in Python, so NewReconResult seeds them with their own defaults rather than leaving half-built zero values.

func NewReconResult

func NewReconResult() ReconResult

NewReconResult returns ReconResult's pydantic defaults: languages=[], frameworks=[], and — because the five nested models are REQUIRED in Python and therefore always constructed by the caller — each nested model at ITS own defaults rather than a half-built zero value.

func (*ReconResult) UnmarshalJSON

func (r *ReconResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ReconResult's defaults. The nested models re-seed themselves through their own UnmarshalJSON when their key is present; when a key is ABSENT the seeded default survives, which is what Python's `_recon_model` normalization (reasoners/phases.py) relies on.

type RegressionFinding

type RegressionFinding struct {
	FindingTitle string `json:"finding_title"`
	FindingID    string `json:"finding_id"`
	Severity     string `json:"severity"`
	CweID        string `json:"cwe_id"`
	// Status is one of: "new", "fixed", "unchanged".
	Status string `json:"status"`
}

RegressionFinding is a finding that appeared (or disappeared) since the baseline scan.

Ports schemas/output.py RegressionFinding.

type RelevanceGate

type RelevanceGate struct {
	IsRelevant bool    `json:"is_relevant"`
	Confidence float64 `json:"confidence"`
	Reason     string  `json:"reason"`
}

RelevanceGate is the relevance/noise filter gate for candidate findings (DESIGN.md §2.4).

Ports schemas/gates.py RelevanceGate.

type RemediationSuggestion

type RemediationSuggestion struct {
	FixDescription string `json:"fix_description"`
	// PatchDiff is a unified-diff patch showing the code changes needed.
	PatchDiff string `json:"patch_diff"`
	// Confidence is "high", "medium" or "low".
	Confidence string `json:"confidence"`
}

RemediationSuggestion is the flat schema for an AI-generated remediation.

Ports schemas/prove.py RemediationSuggestion.

type ReproductionStep

type ReproductionStep struct {
	Step           int     `json:"step"`
	Description    string  `json:"description"`
	Command        *string `json:"command"`
	ExpectedOutput *string `json:"expected_output"`
}

ReproductionStep is one reproduction instruction for analysts (DESIGN.md §7.1).

Ports schemas/output.py ReproductionStep (== schemas/prove.py ReproductionStep).

type SanitizationAnalysis

type SanitizationAnalysis struct {
	SanitizationFound      bool    `json:"sanitization_found"`
	SanitizationType       *string `json:"sanitization_type"`
	SanitizationSufficient *bool   `json:"sanitization_sufficient"`
	BypassPossible         *bool   `json:"bypass_possible"`
	BypassMethod           *string `json:"bypass_method"`
}

SanitizationAnalysis is the sanitization effectiveness analysis (DESIGN.md §6.4).

Ports schemas/prove.py SanitizationAnalysis.

type SanitizationPoint

type SanitizationPoint struct {
	FilePath         string   `json:"file_path"`
	Line             int      `json:"line"`
	FunctionName     *string  `json:"function_name"`
	SanitizationType string   `json:"sanitization_type"`
	ProtectsAgainst  []string `json:"protects_against"`
}

SanitizationPoint is a location where tainted data is sanitized (DESIGN.md §4.3).

Ports schemas/recon.py SanitizationPoint. Seeded (defaults.go): protects_against defaults to `[]`.

func NewSanitizationPoint

func NewSanitizationPoint() SanitizationPoint

NewSanitizationPoint returns SanitizationPoint's pydantic defaults (protects_against=[]).

func (*SanitizationPoint) UnmarshalJSON

func (s *SanitizationPoint) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds SanitizationPoint.ProtectsAgainst=[].

type SanitizationResult

type SanitizationResult struct {
	// Found reports whether any sanitization/validation was found on the path.
	Found bool `json:"found"`
	// Type is e.g. "parameterized query", "html encoding".
	Type *string `json:"type"`
	// Sufficient reports whether the sanitization prevents the exploit.
	Sufficient *bool `json:"sufficient"`
	// BypassMethod describes how the sanitization could be bypassed.
	BypassMethod *string `json:"bypass_method"`
}

SanitizationResult is the flat schema for the sanitization analysis sub-agent.

Ports schemas/prove.py SanitizationResult.

type ScanLocationsResult

type ScanLocationsResult struct {
	Locations []VulnLocation `json:"locations"`
}

ScanLocationsResult is the container for hunt Step 1 results.

Ports schemas/hunt.py ScanLocationsResult. Seeded (defaults.go): locations `[]`.

func NewScanLocationsResult

func NewScanLocationsResult() ScanLocationsResult

NewScanLocationsResult returns ScanLocationsResult's pydantic defaults (locations=[]).

func (*ScanLocationsResult) UnmarshalJSON

func (s *ScanLocationsResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ScanLocationsResult's list default.

type SecretFinding

type SecretFinding struct {
	ID          string `json:"id"`
	SecretType  string `json:"secret_type"`
	FilePath    string `json:"file_path"`
	Line        int    `json:"line"`
	Match       string `json:"match"`
	Confidence  string `json:"confidence"`
	IsTestValue *bool  `json:"is_test_value"`
}

SecretFinding is a discovered hardcoded secret or credential (DESIGN.md §4.3).

Ports schemas/recon.py SecretFinding. Seeded (defaults.go): ID gets a fresh uuid4 from NewSecretFinding.

func NewSecretFinding

func NewSecretFinding() SecretFinding

NewSecretFinding returns SecretFinding's pydantic defaults (fresh uuid4 ID).

type SecurityAuditResult

type SecurityAuditResult struct {
	Repository        string             `json:"repository"`
	CommitSha         string             `json:"commit_sha"`
	Branch            *string            `json:"branch"`
	Timestamp         Timestamp          `json:"timestamp"`
	DepthProfile      string             `json:"depth_profile"`
	StrategiesUsed    []string           `json:"strategies_used"`
	Provider          string             `json:"provider"`
	Findings          []VerifiedFinding  `json:"findings"`
	AttackChains      []AttackChain      `json:"attack_chains"`
	TotalRawFindings  int                `json:"total_raw_findings"`
	Confirmed         int                `json:"confirmed"`
	Likely            int                `json:"likely"`
	Inconclusive      int                `json:"inconclusive"`
	NotExploitable    int                `json:"not_exploitable"`
	NoiseReductionPct float64            `json:"noise_reduction_pct"`
	BySeverity        map[string]int     `json:"by_severity"`
	ComplianceGaps    []ComplianceGap    `json:"compliance_gaps"`
	PolicyViolations  []PolicyViolation  `json:"policy_violations"`
	DurationSeconds   float64            `json:"duration_seconds"`
	AgentInvocations  int                `json:"agent_invocations"`
	CostUsd           float64            `json:"cost_usd"`
	CostBreakdown     map[string]float64 `json:"cost_breakdown"`
	Metadata          map[string]any     `json:"metadata"`
	Sarif             string             `json:"sarif"`
}

SecurityAuditResult is the top-level SEC-AF audit output (DESIGN.md §7.3).

Ports schemas/output.py SecurityAuditResult. Seeded (defaults.go): the five list fields `[]`, the three dict fields `{}`.

Timestamp is a pydantic `datetime`; see timestamp.go for the exact wire format (`datetime.isoformat()` via FastAPI's jsonable_encoder).

func NewSecurityAuditResult

func NewSecurityAuditResult() SecurityAuditResult

NewSecurityAuditResult returns SecurityAuditResult's pydantic defaults: the five list fields empty, the three dict fields empty.

func (*SecurityAuditResult) UnmarshalJSON

func (s *SecurityAuditResult) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds SecurityAuditResult's container defaults and decodes with UseNumber.

UseNumber is here for exactly one field: `Metadata map[string]any`, the port of pydantic's `metadata: dict[str, object]`. An `object`-typed value keeps whatever the DECODER produced, and CPython's json.loads produces an `int` for an integer literal and a `float` otherwise — so `{"demoted_total": 2}` re-serialises as "2" in Python. Go's default decode turns every number into float64 and would spell it "2.0". UseNumber affects ONLY values decoded into `interface{}`; the model's typed int/float fields are untouched, exactly as pydantic's are.

The same compensation is applied on the live path by afx.WireNumbers, where the drop summary arrives already decoded from the SDK's own reader (see internal/secaf/audit/run.go).

type SecurityContext

type SecurityContext struct {
	AuthModel         string        `json:"auth_model"`
	AuthDetails       string        `json:"auth_details"`
	CryptoUsage       []CryptoUsage `json:"crypto_usage"`
	FrameworkSecurity []string      `json:"framework_security"`
	SecurityHeaders   []string      `json:"security_headers"`
	DeploymentSignals []string      `json:"deployment_signals"`
}

SecurityContext is the security context profiler output (DESIGN.md §4.3).

Ports schemas/recon.py SecurityContext. Seeded (defaults.go): the four list fields default to `[]`.

func NewSecurityContext

func NewSecurityContext() SecurityContext

NewSecurityContext returns SecurityContext's pydantic defaults (four empty lists).

func (*SecurityContext) UnmarshalJSON

func (s *SecurityContext) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds SecurityContext's four list defaults.

type SecurityContextRaw

type SecurityContextRaw struct {
	// AuthModel is one of: jwt, session_cookie, oauth2, api_key, none, other.
	AuthModel string `json:"auth_model"`
	// AuthDetails is a brief description of the auth implementation.
	AuthDetails string `json:"auth_details"`
	// CryptoUsage: "algorithm | key_size | mode | usage_context | is_weak(true/false)".
	CryptoUsage []string `json:"crypto_usage"`
	// SecuritySignals: framework security features, security headers and
	// deployment signals, one per entry.
	SecuritySignals []string `json:"security_signals"`
}

SecurityContextRaw is the flat harness output for the security context profiler.

Ports schemas/recon.py SecurityContextRaw. Seeded (defaults.go): auth_details="" (the Go zero value, so only the list fields actually need seeding), crypto_usage and security_signals `[]`.

func NewSecurityContextRaw

func NewSecurityContextRaw() SecurityContextRaw

NewSecurityContextRaw returns SecurityContextRaw's pydantic defaults (auth_details="" — the Go zero value — plus two empty lists).

func (*SecurityContextRaw) UnmarshalJSON

func (s *SecurityContextRaw) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds SecurityContextRaw's two list defaults.

type Service

type Service struct {
	Name          string  `json:"name"`
	ServiceType   string  `json:"service_type"`
	Endpoint      *string `json:"endpoint"`
	Purpose       *string `json:"purpose"`
	AuthMechanism *string `json:"auth_mechanism"`
}

Service is a service dependency or external integration (DESIGN.md §4.3).

Ports schemas/recon.py Service.

type ServiceDefinition

type ServiceDefinition struct {
	Name         string   `json:"name"`
	RepoURL      string   `json:"repo_url"`
	APIEndpoints []string `json:"api_endpoints"`
	// Dependencies are the names of services this one depends on.
	Dependencies []string `json:"dependencies"`
}

ServiceDefinition is a service node in a multi-repo architecture.

Ports schemas/output.py ServiceDefinition. Seeded (defaults.go): api_endpoints and dependencies `[]`.

func NewServiceDefinition

func NewServiceDefinition() ServiceDefinition

NewServiceDefinition returns ServiceDefinition's pydantic defaults.

func (*ServiceDefinition) UnmarshalJSON

func (s *ServiceDefinition) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds ServiceDefinition's two list defaults.

type Severity

type Severity string

Severity is the severity scale (DESIGN.md §5.4, §7).

Ports schemas/hunt.py Severity (`class Severity(str, Enum)`).

const (
	SeverityCritical Severity = "critical"
	SeverityHigh     Severity = "high"
	SeverityMedium   Severity = "medium"
	SeverityLow      Severity = "low"
	SeverityInfo     Severity = "info"
)

Severity members, in Python declaration order (decreasing urgency).

func ParseSeverity

func ParseSeverity(s string) (Severity, error)

ParseSeverity is the Go equivalent of `Severity(s)`.

func (Severity) Valid

func (s Severity) Valid() bool

Valid reports whether s is one of the declared members.

type SeverityClassification

type SeverityClassification struct {
	// Severity is one of: "critical", "high", "medium", "low".
	Severity   string  `json:"severity"`
	Confidence float64 `json:"confidence"`
	Rationale  string  `json:"rationale"`
}

SeverityClassification is the quick severity classification gate used in scoring (DESIGN.md §2.4).

Ports schemas/gates.py SeverityClassification.

type Sink

type Sink struct {
	SinkType            string  `json:"sink_type"`
	FilePath            string  `json:"file_path"`
	Line                int     `json:"line"`
	FunctionName        *string `json:"function_name"`
	ExploitabilityNotes *string `json:"exploitability_notes"`
}

Sink is a security-critical sink reached by application data (DESIGN.md §4.3).

Ports schemas/recon.py Sink.

type StrategySelection

type StrategySelection struct {
	Strategies []string `json:"strategies"`
	Rationale  string   `json:"rationale"`
}

StrategySelection is the strategy-selection gate for HUNT routing (DESIGN.md §5.3).

Ports schemas/gates.py StrategySelection.

type Timestamp

type Timestamp struct {
	time.Time
}

Timestamp is the JSON representation of a pydantic `datetime` field (`SecurityAuditResult.timestamp`).

Python parity (docs/DESIGN.md §2, VERIFIED): a reasoner returns `model_dump()`, which leaves the field as a real datetime object; the AgentField Python SDK then hands the result to FastAPI, whose `jsonable_encoder` serialises a datetime with `datetime.isoformat()`. That produces

2026-01-02T03:04:05.123456+00:00   (microseconds present)
2026-01-02T03:04:05+00:00          (microseconds exactly zero -> omitted)

i.e. always a numeric UTC offset (never the "Z" shorthand), and a fractional part that is either absent or exactly six digits — `isoformat()` never emits 1, 3 or 9 digits, and never a `.000000` fraction (a zero microsecond component means no fraction at all).

UnmarshalJSON is deliberately more permissive than MarshalJSON: it accepts RFC 3339 with or without a fractional part, with "Z" or a numeric offset, and a naive (offset-less) timestamp — pydantic accepts all of those, and `model_dump(mode="json")` (used by the schema-fixture generator) emits the "Z" form.

func NewTimestamp

func NewTimestamp(t time.Time) Timestamp

NewTimestamp wraps t.

func (Timestamp) MarshalJSON

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

MarshalJSON emits the `datetime.isoformat()` string as a JSON string.

func (Timestamp) String

func (t Timestamp) String() string

String renders the timestamp exactly as Python's `datetime.isoformat()`.

The guard tests the MICROSECOND component, not the nanosecond one. Go's clock has nanosecond resolution while `datetime` has only microsecond resolution (`datetime.resolution == 1µs`), so a reading whose sub-second part is 1-999ns has a microsecond component of zero: Python prints no fraction, and a `t.Nanosecond() == 0` guard would print `.000000`. The window is the first microsecond of every second, and the producer is an untruncated `time.Now().UTC()` (orch.nowUTC), so it reaches the audit result timestamp, the checkpoint `created_at`, the SARIF automationDetails.id and the monitoring baseline.

func (*Timestamp) UnmarshalJSON

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

UnmarshalJSON accepts everything pydantic accepts for a datetime field:

  • a JSON string in any of timestampLayouts (the wire form is always the first one),
  • a JSON number, read as a Unix epoch in seconds with a fractional part carrying sub-second precision — VERIFIED: pydantic turns 1767322445 into 2026-01-02T02:54:05+00:00 and 1767322445.5 into ...:05.500000+00:00,
  • JSON null, which leaves the zero Timestamp (Go-only: the field is required in pydantic, but a null must not fail the whole decode).

type TrustBoundary

type TrustBoundary struct {
	Name        string   `json:"name"`
	SourceZone  string   `json:"source_zone"`
	TargetZone  string   `json:"target_zone"`
	Description string   `json:"description"`
	Enforcement []string `json:"enforcement"`
}

TrustBoundary is a trust transition location (DESIGN.md §4.3).

Ports schemas/recon.py TrustBoundary.

func NewTrustBoundary

func NewTrustBoundary() TrustBoundary

NewTrustBoundary returns TrustBoundary's pydantic defaults (enforcement=[]).

func (*TrustBoundary) UnmarshalJSON

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

UnmarshalJSON seeds TrustBoundary.Enforcement=[].

type VerdictDecision

type VerdictDecision struct {
	// Verdict is one of: "confirmed", "likely", "inconclusive", "not_exploitable".
	Verdict string `json:"verdict"`
	// EvidenceLevel is 1..6: 1=STATIC_MATCH to 6=FULL_EXPLOIT.
	EvidenceLevel int    `json:"evidence_level"`
	Rationale     string `json:"rationale"`
	// Confidence is one of: "high", "medium", "low".
	Confidence string `json:"confidence"`
}

VerdictDecision is the flat schema for the verdict sub-agent. It goes through `.ai()`, not `.harness()`.

Ports schemas/prove.py VerdictDecision. Verdict/EvidenceLevel are a plain string/int here because this is the raw model output, validated downstream.

type VerdictGate

type VerdictGate struct {
	Confirmed  bool    `json:"confirmed"`
	Confidence float64 `json:"confidence"`
	Reason     string  `json:"reason"`
}

VerdictGate is the binary verdict gate for simple cases (DESIGN.md §2.4, §6.3).

Ports schemas/gates.py VerdictGate.

type VerifiedFinding

type VerifiedFinding struct {
	ID                    string                 `json:"id"`
	Fingerprint           string                 `json:"fingerprint"`
	Title                 string                 `json:"title"`
	Description           string                 `json:"description"`
	FindingType           FindingType            `json:"finding_type"`
	CweID                 string                 `json:"cwe_id"`
	CweName               string                 `json:"cwe_name"`
	OwaspCategory         *string                `json:"owasp_category"`
	Tags                  []string               `json:"tags"`
	Verdict               ExploitVerdict         `json:"verdict"`
	EvidenceLevel         EvidenceLevel          `json:"evidence_level"`
	Rationale             string                 `json:"rationale"`
	Severity              Severity               `json:"severity"`
	CvssV4                *CvssV4Score           `json:"cvss_v4"`
	Epss                  *EpssScore             `json:"epss"`
	ExploitabilityScore   float64                `json:"exploitability_score"`
	Proof                 *Proof                 `json:"proof"`
	Location              Location               `json:"location"`
	RelatedLocations      []Location             `json:"related_locations"`
	ChainID               *string                `json:"chain_id"`
	ChainStep             *int                   `json:"chain_step"`
	Enables               []string               `json:"enables"`
	Compliance            []ComplianceMapping    `json:"compliance"`
	ReproductionSteps     []ReproductionStep     `json:"reproduction_steps"`
	Remediation           *RemediationSuggestion `json:"remediation"`
	SarifRuleID           string                 `json:"sarif_rule_id"`
	SarifSecuritySeverity float64                `json:"sarif_security_severity"`
	DropReason            *string                `json:"drop_reason"`
}

VerifiedFinding is a finding fully assessed by the PROVE phase (DESIGN.md §7.1).

Ports schemas/prove.py VerifiedFinding. Seeded (defaults.go): tags, related_locations, compliance and reproduction_steps `[]`, and NewVerifiedFinding mints ID as a fresh uuid4.

func NewVerifiedFinding

func NewVerifiedFinding() VerifiedFinding

NewVerifiedFinding returns VerifiedFinding's pydantic defaults: fresh uuid4 ID, and tags / related_locations / compliance / reproduction_steps empty.

func (*VerifiedFinding) UnmarshalJSON

func (v *VerifiedFinding) UnmarshalJSON(b []byte) error

UnmarshalJSON seeds VerifiedFinding's four list defaults. ID is NOT seeded.

type VulnLocation

type VulnLocation struct {
	FilePath    string `json:"file_path"`
	StartLine   int    `json:"start_line"`
	CodeSnippet string `json:"code_snippet"`
	// PatternType e.g. 'sql_injection', 'command_injection'.
	PatternType string `json:"pattern_type"`
}

VulnLocation is the flat schema for hunt Step 1 (location scanning).

Ports schemas/hunt.py VulnLocation.

Jump to

Keyboard shortcuts

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