Documentation
¶
Overview ¶
Package finding defines the payload checks attach to a harnessx.Result when they detect a vulnerability. scan.Scan's harnessx.Reporter bridge reads it back out and turns it into a reportx.Finding.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsUnauthorizedStatusCodeOrSimilar ¶
IsUnauthorizedStatusCodeOrSimilar reports whether res's status code looks like an authorization/validation rejection rather than a success.
func NewHTTPEvidence ¶
func NewHTTPEvidence(attempt *Attempt) *evidence.HTTPEvidence
NewHTTPEvidence builds reportx HTTP evidence from an attempt's request/response. Returns nil if attempt has no request to describe.
Types ¶
type Attempt ¶
type Attempt struct {
ID string
Request *http.Request
RequestBody []byte
Response *Response
Err error
}
Attempt is the decisive request/response pair a check made against an operation, used both to decide pass/fail and as report evidence.
func Fetch ¶
func Fetch(ctx context.Context, op *operation.Operation, securityScheme *auth.SecurityScheme) (*Attempt, error)
Fetch sends a request against op, applying securityScheme's headers/ cookies (or op's own security scheme if securityScheme is nil), and returns the resulting Attempt. The returned Attempt is non-nil even when err is non-nil, mirroring the previous scan.ScanURL contract.
type Finding ¶
type Finding struct {
// Operation identifies the affected operation for ScopeGlobal checks
// (which have no harnessx.Result.ResourceID to resolve one from). Leave
// nil for ScopePerResource checks - the bridge resolves the operation
// from the resource that was scanned.
Operation *operation.Operation
// Parameter is the crafted payload / discovered value (e.g. the cracked
// secret, the alg=none variant used, the discovered path).
Parameter string
// Attempt is the decisive request/response that proves the finding, if
// any (nil for offline checks, e.g. cryptographic secret cracking).
Attempt *Attempt
// Extra carries anything else worth keeping in the report.
Extra map[string]string
// Data carries check-specific structured data for dependent checks to
// read back out via harnessx.ResultStore (e.g. the winning
// *operation.Operation a downstream check needs to replay). Most checks
// leave this nil - it exists for the rare case where a check both
// reports its own finding and feeds a typed payload to a dependent
// check.
Data any
}
Finding is the payload a check returns (as harnessx.Result.Data) when it detects a vulnerability. A check that passes returns a bare harnessx.Result{} instead - the presence of a *Finding is itself the vulnerable/not-vulnerable signal.
type Response ¶
Response is the HTTP response half of an Attempt.