Skip to content

v3.0.8 - data-sen-secret marking (an accident guard, not a boundary) and dialog text kept off disk

Choose a tag to compare

@obra obra released this 30 Sep 15:40
877deae

This release also carries 3.0.7, which was never published on its own.

[3.0.8] - 2026-09-26 - data-sen-secret marking: an accident guard, not a boundary

Added

  • A data-sen-secret marker on an element (or an ancestor of one, through shadow-root hosts) now makes eval, extract and attr refuse rather than hand back that value, protects the marked page from an accidental screenshot or auto-capture write, and gives set_attr a write path to place the marker itself. This is protection against a cooperating agent accidentally re-reading or re-exposing a secret it already marked — not a security boundary. A deliberately adversarial eval runs arbitrary JavaScript in the exact same JS realm as the marked element: it can already read the value directly, fetch() it to another origin, stash it in window.name or storage for another tab to read, or erase the marker with removeAttribute before anything checks again. Same-origin fetch, another tab, or page JavaScript that moves the value out from under the marked element can all still reach it; none of that is gated by anything below. Do not mark an element and then run eval on that page expecting the secret to stay contained Mark the secret's element as soon as the action that revealed it returns, before any other action on that page, then capture the value with the credential broker and use set_attr for any writes. Marking only affects later actions: capture files the revealing action already wrote (typically NNN-navigate.html/.md) keep the value and are not deleted.
    • eval refuses when a marker is present anywhere on the page at the moment of the call — a point check with nothing sticky remembered across calls. It does not re-check after the expression runs and does not remember that a page was ever marked once the call returns; an expression that reveals or removes the marker as part of its own execution is not caught by this, by design (see above — that gap cannot be closed by an in-page check at all, so this does not pretend to).
    • extract and attr refuse when the resolved element, or any ancestor of it (walking up through shadow-root hosts), carries the marker. Where a read is possible without touching the marked value at all — extract's selector/whole-page HTML and markdown forms — they instead read off a clone of the page imported into a fresh, inert document (document.implementation.createHTMLDocument, never the live document) with every [data-sen-secret] descendant stripped before serializing, so a marked descendant elsewhere in a larger fragment doesn't force a full refusal. Whole-page extract in text mode has no such clone available (innerText needs real layout), so it refuses outright instead, the same as eval.
    • Screenshot and auto-capture check the same live marker scan eval uses across the top document, open shadow roots, and same-origin iframe/frame/object/embed — not just a regex over the top document's serialized HTML — before writing anything to disk. Once marked, a page produces no screenshot and no captured .html/.md/console file; files captured before the mark are left as they are.
    • Native dialog (alert/confirm/prompt/beforeunload) text keeps 3.0.7's credential-shape redaction and file suppression; a marker with no matching shape (a bare TOTP seed, say) is not specially redacted in dialog text, which is exactly the "no boundary" limitation stated above, not a regression from 3.0.7.
    • set_attr allows writing exactly two attribute names: data-sen-nonce (a broker nonce, resolved to the single first-VISIBLE match the same way extract/click/type resolve a selector) and data-sen-secret itself. Writing data-sen-secret marks every element the selector matches, hidden duplicates included — not just the one a human would call "the" match — and can never remove or weaken an existing mark: re-marking an already-marked element is a no-op, and marking never touches an attribute other than the marker. set_attr's ok/no element matched/refused: target element is marked responses differ by outcome, so a caller who can vary the selector and watch which result comes back has a prefix oracle over what's on the page; this is the same category of limitation as the shape-blind dialog case above, not something this guard closes.
    • Not covered: markup inside an <iframe srcdoc="…"> attribute. extract's HTML form and attr srcdoc return that attribute text verbatim, marked elements included, even though eval refuses on the same page.
    • SUPERPOWERS_CHROME_ALLOW_CREDENTIAL_CAPTURE=1 disables all of the above, same as the credential-shape guard everywhere else.

Fixed

  • formatActionResponse (used by click, select and eval) ignored the midFlight result shape that withDialogAwarenessForSession returns when the action itself opens a native dialog ({ midFlight, actionResult, dialog, artifacts }). It read url, pageSize and capturePrefix off the top level, where they don't exist on that shape, so the agent got Current URL: unknown, an empty size and a Files: ???.html, … line instead of the dialog text and the dialog::accept/dialog::dismiss instructions — and, when the dialog message was credential-shaped, the ⚠️ … suppressed notice never appeared either (#53). formatActionResponse now renders a midFlight result the same way formatCaptureResponse's null-capture dialog branch already does. Follow-up from #51; doesn't leak (the final redactUnlessAllowed pass still redacts the response text either way).
  • On that same midFlight shape, eval reported Result: undefined because it read the value off the wrapper instead of the wrapped action result. It now shows the evaluated value.

Tests

  • test/response-format-midflight.test.mjs (new): a midFlight result renders the dialog markdown and dialog::accept instructions instead of the capture-shaped fallback, surfaces the suppressed-credential notice when the wrapped action result carries one, falls back to Dialog opened: <kind> only when no artifacts are supplied, and leaves the normal (non-midFlight) capture path unchanged. formatEvalDescription reads the eval value from the wrapped action result on a midFlight result.

[3.0.7] - 2026-09-25 - Native dialog text no longer copied to disk

Security

  • Native dialog text leaked to disk. In 3.0.6 and earlier, the message of an alert/confirm/prompt/beforeunload dialog (and a prompt's default value) was written unredacted to the .md, .html and -console.txt capture files whenever an action ran while a dialog was open or opened one. Page JavaScript controls that text, so a page could put a token there and bypass the 3.0.6 credential-shape guard (#50).
  • Both dialog short-circuits in capture.js (a dialog already open during a capture, and an action that opens one) now apply the same credential-shape check as the rest of auto-capture. On a match no dialog files are written. For actions that open a dialog through the before/after capture path (type, keyboard_press, hover, drag_drop, double_click, right_click, file_upload), the agent still gets the dialog text with credential-shaped substrings replaced by [REDACTED credential-shaped], the dialog::accept/dialog::dismiss instructions, and the ⚠️ … suppressed notice. For click, select and eval the response shows no instructions or notice yet (#53); the next call's dialog refusal carries the redacted text and the instructions. SUPERPOWERS_CHROME_ALLOW_CREDENTIAL_CAPTURE=1 restores the old behavior.
  • Session dirs are normally removed when the server exits, but one left behind by a crash may still hold dialog text captured by 3.0.6 or earlier. Delete old session dirs under superpowers/browser/ in the cache dir ($XDG_CACHE_HOME, else ~/.cache on Linux, ~/Library/Caches on macOS, %LOCALAPPDATA% on Windows).

Changed

  • The use_browser response-formatting helpers (formatCaptureResponse, formatActionResponse, redactUnlessAllowed, etc.) moved from mcp/src/index.ts to the new mcp/src/response-format.ts, mirroring payload.ts, so tests can import them without booting Chrome or an MCP server.

Tests

  • test/lib/capture-credential-guard.test.mjs: both dialog short-circuits write no dialog files for a credential-shaped message, a benign dialog still captures normally, and the opt-out restores capture. The after-dialog branch still returns the dialog artifacts, including the accept/dismiss instructions.
  • test/response-format-dialog-guard.test.mjs (new): formatCaptureResponse returns the notice, the accept/dismiss instructions and the dialog text together for a suppressed dialog, and omits the notice for a benign one.
  • test/credential-guard-mcp.test.mjs: the bundled MCP server on real headless Chrome, typing into a field that opens an alert carrying a token, returns the notice, dialog::accept and [REDACTED credential-shaped], never the raw token, and writes no dialog files.