authz

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package authz holds the authentication and access-control checks. Like dast, it is a SKELETON: metadata, modes, standards mapping and remediation are complete; the testing logic is a stub for you to implement. The same rules apply — every request through core.HTTPClient(ctx), test accounts only, non-destructive, honor the declared Mode().

Access-control checks (IDOR, privilege escalation) need two configured test identities to compare what each may reach. That surface now exists (scout.WithTestIdentities / core.Target.Identities); IDOR uses it. Supply disposable test accounts only — never real user accounts.

JWT checks inspect a token the operator supplies (passive analysis of its header/claims) — not a brute force. "Weak secret" cracking is out of scope here; detect alg:none, missing/!verified signature and missing expiry.

Index

Constants

This section is empty.

Variables

View Source
var RemediationCORS = core.Remediation{
	What:       "The server reflects arbitrary origins (or uses '*') while allowing credentials.",
	Why:        "A malicious site can make authenticated cross-origin requests and read the responses, stealing data on behalf of a logged-in user.",
	How:        []core.Fix{{Stack: "generic", Language: "text", Code: "Allowlist specific trusted origins; never combine Access-Control-Allow-Credentials: true with a reflected or wildcard origin."}},
	Effort:     core.EffortS,
	References: []string{"https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS"},
}
View Source
var RemediationIDOR = core.Remediation{
	What:       "An object is served based on an ID in the request without checking the caller owns it.",
	Why:        "An attacker changes an ID in the URL or body to read or modify other users' data.",
	How:        []core.Fix{{Stack: "generic", Language: "text", Code: "Enforce an ownership/role check on every object access, server-side; prefer unguessable IDs but never rely on them for authorization."}},
	Effort:     core.EffortM,
	References: []string{"https://owasp.org/Top10/A01_2021-Broken_Access_Control/"},
}
View Source
var RemediationJWT = core.Remediation{
	What:       "A JSON Web Token accepts an unsafe algorithm, is not signature-verified, or never expires.",
	Why:        "alg:none or unverified signatures let an attacker forge tokens and impersonate any user; tokens without expiry stay valid forever if stolen.",
	How:        []core.Fix{{Stack: "generic", Language: "text", Code: "Pin the expected algorithm (reject 'none'), always verify the signature with the server key, set a short 'exp', and rotate signing keys."}},
	Effort:     core.EffortM,
	References: []string{"https://cheatsheetseries.owasp.org/cheatsheets/JSON_Web_Token_for_Java_Cheat_Sheet.html"},
}
View Source
var RemediationMassAssignment = core.Remediation{
	What:       "An endpoint binds request fields straight onto a model, including fields the user should not set.",
	Why:        "An attacker adds a field such as a role or account flag to escalate privileges or tamper with data.",
	How:        []core.Fix{{Stack: "generic", Language: "text", Code: "Bind to an explicit allowlist DTO of editable fields; never bind untrusted input directly onto persistent models."}},
	Effort:     core.EffortM,
	References: []string{"https://cheatsheetseries.owasp.org/cheatsheets/Mass_Assignment_Cheat_Sheet.html"},
}
View Source
var RemediationMissingAuth = core.Remediation{
	What:       "An endpoint that exposes protected functionality or data has no authentication.",
	Why:        "Anyone can call it directly, bypassing the app's login entirely.",
	How:        []core.Fix{{Stack: "gin", Language: "go", Code: "// Apply auth middleware to the protected group, not per-handler ad hoc:\nprotected := r.Group(\"/api\", AuthRequired())\nprotected.GET(\"/account\", accountHandler)"}},
	Effort:     core.EffortM,
	References: []string{"https://owasp.org/Top10/A01_2021-Broken_Access_Control/"},
}

Functions

func Checks

func Checks() []core.Check

Checks returns every access-control check, implemented or not, for metadata and template tests.

Types

type CORS

type CORS struct{}

func (CORS) Category

func (CORS) Category() core.Category

func (CORS) Description

func (CORS) Description() string

func (CORS) ID

func (CORS) ID() string

func (CORS) Mode

func (CORS) Mode() core.Mode

func (CORS) OWASP

func (CORS) OWASP() []string

func (CORS) Run

func (c CORS) Run(ctx context.Context, t core.Target) ([]core.Finding, error)

type IDOR

type IDOR struct{}

func (IDOR) ASVS

func (IDOR) ASVS() []string

func (IDOR) Category

func (IDOR) Category() core.Category

func (IDOR) Description

func (IDOR) Description() string

func (IDOR) ID

func (IDOR) ID() string

func (IDOR) Mode

func (IDOR) Mode() core.Mode

func (IDOR) OWASP

func (IDOR) OWASP() []string

func (IDOR) Run

func (c IDOR) Run(ctx context.Context, t core.Target) ([]core.Finding, error)

type JWT

type JWT struct{}

func (JWT) ASVS

func (JWT) ASVS() []string

func (JWT) Category

func (JWT) Category() core.Category

func (JWT) Description

func (JWT) Description() string

func (JWT) ID

func (JWT) ID() string

func (JWT) Mode

func (JWT) Mode() core.Mode

func (JWT) OWASP

func (JWT) OWASP() []string

func (JWT) Run

func (c JWT) Run(ctx context.Context, t core.Target) ([]core.Finding, error)

type MassAssignment

type MassAssignment struct{}

func (MassAssignment) Category

func (MassAssignment) Category() core.Category

func (MassAssignment) Description

func (MassAssignment) Description() string

func (MassAssignment) ID

func (MassAssignment) ID() string

func (MassAssignment) Mode

func (MassAssignment) Mode() core.Mode

func (MassAssignment) OWASP

func (MassAssignment) OWASP() []string

func (MassAssignment) Run

type MissingAuth

type MissingAuth struct{}

func (MissingAuth) Category

func (MissingAuth) Category() core.Category

func (MissingAuth) Description

func (MissingAuth) Description() string

func (MissingAuth) ID

func (MissingAuth) ID() string

func (MissingAuth) Mode

func (MissingAuth) Mode() core.Mode

func (MissingAuth) OWASP

func (MissingAuth) OWASP() []string

func (MissingAuth) Run

func (c MissingAuth) Run(ctx context.Context, t core.Target) ([]core.Finding, error)

Jump to

Keyboard shortcuts

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