Add screenshot capture with configurable always/on_error/never modes#1
Open
bigtiger wants to merge 1 commit into
Open
Add screenshot capture with configurable always/on_error/never modes#1bigtiger wants to merge 1 commit into
bigtiger wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
screenshots:option toPerchfall::Client#run, accepting:always,:on_error(default), or:neverreport.screenshotsto_h/to_jsonby default; opt-in viainclude_screenshots: trueto prevent accidental leakage of sensitive page content into logs and serialised payloadsDetails
The Node script accepts a
--screenshotflag and returns the captured PNG as base64 in the JSON output under thescreenshotskey. On theon_errorpath, capture runs inside a.catch(() => null)guard so a screenshot failure never obscures the underlying page error.The safe-by-default serialisation decision mirrors the existing SSRF protections: screenshot data from authenticated pages can contain session tokens, PII, or internal tooling state. Callers must explicitly pass
include_screenshots: trueto include it in output.See ADR 0016 for full rationale, transport overhead considerations, and the
screenshot_path:file-based transport flagged as future work.Test plan
bundle exec rspecpasses (194 examples, 0 failures, 100% line coverage)screenshots: :always— verifyreport.screenshotsis a non-nil base64 string on a successful checkscreenshots: :on_error— verifyreport.screenshotsis nil on a clean check and non-nil when the page failsscreenshots: :never— verifyreport.screenshotsis always nilreport.to_hexcludesscreenshotskey by defaultreport.to_h(include_screenshots: true)includes the keyreport.to_json(include_screenshots: true)round-trips correctly throughJSON.parsescreenshots:value raisesArgumentErrorwith a clear message