Skip to main content

Module screenshot_redact

Module screenshot_redact 

Source
Expand description

Black out a browser pane’s secret fields in a screenshot before an agent sees it (docs/specs/SPEC_BROWSER_PANE_FORMS_IN_FRAMES_AND_VISUAL_FALLBACK_2026_10_16.md §5.1 item 4). The host finds the fields and their boxes in the page’s CSS pixels; this paints them over in the image, which is in device pixels.

Constants§

PAD 🔒
CSS pixels added around each box: a field’s border and its focus ring.
UNCHECKED_REFUSAL 🔒
Why a capture the host could not check for secret fields is not given out.

Functions§

black_out 🔒
Paint every box black and return the image as PNG. css_width is the page’s viewport width, which scales the boxes to the image; without it the boxes can’t be placed, so it fails rather than guess.
boxes_of 🔒
paint 🔒
Paint every box black on img, in place.
redact_host_screenshot 🔒
The host’s screenshot answer (data.secret_boxes, data.css_width) applied to its decoded image: unchanged when the page has no secret fields, otherwise blacked out and re-encoded. Err is the message to give instead of the image.
redact_image 🔒
redact_host_screenshot on an image already decoded (a recording’s frame, cropped from the whole viewport): painted over in place, or Err with what to give instead.