Join our Newsletter — 33% off our NHI Course

Local Storage

Local storage is browser-resident data saved on a user’s device by a website. It is useful for preserving settings such as consent choices or interface state, but it is not a server-side record. Because it persists until cleared, teams should treat it as part of the site’s privacy and governance surface.

Expanded Definition

Local storage is a browser-side persistence layer that lets a website save key-value data on a device and retrieve it later without a server round trip. In practice, it is used for preferences, draft state, consent choices, and lightweight application context. It differs from cookies because it is typically not sent with every request, and it differs from server-side records because the website does not control the data once it is written to the browser.

For NHI and IAM teams, the security question is not whether local storage is convenient, but whether it is appropriate for any data that influences authentication, authorisation, or auditability. Guidance varies across vendors on how much application state is safe to cache locally, but the privacy principle is stable: anything stored in the browser should be assumed recoverable by the user, the browser, extensions, or malware with access to the profile. The MDN localStorage reference remains the clearest browser-level description of its behaviour.

The most common misapplication is treating local storage as a secure vault for tokens or privileged session data, which occurs when teams optimise for convenience and overlook device-level exposure.

Examples and Use Cases

Implementing local storage rigorously often introduces a tradeoff between user experience and data exposure, requiring organisations to weigh fast client-side state recovery against the risk of retaining sensitive material on an unmanaged device.

  • Saving UI preferences such as theme, language, or table layout so a returning user sees the same interface state.
  • Remembering that a consent banner was accepted, while keeping the legal record on the server rather than in the browser.
  • Caching non-sensitive draft form input so a user can resume a workflow after navigation or refresh.
  • Storing ephemeral application hints, while keeping API keys and access tokens out of the browser entirely, as reinforced by NIST guidance in the NIST Cybersecurity Framework 2.0.
  • Debugging a customer portal where state disappears unexpectedly, then reviewing whether local storage was used for the wrong category of data.

For a real-world cautionary example, the Google Firebase misconfiguration breach illustrates how browser-accessible or publicly reachable application data can become far more visible than intended when developers blur the boundary between client state and protected records.

Why It Matters in NHI Security

Local storage matters because browser-resident state can become an indirect control point for NHI workflows, especially when teams store identifiers, session hints, or recovery data that influences how an agent, service account, or user session behaves. Once sensitive material is placed in the browser, governance must account for persistence, retention, and removal on shared or unmanaged endpoints. This is where local storage intersects with broader NHI risk: the issue is rarely the storage API itself, but the decision to put anything there that should have remained server-side or in a managed secret store.

The NHI Management Group has found that 79% of organisations have experienced secrets leaks, with 77% resulting in tangible damage, which underscores how quickly convenience-driven storage decisions can become incident drivers. Local storage should therefore be treated as part of the privacy and governance surface, consistent with the identity and data control expectations reflected in NIST Cybersecurity Framework 2.0 and browser security guidance such as the MDN localStorage reference.

Organisations typically encounter the consequences only after a token, identifier, or sensitive preference is exposed during incident response, at which point local storage becomes operationally unavoidable to address.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP Non-Human Identity Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-63, NIST Zero Trust (SP 800-207) and NIST AI RMF set the governance and control requirements practitioners need to meet.

Framework Control / Reference Relevance
NIST CSF 2.0 PR.DS-1 Local storage affects data-at-rest protection and retention decisions in browser contexts.
OWASP Non-Human Identity Top 10 NHI-05 Browser-stored secrets increase exposure and weaken non-human identity protection.
NIST SP 800-63 Identity assurance guidance discourages weak client-side handling of authenticators and session material.
NIST Zero Trust (SP 800-207) PR.AC-1 Zero Trust assumes client state is not trustworthy for access decisions.
NIST AI RMF AI risk governance covers data handling choices that can expose user or agent context.

Keep sensitive NHI-related data out of browser storage and classify any retained client data by impact.