TL;DR: Single-page applications create security blind spots because client-side JavaScript, asynchronous requests, and complex session handling can hide XSS, token misuse, and API exposure from traditional scanning, according to Probely. The practical issue is not SPA popularity itself but whether security controls can execute the app’s stateful logic and test its API-dependent attack surface.
At a glance
What this is: This is an analysis of why single-page applications create harder-to-detect security weaknesses, especially around client-side logic, authentication, and API integration.
Why it matters: It matters because IAM-adjacent session handling, token storage, and authenticated API flows in SPAs can fail in ways that traditional scanning and review processes miss.
By the numbers:
- Single-page applications saw a 20% increase in adoption during 2023.
👉 Read Probely's analysis of hidden risks in single-page applications
Context
Single-page applications shift much of application behaviour into the browser, which changes how security teams must think about testing and control coverage. The primary risk is not simply that the interface is dynamic, but that authentication, session state, and API calls are now intertwined with client-side execution in ways many traditional controls were not built to observe.
For IAM and application security teams, that creates a governance gap between what the browser shows, what the API accepts, and what scanners can reliably verify. In practice, SPA security is as much about testing authenticated flows and token handling as it is about finding code flaws, and that makes the problem relevant to both web security and identity governance.
Key questions
Q: How should security teams test single-page applications without relying on browser crawling?
A: They should treat the SPA as a presentation layer and test the underlying APIs directly. The practical approach is to use API specifications, engineering-owned collections, and authenticated endpoint testing so coverage reflects the real service surface, not the routes a browser crawler happened to observe. That gives repeatable results and reduces blind spots.
Q: Why do single-page applications create identity and session risk?
A: SPAs often keep authentication state in the browser and rely on tokens to carry trust across multiple API calls. That increases the impact of weak storage, overlong session life, and client-side exposure. If an attacker can steal or misuse that state, they may impersonate a valid user without breaking the primary login control.
Q: What do teams get wrong about CORS in SPA security?
A: Teams often treat CORS as a browser setting instead of part of the application’s access-control model. In practice, CORS must match backend authorisation, API exposure, and the intended origin boundary. If the browser is allowed to reach an endpoint that the backend does not truly constrain, the configuration becomes an access path.
Q: How do you know SPA security testing is actually working?
A: You know testing is working when it can reproduce the app’s real interactive paths, including token handling, API calls, and state changes that occur after rendering. A good program finds issues in authenticated flows, not just in public pages. If the scanner only reports surface-level findings, coverage is probably incomplete.
Technical breakdown
Why JavaScript execution changes SPA security testing
Single-page applications depend on JavaScript to render state, load content, and route user actions without full page reloads. That means security testing must evaluate the executed page, not just the delivered HTML. Tools that cannot run scripts may miss vulnerabilities that appear only after asynchronous calls complete, including reflected content changes, client-side injection paths, and broken assumptions about what the browser can see versus what the server enforces. The result is a control gap between static inspection and actual runtime behaviour.
Practical implication: test rendered states and scripted flows, not just source code or initial responses.
Session management and token storage in SPAs
SPAs often manage authentication state in the browser, which makes token storage and session handling central security concerns. If access tokens, refresh tokens, or session identifiers are stored or exposed poorly, an attacker who reaches the client can hijack the user session without touching the backend directly. This is especially risky when browser-side logic mixes authentication, authorisation, and API calls inside the same runtime context. In identity terms, the browser becomes part of the trust boundary, so token hygiene matters as much as login assurance.
Practical implication: review browser token handling as an identity control, not just an application detail.
CORS and API integration mistakes expand the attack surface
SPAs rarely operate alone. They depend on APIs, XHR requests, and cross-origin communication, which makes configuration quality a security control in its own right. Misconfigured CORS can allow unauthorised sites to interact with trusted endpoints or expose data to unintended origins. When API authorisation is weaker than the front end suggests, the attacker can use legitimate browser behaviour to reach data or functions the application should not expose. This is where application security and identity enforcement meet at the API boundary.
Practical implication: verify CORS and API authorisation together, because one broken control can undermine the other.
Threat narrative
Attacker objective: The attacker aims to use the SPA’s client-side trust model to reach authenticated data or actions that should have remained protected.
- Entry occurs through a malicious payload, insecure client-side input, or a misused browser session in the SPA runtime.
- Escalation happens when weak token storage, poor session handling, or overly permissive API access turns client-side footholds into authenticated actions.
- Impact follows when attackers can hijack sessions, retrieve sensitive data, or abuse exposed endpoints through the application’s normal asynchronous flows.
NHI Mgmt Group analysis
SPA security is now an identity-adjacent control problem, not just a web testing problem. When session state, token handling, and API authorisation live inside the browser runtime, the application inherits identity risk that traditional scanners often under-measure. That shifts the governance question from whether a page loads correctly to whether authenticated behaviour is actually constrained. Practitioners should treat SPA testing as part of identity and access assurance, not a separate UI exercise.
Client-side blind spots create a verification trust gap. The article shows that tools which cannot execute JavaScript or follow asynchronous state transitions may miss the very conditions where risk appears. That is a named control gap: the security team believes it has coverage, but the runtime path is still unverified. In governance terms, the problem is not lack of scanning alone, but lack of runtime observability across authenticated paths. Practitioners should close the gap with execution-aware testing.
CORS misconfiguration is often an access-control failure disguised as a configuration issue. In SPA architectures, API trust is enforced at the edge of browser-origin rules and backend authorisation checks. If either side is loose, attackers can turn legitimate client behaviour into unintended access. This matters for NHI and machine-to-machine patterns too, because APIs increasingly serve human users, service accounts, and workflow tokens through the same interfaces. Practitioners should review origin policy and API entitlement together.
SPA risk will keep rising because modern application design concentrates more authority in the browser. As organisations build richer workflows into a single client, they also centralise session state, token use, and asynchronous data handling in a place attackers can directly influence. That makes secure-by-design application architecture inseparable from identity governance. Practitioners should expect SPA assessment to become a standard part of access assurance, data protection, and secure SDLC reviews.
Named concept: client-side verification gap. This is the mismatch between what a scanner can prove from static or partial rendering and what the application actually does after JavaScript execution and authenticated interaction. It is especially dangerous in SPAs because the controls most people trust are often only visible after the page is already live. Practitioners should measure runtime coverage, not just page coverage.
What this signals
Single-page applications are becoming a higher-value target because they concentrate access decisions, session state, and data movement in the browser. That means security programmes need to measure more than code quality. They need evidence that authenticated client-side flows are being exercised, observed, and constrained in production-like conditions.
Client-side verification gap: organisations that rely on scanners without JavaScript execution support will continue to miss runtime issues in SPAs. The practical response is to combine dynamic testing with identity-aware validation of sessions, tokens, and API entitlements, using the NIST Cybersecurity Framework 2.0 and the NIST Cybersecurity Framework 2.0 as the governance baseline.
As application design moves further into asynchronous and browser-mediated workflows, the line between web security and access governance keeps narrowing. Teams that already manage NHI or machine-to-machine trust should pay attention, because the same lifecycle discipline that governs secrets and tokens also applies to browser-mediated authentication flows.
For practitioners
- Test rendered application states Use scanning and testing tools that execute JavaScript, follow XHR traffic, and validate the post-render state of critical pages. Static crawling alone will not expose the full SPA attack surface.
- Review browser token handling Check where access tokens and session identifiers are stored, how long they persist, and whether the browser can expose them through scripts or logging. Treat this as an identity control review, not a front-end only task.
- Validate API authorisation independently of the UI Confirm that every API endpoint enforces its own authentication and authorisation rules, even when the front end appears to gate access correctly. A secure interface can still hide an exposed backend path.
- Audit CORS and origin rules together Test whether cross-origin settings allow only the intended origins and methods, and verify that those settings align with backend access policy. Misaligned origin trust can turn a client convenience into data exposure.
Key takeaways
- SPAs hide risk in runtime behaviour, where JavaScript execution, sessions, and API calls matter more than the initial page response.
- Traditional scanning can miss the relevant attack paths, which creates blind spots in authenticated flows, token storage, and CORS enforcement.
- Security teams should treat SPA testing as part of identity and access assurance, not just as a web application check.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-53 Rev 5 and CIS Controls v8 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| NIST CSF 2.0 | PR.AC-4 | SPA session and API access control map directly to access management and least privilege. |
| NIST SP 800-53 Rev 5 | AC-6 | Least privilege is central when browser-side sessions can reach multiple API functions. |
| MITRE ATT&CK | TA0006 , Credential Access; TA0007 , Discovery; TA0009 , Collection | The article’s abuse paths involve session theft, client-side discovery, and data collection through web flows. |
| CIS Controls v8 | CIS-16 , Application Software Security | SPA security depends on secure testing and validation across application workflows and interfaces. |
| OWASP Agentic AI Top 10 | While not an agentic AI article, the internal link resource is useful for modern client-side attack-surface thinking. |
Use the OWASP agentic guidance only as a comparator for dynamic runtime risk patterns, not as a direct control map.
Key terms
- Single Page Application: A Single Page Application is a client-heavy web application that updates the interface dynamically without full page reloads. That architecture changes how endpoints are discovered and exercised, which is why many legacy scanning approaches produce incomplete results in modern front ends.
- Client-side verification gap: The client-side verification gap is the difference between what static or partial testing can observe and what the application actually does after JavaScript execution and user interaction. In SPAs, that gap can hide vulnerable flows, flawed token handling, and API access paths that only appear during real runtime behaviour.
- CORS: Cross-Origin Resource Sharing is a browser security mechanism that decides whether a web page from one origin may access resources from another origin. It relies on server-supplied headers to express trust boundaries, and it becomes security-relevant whenever browser sessions carry identity context across domains.
- XHR: XMLHttpRequest, often shortened to XHR, is a browser mechanism used to send asynchronous requests from a web page to an API. In single-page applications, XHR traffic carries much of the application’s business logic, so security testing must inspect it to understand the true attack surface and authorisation behaviour.
What's in the full article
Probely's full article covers the operational detail this post intentionally leaves for the source:
- JavaScript-aware scanning workflow for SPAs and why rendered-state inspection changes detection quality
- API and XHR traversal behaviour that shows how dynamic requests expand the test surface
- CORS validation and configuration checks that teams can use to verify browser-origin boundaries
- Practical examples of how authenticated flows and session handling are exercised during scanning
Deepen your knowledge
The NHI Foundation Level course, the industry's only accredited NHI security programme, covers NHI governance, machine identity security, IAM, and secrets management. It helps security practitioners connect identity controls to the broader application and access patterns that shape modern programmes.
Published by the NHIMG editorial team on August 18, 2026.
NHI Mgmt Group — the independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org