# No sensitive fields captured from DOM without user interaction

- **Pattern:** `ab-001300` (`extension-data-privacy.data-collection.no-sensitive-dom-capture`)
- **Severity:** critical
- **Lifecycle:** active
- **Last modified:** 2026-04-18
- **Canonical URL:** https://auditbuffet.com/patterns/ab-001300
- **License:** CC-BY-4.0 — attribute to AuditBuffet Pattern Catalog (https://auditbuffet.com/patterns/ab-001300)

## Why it matters

Content scripts run in the context of every web page the user visits, giving them direct DOM access to password fields, credit card inputs, and API key fields. Automatically reading these values — even for seemingly benign purposes like autofill — is classified as unauthorized data access under OWASP 2021 A02 and CWE-200. A compromised extension or malicious update can silently exfiltrate credentials at scale across every site the user visits. The Chrome Web Store User Data Policy explicitly prohibits capturing sensitive fields without user initiation; violations result in immediate takedown and potential account termination.

## Severity rationale

Critical because automatic DOM capture of password or credit card fields enables credential theft at browser scale — an attacker who compromises the extension gains silent keylogger capability across every site the user visits.

## Remediation

Remove all automatic sensitive field access from content scripts. If your extension must interact with credential fields, require a preceding user gesture:

```js
// content.js — only activate on explicit user click
document.addEventListener('click', (e) => {
  if (e.target.matches('input[type="password"]')) {
    if (confirm('Allow extension to read this field?')) {
      const value = e.target.value;
      // process value
    }
  }
});
```

For legitimate credential management, use the browser's native [Credential Management API](https://developer.mozilla.org/en-US/docs/Web/API/Credential_Management_API) with explicit user consent rather than direct DOM reads.

## Detection

**The detection method for this pattern is part of AuditBuffet Pro.**

The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the [Extension Data Privacy Audit](https://auditbuffet.com/audits/extension-data-privacy). The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.

## External references

- cwe CWE-200
- cwe CWE-319
- owasp A02
- external chrome-web-store-user-data-policy — https://developer.chrome.com/docs/webstore/user_data/

Taxons: injection-and-input-trust, privacy-consent

HTML version: https://auditbuffet.com/patterns/ab-001300
