democmd

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: 11 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 democmd implements the `fendix demo` subcommand: spin up OWASP Juice Shop locally in Docker, run a stock fendix scan against it, render an HTML report, and (optionally) open the report in the default browser. Removes the cold-start "what does a real scan look like?" question for first-time evaluators.

The command shells out to the host's docker CLI rather than using a Docker SDK; this avoids a heavy dependency, matches the existing scripts/benchmark/run-juice-shop.sh pattern, and works everywhere the user's docker setup works (Docker Desktop, Colima, OrbStack, etc.).

Index

Constants

View Source
const (
	DefaultImageRef       = "bkimminich/juice-shop:v17.1.1"
	DefaultPort           = 3000
	DefaultContainerName  = "fendix-demo"
	DefaultHealthTimeout  = 90 * time.Second
	DefaultScanTimeout    = 5 * time.Minute
	DefaultHealthInterval = 2 * time.Second
)

Defaults — can be overridden via Options.

Variables

View Source
var (
	ErrDockerMissing       = errors.New("docker not found on PATH")
	ErrFendixBinaryMissing = errors.New("could not locate fendix binary; pass --fendix-bin")
	ErrPortInUse           = errors.New("local port already in use")
	ErrJuiceShopNotReady   = errors.New("juice-shop did not become healthy within the timeout")
	ErrScanFailed          = errors.New("fendix scan failed")
)

Errors returned by Run. Distinguished so the calling cobra command can map them to actionable user messages.

Functions

func Run

func Run(ctx context.Context, opts Options) (reportPath string, err error)

Run executes the demo flow. Always cleans up the container on exit. Returns the path of the rendered HTML report on success.

Types

type Options

type Options struct {
	ImageRef       string
	Port           int
	ContainerName  string
	OutputPath     string // HTML report path. If empty, derived to $TMPDIR/fendix-demo-<unix>.html.
	OpenAfter      bool
	FendixBin      string // Defaults to /proc/self/exe (the running fendix binary).
	HealthTimeout  time.Duration
	ScanTimeout    time.Duration
	HealthInterval time.Duration

	// Stdout, Stderr are where progress and command output stream.
	// Default to os.Stdout / os.Stderr when nil.
	Stdout, Stderr io.Writer
	// contains filtered or unexported fields
}

Options configures Run. Zero-valued fields use the Default* constants above. The struct is deliberately public so callers (cobra subcommand, future fendix-demo Docker recipe) can wire in their own paths.

Jump to

Keyboard shortcuts

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