verifycmd

package
v0.0.0-...-a02776c Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

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

Documentation

Overview

Package verifycmd implements `fendix verify <finding-id>` — re-run a single finding against the current state of the target and report whether it's still present or has been resolved.

Surfaced as a Track 4 gap by the TwiScope-backend scan: the verify subcommand was a Phase-4 stub that just printed "not yet implemented" despite being documented in `fendix --help`.

Supported finding shapes:

  • URL-anchored DAST findings (endpoint shape: "GET /path", "POST /path", or "http(s)://host/path"; source: blackbox): re-issue the request with the same auth and re-evaluate the SAME check that produced the finding originally.

  • File-anchored SAST findings (endpoint shape: "path/to/file.py:42"; source: whitebox; category: secrets/injection/headers/...): re-scan the file containing the original endpoint and look for a finding with the same ID at the same approximate line.

  • Dep-CVE findings (category: deps, endpoint: "requirements.txt" or "package-lock.json" or similar): re-run the relevant native scanner against the manifest's directory and check if the same (package, version, OSV-id) tuple still emerges.

  • Correlated findings (source: correlated) — C4: re-test BOTH halves. The blackbox half is the endpoint's reachability; the whitebox half is the tainted source file's continued existence. Missing or inaccessible source is unknown, since checkout completeness is not established. Needs both --url and --code; missing one → unknown.

  • Active injection-probe findings (blackbox injection/xss/ssrf/... under --enable-active) — C4: a gated endpoint (401/403/404/410) resolves the finding; an open one without consent is reported still-present with a note that a confirmed re-exploit needs --enable-active consent; with --enable-active, verify re-hits the endpoint and looks for the recorded payload signal.

Process exit codes (Sprint 03):

  • 0 — Status: resolved. The finding no longer fires.
  • 1 — Status: still-present. The finding still fires; CI should fail.
  • 2 — Status: unknown OR not-found-in-baseline. Verify could not produce a confident result; the operator should investigate but CI should NOT auto-fail on this — that would punish edge cases (correlated findings, baseline drift) the operator hasn't yet opted to handle.

There's no automatic discovery of the scan target — the caller passes --url / --code explicitly, the same way they did for the original scan.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w io.Writer, r *Result, emitJSON bool) error

Render writes the Result either as pretty-printed JSON (when emitJSON=true) or a short human-readable summary. Returns a non-nil error only on write failure.

Types

type OccurrenceResult

type OccurrenceResult struct {
	Endpoint    string `json:"endpoint"`
	Fingerprint string `json:"fingerprint,omitempty"`
	Status      Status `json:"status"`
	Reason      string `json:"reason,omitempty"`
}

OccurrenceResult is the verdict for one occurrence of a grouped finding.

type Options

type Options struct {
	BaselinePath string
	URL          string
	CodePath     string
	Auth         string // raw Authorization header value (e.g. "Bearer eyJ...")
	Timeout      time.Duration
	// EnableActive mirrors the original scan's --enable-active consent. It is
	// required for verify to actually re-issue an attack payload against an
	// active-probe finding's endpoint (C4). Without it, an active-probe verify
	// falls back to a reachability-only verdict and says so.
	EnableActive bool
}

Options configures a verify call. URL / CodePath / Auth are the same inputs the user gave the original scan — verify doesn't try to guess.

type Result

type Result struct {
	FindingID string `json:"finding_id"`
	Status    Status `json:"status"`
	// Original is the finding as it appeared in the baseline. Always
	// set when Status != not-found-in-baseline.
	Original *models.Finding `json:"original,omitempty"`
	// Reason carries a human-readable explanation, especially for
	// unknown / not-found-in-baseline outcomes.
	Reason string `json:"reason,omitempty"`
	// Occurrences holds one verdict per occurrence when the finding is a
	// group of several; Status is their fold (see verifyEach).
	Occurrences []OccurrenceResult `json:"occurrences,omitempty"`
	// VerifiedAt is when the re-test ran (UTC ISO-8601).
	VerifiedAt string `json:"verified_at"`
	// Latency is how long the re-test took. Useful for diagnosing
	// slow CI cycles or unreliable targets.
	LatencyMs int64 `json:"latency_ms"`
}

Result is the structured output of a verify call. Callers can render it as plain text, JSON, or use it programmatically.

func Run

func Run(ctx context.Context, findingID string, opts Options) (*Result, error)

Run loads the baseline, finds the requested ID, dispatches to the right per-category verifier, and returns the Result. Errors here are reserved for unrecoverable problems (baseline can't be read, malformed JSON); a "couldn't reach the target" case is encoded as StatusUnknown with an explanatory Reason rather than an error.

type Status

type Status string

Status is the verify outcome for a single finding.

const (
	StatusStillPresent Status = "still-present"
	StatusResolved     Status = "resolved"
	StatusUnknown      Status = "unknown"
	StatusNotFound     Status = "not-found-in-baseline"
)

Jump to

Keyboard shortcuts

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