targets

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 targets implements the concrete benchmark corpora for the v0.20 baseline suite: OWASP Benchmark (white-box / SAST), DVWA, and OWASP Juice Shop (black-box / DAST). Each target knows how to run a Fendix scan against itself and how to score the result against ground truth.

Honesty constraints (roadmap Rule 5 — "benchmark before marketing"):

  • DAST targets (DVWA, Juice Shop) have no well-defined negative corpus, so TrueNeg is 0 and FPRate is not meaningful for them; the useful numbers are recall (did we catch the known bugs) and the raw false-positive COUNT. OWASP Benchmark ships labeled true AND false test cases, so its TN — and therefore FPRate — is real.
  • Memory is NOT measured here (capturing a subprocess's peak RSS portably is fragile); the memory baseline comes from `make bench` (the in-process BenchmarkScan). These targets own accuracy + wall time only.

Index

Constants

This section is empty.

Variables

View Source
var ErrDockerMissing = errors.New("docker not found on PATH (required for DVWA/Juice Shop benchmarks)")

ErrDockerMissing is returned by a DAST target when the docker CLI is not available — surfaced loudly rather than silently skipped (agent spec).

View Source
var ErrHostPortInUse = errors.New("benchmark host port already in use")

ErrHostPortInUse is returned when the port a benchmark target needs is already bound. Distinguished so the CLI can print the override hint instead of a raw Docker error.

View Source
var ErrTargetSkipped = errors.New("benchmark target skipped")

ErrTargetSkipped marks a target that cannot run in the current product version (as opposed to a real failure). The runner reports SKIPPED with the reason instead of failing the suite.

Functions

This section is empty.

Types

type DVWA

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

DVWA is the Damn Vulnerable Web App DAST benchmark target.

LIMITATION (documented for honesty, roadmap Rule 5): most DVWA vulnerabilities live behind a login + a one-time DB setup at /setup.php, and behind a security-level cookie. An unauthenticated black-box scan reaches only the surface (headers, exposed setup, cookie flags). Authenticated DVWA scanning is a v0.21+ enhancement; until then the ground-truth list is deliberately scoped to what an unauthenticated scan can actually reach, so recall numbers stay honest.

func NewDVWA

func NewDVWA() *DVWA

NewDVWA returns a DVWA target reading ground truth from benchmarks/targets/dvwa-known.json.

func (*DVWA) Name

func (d *DVWA) Name() string

Name implements benchmark.BenchmarkTarget.

func (*DVWA) Run

Run scores result against the DVWA ground truth.

func (*DVWA) Scan

func (d *DVWA) Scan(ctx context.Context, fendixBin string) (*benchmark.ScanResult, error)

Scan spins up DVWA in Docker, waits for it, runs a black-box scan, and tears the container down.

type ExpectedVuln

type ExpectedVuln struct {
	ID        string `json:"id"`
	Type      string `json:"type"`
	Location  string `json:"location"`
	Severity  string `json:"severity"`
	Confirmed bool   `json:"confirmed"`
}

ExpectedVuln is one ground-truth vulnerability the target is known to contain. Type is matched (case-insensitively, substring) against a finding's Category; Location against its Endpoint or Line.

type JuiceShop

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

JuiceShop is the OWASP Juice Shop DAST benchmark target (Node app — black-box HTTP scanning, language-agnostic).

func NewJuiceShop

func NewJuiceShop() *JuiceShop

NewJuiceShop returns a Juice Shop target reading ground truth from benchmarks/targets/juiceshop-known.json.

func (*JuiceShop) Name

func (j *JuiceShop) Name() string

Name implements benchmark.BenchmarkTarget.

func (*JuiceShop) Run

Run scores result against the Juice Shop ground truth.

func (*JuiceShop) Scan

func (j *JuiceShop) Scan(ctx context.Context, fendixBin string) (*benchmark.ScanResult, error)

Scan spins up Juice Shop in Docker, waits for it to come up, runs a stock black-box scan, and tears the container down.

type KnownSet

type KnownSet struct {
	Version         string         `json:"version"`
	Target          string         `json:"target"`
	Negatives       int            `json:"negatives,omitempty"`
	Vulnerabilities []ExpectedVuln `json:"vulnerabilities"`
}

KnownSet is the ground-truth file for a target.

type OWASP

type OWASP struct{}

OWASP is the OWASP Benchmark target.

IMPORTANT (roadmap honesty, Rule 5): OWASP Benchmark is a *Java* web application whose score depends on interprocedural, sanitizer-aware source→sink taint analysis (~half its ~2740 cases are deliberate sanitized false-positive twins, so a line-local matcher scores ~0 on the FP-penalized Youden metric). As of v0.27 Fendix ships Java *regex* SAST (line-local, TierNativeGo) — real coverage, but NOT the deep Java taint analysis this benchmark requires. Emitting a number now would be a garbage baseline, so this target loudly SKIPS in BOTH Scan() and Run() (defence in depth: no all-zero result can reach the baseline/Compare path). It un-SKIPS only when a real Java taint analyzer + a labeled owasp-known.json corpus exist (see NEXT_v029.md). The shipped DAST baseline is DVWA + Juice Shop.

func NewOWASP

func NewOWASP() *OWASP

NewOWASP returns the OWASP Benchmark target.

func (*OWASP) Name

func (o *OWASP) Name() string

Name implements benchmark.BenchmarkTarget.

func (*OWASP) Run

Run also reports skipped. Previously it returned an all-zero BenchmarkResult "for interface completeness"; that was a latent Rule-5 landmine — a future refactor calling Run() without Scan() short-circuiting first would feed a 0.0-recall result into Compare() and flag a phantom regression. SKIP here too so a fabricated number can never be persisted (target_test.go pins this).

func (*OWASP) Scan

func (o *OWASP) Scan(ctx context.Context, fendixBin string) (*benchmark.ScanResult, error)

Scan reports the target as skipped.

type RealWorld

type RealWorld struct {

	// Result is the rich scored outcome attached by Run for the CLI's
	// per-class + triage output. BenchmarkResult (Run's return) is the
	// compact shape the baseline stores.
	Result *benchmark.RealWorldResult
	// contains filtered or unexported fields
}

RealWorld is a SAST corpus target: a source tree at a pinned revision plus a committed labels.yaml. It reuses the scan-production + scoring split of the other targets but scores against labels, not a known-vuln set.

func DiscoverRealWorld

func DiscoverRealWorld(root string) []*RealWorld

DiscoverRealWorld returns a RealWorld target for every committed corpus entry under <root>/benchmarks/realworld/*/manifest.yaml. root "" means cwd.

func NewRealWorld

func NewRealWorld(entryName string) *RealWorld

NewRealWorld returns a RealWorld target for one corpus entry.

func (*RealWorld) Name

func (r *RealWorld) Name() string

Name implements benchmark.BenchmarkTarget: "realworld/<entry>".

func (*RealWorld) Run

Run scores result against the entry's labels. It attaches the rich RealWorldResult to the target (for the CLI's per-class + triage output) and returns the compact BenchmarkResult the baseline stores.

func (*RealWorld) Scan

func (r *RealWorld) Scan(ctx context.Context, fendixBin string) (*benchmark.ScanResult, error)

Scan resolves the source tree and runs fendix; loud-SKIPs a local entry with no path.

func (*RealWorld) TriageReport

func (r *RealWorld) TriageReport() string

TriageReport renders the unknown findings + per-class FP breakdown for one entry, so labeling is incremental and the number stays defensible.

type Target

type Target interface {
	benchmark.BenchmarkTarget
	// Scan runs fendixBin against this target and returns the raw result.
	// Implementations are responsible for setup and teardown (containers,
	// downloads) and must respect ctx cancellation.
	Scan(ctx context.Context, fendixBin string) (*benchmark.ScanResult, error)
}

Target is a benchmark corpus that can both produce a Fendix ScanResult (running Docker / downloading the corpus as needed) and score it.

func All

func All() []Target

All returns every registered benchmark target, including any committed real-world corpus entries discovered under benchmarks/realworld/.

func ByName

func ByName(name string) (Target, error)

ByName returns the registered target with the given name, or an error listing the valid names.

Jump to

Keyboard shortcuts

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