How ardayesilcayir/authdiff works
authdiff is a Go CLI and library for differential REST API authorization testing; vuln-lab is its intentionally vulnerable demo target. The main workflow loads configuration and an OpenAPI inventory, probes endpoints with multiple identity profiles and rules, compares responses into findings, then writes reports. Source excerpts show the CLI, orchestration, transport, and lab wiring; several scan internals are unsampled, so their detailed call relationships are not asserted.
Main entry points: authdiff.go Public orchestration · engine.go Scan engine · db.py Lab database · finding.go Finding records
Components 26
CLI and API
- Command entry
cmd/authdiff/main.go - Scan command
internal/cli/scan.go - Public orchestration
pkg/authdiff/authdiff.go
Scan pipeline
- Config validation
internal/config/config.go - Spec inventory
internal/spec/loader.go - Identity profiles
internal/identity/profile.go - Ownership data
internal/identity/ownership.go - Request planner
internal/planner/planner.go - Rule loader
internal/rules/loader.go - Rule evaluation
internal/rules/eval.go - Scan engine
internal/engine/engine.go - Template checks
internal/engine/template.go - Specialized checks
internal/engine - Scoped transport
internal/transport/client.go
Findings and reports
- Response comparison
internal/compare/structural.go - Finding records
internal/finding/finding.go - Ignore baseline
internal/finding/baseline.go - Report formats
internal/report/write.go
Vulnerable demo API
- Lab app and routes
vuln-lab/app/main.py - Lab authentication
vuln-lab/app/auth.py - Lab data models
vuln-lab/app/models.py - Lab database
vuln-lab/app/db.py - Lab seed data
vuln-lab/app/seed.py - Lab tokens
vuln-lab/app/tokens.py
Other components
- Operator
- Target REST API
Connections 28
- Operator → Command entry: runs
- Command entry → Scan command: dispatches
cmd/authdiff/main.go - Scan command → Public orchestration: starts scan
internal/cli/scan.go - Scan command → Report formats: writes reports
internal/cli/scan.go - Public orchestration → Config validation: loads config
pkg/authdiff/authdiff.go - Public orchestration → Spec inventory: loads inventory
pkg/authdiff/authdiff.go - Public orchestration → Rule loader: loads rules
pkg/authdiff/authdiff.go - Public orchestration → Scoped transport: builds client
pkg/authdiff/authdiff.go - Public orchestration → Scan engine: runs scan
pkg/authdiff/authdiff.go - Scan engine → Identity profiles: creates profiles
internal/engine/engine.go - Scan engine → Request planner: builds requests
internal/engine/engine.go - Scan engine → Rule evaluation: evaluates rules
- Template checks → Response comparison: compares responses
internal/engine/template.go - Template checks → Finding records: creates findings
internal/engine/template.go - Template checks → Scoped transport: sends probes
internal/engine/template.go - Ownership data → Config validation: uses config
internal/identity/ownership.go - Request planner → Identity profiles: uses profiles
internal/planner/planner.go - Rule evaluation → Finding records: evaluates against
internal/rules/eval.go - Finding records → Ignore baseline: suppressed by
- Report formats → Finding records: renders
- Scoped transport → Target REST API: sends requests
- Lab app and routes → Lab database: initializes
vuln-lab/app/main.py - Lab app and routes → Target REST API: serves routes
vuln-lab/app/main.py - Lab authentication → Lab database: gets sessions
vuln-lab/app/auth.py - Lab authentication → Lab tokens: decodes tokens
vuln-lab/app/auth.py - Lab authentication → Lab data models: loads users
vuln-lab/app/auth.py - Lab database → Lab data models: stores models
vuln-lab/app/db.py - Lab database → Lab seed data: seeds database
vuln-lab/app/db.py