SPA backends security

What middleBrick covers

  • Black-box API scanning with under one minute turnaround
  • Authentication and JWT misconfiguration detection
  • BOLA and BFLA authorization testing
  • OpenAPI spec parsing with recursive reference resolution
  • Authenticated scan support with strict header allowlists
  • Continuous monitoring and diff-based alerting

SPA backend API threat model

Single-page applications rely on a backend API for authentication, data, and business logic. Because the client is fully observable, attackers focus on the API surface rather than the UI. Black-box scanning targets endpoints that handle user sessions, tokens, and dynamic data paths. The implicit trust of frontend-originated requests makes authentication, authorization, and input validation critical controls.

Authentication and security header checks

The scanner evaluates how APIs manage identity and transport security. It checks for JWT misconfigurations such as alg=none, weak HS256 keys, expired tokens, missing standard claims, and sensitive data embedded in payloads. Security headers and WWW-Authenticate compliance are assessed to verify proper challenge and protection mechanisms. These checks map findings to OWASP API Top 10 controls around identification and authentication failures.

Broken object level authorization and function level authorization

BOLA and BFLA are tested through ID enumeration and privilege escalation probes. Sequential ID patterns are followed by adjacent ID scanning to detect insecure direct object references. Admin endpoint discovery and role/permission field inspection surface authorization bypass risks. Findings align with OWASP API Top 10 and support audit evidence for SOC 2 Type II control observance.

Input validation, data exposure, and infrastructure safety

Input validation checks include CORS wildcard usage with credentials, dangerous HTTP methods, and debug endpoints. Data exposure detection targets PII patterns such as emails, Luhn-validated card numbers, context-aware SSN formats, and API key leaks. Infrastructure safety measures block private IPs, localhost, and cloud metadata endpoints, ensuring scans remain read-only and non-intrusive. These findings help you prepare for security controls described in PCI-DSS 4.0 and related standards.

OpenAPI analysis and authenticated scanning details

OpenAPI 3.0, 3.1, and Swagger 2.0 files are parsed with recursive $ref resolution. The scanner cross-references spec definitions against runtime behavior to find undefined security schemes, sensitive fields, deprecated operations, and missing pagination. Authenticated scans support Bearer, API key, Basic auth, and cookies, guarded by domain verification to ensure only domain owners can scan with credentials. Header allowlists restrict forwarded headers to Authorization, X-API-Key, Cookie, and X-Custom-*.

Limitations and complementary security practices

The scanner does not perform active SQL injection or command injection, as those require intrusive payloads outside its scope. Business logic vulnerabilities and blind SSRF are not detectable without out-of-band infrastructure or domain knowledge. It does not replace a human pentester for high-stakes audits. Use the tool for continuous monitoring and to surface findings relevant to audits, while relying on specialists for deep validation.

Frequently Asked Questions

Can the scanner detect all OWASP API Top 10 risks?
It detects many automated indicators such as misconfigurations, enumeration patterns, and data exposure. Business logic and some advanced injection classes require human expertise and contextual understanding.
How are scan credentials handled during authenticated scans?
Credentials are accepted only after domain verification via DNS TXT or a well-known file. Only a limited set of headers are forwarded, and scans operate in read-only mode.
Does the scanner perform destructive testing such as SQL injection?
No. The scanner uses read-only methods and does not send destructive payloads. SQL injection and command injection testing are outside its scope.
What compliance mappings does the scanner provide?
Findings map to OWASP API Top 10 (2023) and support audit evidence for SOC 2 Type II and PCI-DSS 4.0. Other frameworks are referenced with alignment language rather than certification claims.