Documentation
¶
Overview ¶
Package application holds the checks that belong to the APPLICATION rather than to whatever backend sits behind it.
It exists because application-route scanning was inside the Supabase plan. The routes pass probes an application's own endpoints for inconsistent authorisation -- a family where /api/orders/1 requires a session and /api/orders/2 does not -- and that has nothing to do with PostgREST, RLS or any database. It lived there because that is where the scan happened to be built, and the consequence was measured on a live target: a Firebase project whose routes run on Cloud Run with the service account's own privilege, and a scan that reported "no application routes assessed".
Nothing here may import a backend. That is the whole point: these checks run whatever was found behind the application, including nothing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ArtRoutes = scan.ArtifactOf[routes.Result]() ArtAccess = scan.ArtifactOf[scan.Access]() ArtCoverage = scan.ArtifactOf[scan.ApplicationCoverage]() )
Functions ¶
func Stages ¶
Stages is the ordered application scan.
One stage today. The shape is what matters: history, preview deployments and subdomain enumeration are also application-level rather than database-level, and they stay in the Supabase plan for now only because each of them currently looks for a SUPABASE credential -- moving them needs that dependency broken first, which is a separate change and not one to fold in silently here.
Types ¶
type Config ¶
type Config struct {
Site string
HARFiles []string
// AllowedOrigins is the exact set of cross-origin application backends the
// operator explicitly placed in scope.
AllowedOrigins []string
// Web is the ordinary HTTP client. Application routes are not an API
// origin and must not inherit its headers.
Web *client.Client
Limiter *client.Limiter
Timeout time.Duration
Concurrency int
// MaxBundles is the operator's -max-bundles, threaded to the route reader
// so the flag actually binds it.
MaxBundles int
// MaxRoutes bounds endpoint paths across every scoped application origin.
MaxRoutes int
// MaxBypassRoutes bounds the more expensive alternative-request matrix.
MaxBypassRoutes int
UserAgent string
Redact bool
// AllowPOST is write consent. A POST to an application's own endpoint can
// trigger side effects in a system this scanner knows nothing about.
AllowPOST bool
NoResidue bool
SkipRoutes bool
// RouteParams are values the operator supplied for path templates, so an
// endpoint like /invoices/{id} can be probed as a record they named.
RouteParams map[string]string
// Principals are labelled identities (-principal a=<jwt>), so a record one
// account reads can be asked for as another. Two are required: the check
// compares three answers and cannot be made sound with fewer.
Principals []string
}
Config is what the application checks need: the site, the shared clients and the operator's controls. No project reference, no anon key, no backend.
type RoutesStage ¶
RoutesStage checks the application's own endpoints for inconsistent authorisation.
Ported from the "// ---- application routes ----" section of scanTarget. The database is not the only holder of privilege: app routes usually run with the service_role key, which ignores RLS entirely, so a route that answers anonymously while its siblings demand credentials is a hole the database checks cannot see.
func (RoutesStage) Describe ¶
func (r RoutesStage) Describe() scan.StageDescriptor
RoutesStage declares itself, so the application plan is validated like any other. It requires nothing: an application's endpoints are discovered from the application, not from a database.
func (RoutesStage) Name ¶
func (RoutesStage) Name() string