A DOM sink is any browser API or rendering path that can place untrusted data into executable or dangerous HTML context. Examples include innerHTML, script creation, and unsafe SVG handling. If untrusted input reaches a sink without encoding or sanitisation, the result can be script execution.
Expanded Definition
A DOM sink is the destination point where browser-executed content becomes dangerous if untrusted data arrives without proper encoding, sanitisation, or policy enforcement. In practice, this includes HTML insertion APIs, script-bearing attributes, template rendering paths, and browser behaviours that interpret markup rather than display it. In web security guidance, sinks matter because the same input can be harmless in one context and executable in another. Standards-based input handling principles in NIST SP 800-53 Rev 5 Security and Privacy Controls align with the same core requirement: control how data is rendered, not just where it is stored. In DOM security work, the term is often discussed alongside trusted types, output encoding, and context-aware sanitisation, but definitions vary across vendors on how broad the sink boundary should be. The most common misapplication is treating source validation as sufficient, which occurs when teams sanitise input early but later pass it into a dangerous DOM API without preserving context.
Examples and Use Cases
Implementing sink-level protection rigorously often introduces developer friction and may limit rich UI patterns, requiring organisations to weigh user experience and delivery speed against execution safety.
- Replacing direct HTML assignment with context-aware rendering so user comments display as text rather than active markup.
- Reviewing templating code for browser APIs that can turn plain strings into executable content, then blocking those paths with policy checks.
- Using a sanitisation pipeline before rich text is inserted into a page, especially when content is sourced from users, vendors, or AI-generated assistants.
- Testing unsafe SVG handling and script creation paths during code review and dynamic analysis, then documenting the approved rendering surface.
- Applying guidance from the Ultimate Guide to NHIs when browser-based admin tools expose tokens or service data through front-end rendering flows.
For a deeper control baseline, teams often map browser output handling to NIST SP 800-53 Rev 5 Security and Privacy Controls and then constrain only the specific DOM APIs that can cross into executable context. In NHI-heavy applications, sinks are not only a frontend concern but also a control boundary for secrets, tokens, and operator-visible payloads.
Why It Matters in NHI Security
DOM sinks matter because NHI security often depends on web consoles, automation dashboards, and admin portals that display secrets, tokens, access logs, and workflow outputs. If an attacker can push untrusted content into a sink, they may pivot from a simple content issue into session theft, credential capture, or unauthorized action against service accounts. That risk is amplified by the NHI realities documented in the Ultimate Guide to NHIs, where 97% of NHIs carry excessive privileges and 79% of organisations have experienced secrets leaks, with 77% resulting in tangible damage. A compromised rendering path can expose those secrets to browser-side theft or misuse before backend controls ever trigger.
Because browser sinks sit at the point where data becomes execution, they are also where many identity and access failures become visible. Teams should treat them as governance boundaries, not just code quality issues, and pair them with defensive controls such as strict output encoding, allowlisted HTML handling, and reduced privilege in any UI that can surface NHI material. Organisations typically encounter the operational impact only after a dashboard is defaced, a secret is exfiltrated, or a service account is abused, at which point DOM sink control 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 and OWASP Agentic AI Top 10 address the attack and risk surface, while NIST CSF 2.0, NIST SP 800-63 and NIST Zero Trust (SP 800-207) set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| OWASP Non-Human Identity Top 10 | NHI-03 | Dangerous DOM rendering can expose NHI secrets and session data through browser compromise. |
| OWASP Agentic AI Top 10 | A2 | Agentic UIs can turn untrusted content into executable actions through unsafe DOM sinks. |
| NIST CSF 2.0 | PR.DS-1 | Protects data in transit and rendering paths from unauthorized disclosure or manipulation. |
| NIST SP 800-63 | Authentication data rendered in the browser must not be exposed through unsafe DOM contexts. | |
| NIST Zero Trust (SP 800-207) | AC-4 | Zero trust policy enforcement depends on limiting what the browser can execute or reveal. |
Lock down any UI path that can reveal NHI secrets and validate every HTML insertion point.
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Reviewed and updated by the NHIMG editorial team on August 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org