@reportforge/playwright-pdf 0.22.1 → 0.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -64,6 +64,7 @@ Three templates, one reporter. Every PDF is fully offline: fonts, charts, and sc
64
64
  - **Rich execution capture**: opt-in "Steps to Reproduce" outline (a nested, copy-pasteable Markdown list of your `test.step`s and assertions; add `apiSteps` for the full click/fill/check trail), Node console tail, and trace/video links under each failed test in the defect log. Read straight from the Playwright step tree: no fixtures, no test-code changes. Enable via `capture` (`steps` / `apiSteps` / `console` / `evidence`); off by default.
65
65
  - **Configurable sections**: add or remove any report section per template via `sections`.
66
66
  - **Executive report brief band**: leads with a plain-language brief (trend + root causes) and one hero pass-rate number instead of a flat KPI grid
67
+ - **Data protection**: AES-256 password-protected PDFs (no external tools) and opt-in redaction of credentials/PII in report content and live streams
67
68
  - **Hybrid licensing**: one short key unlocks it; reports keep rendering offline via a locally cached license between refreshes
68
69
  - **Update notice**: when a newer reporter version is published, each run ends with one info line naming it and the update command; no extra network calls
69
70
 
@@ -187,7 +188,7 @@ All options are the second element of the reporter tuple.
187
188
  | `primaryColor` | `string` | `'#CC785C'` | Primary brand colour (3-, 6-, or 8-digit hex). Used for headers and accent bars. |
188
189
  | `accentColor` | `string` | `'#3F7D58'` | Accent brand colour (hex). Used for highlights and badges. |
189
190
  | `watermark` | `string` | n/a | Text to render as a diagonal watermark overlay from the Suite Breakdown page onward (summary/chart pages stay clean), e.g. `'CONFIDENTIAL'` or `'DRAFT'`. |
190
- | `pdfPassword` | `string` | n/a | Password-protect the generated PDF. Requires `qpdf` installed on the system. |
191
+ | `pdfPassword` | `string` | n/a | Password-protect the generated PDF with AES-256, applied in-process with no external tools required. Also encrypts the failure-overflow sidecar (`*-failures.json.enc`; decrypt with `npx @reportforge/playwright-pdf decrypt-failures`). Recommended: `process.env.RF_PDF_PASSWORD`. |
191
192
  | `reportTitle` | `string` | `'Playwright Test Report'` | Custom title for the report cover page and running header. |
192
193
  | `projectName` | `string` | from `package.json` | Project or application name. Inferred from the `package.json` `name` field if absent. |
193
194
  | `open` | `boolean` | `false` | Open the generated PDF automatically after generation. For local use only; ignored in CI. |
@@ -202,6 +203,7 @@ All options are the second element of the reporter tuple.
202
203
  | `notify` | `object` | n/a | Notification channels: `slack`, `teams` (each `{ url, enabled, on }`), `discord` (`{ url, enabled, on, attachPdf }`), `email` (`{ to, enabled, on, attachPdf }`). See the Notifications docs. |
203
204
  | `failureAnalysis` | `object` | `{ enabled: true }` | Offline failure root-cause analysis (embedded classifier; no runtime network) with on-device personalization: label collected failures, then the `train-model` CLI trains + evaluates a local layer entirely on your machine; it activates only when it beats the base model, and nothing leaves the machine. Fields: `enabled` (default `true`), `maxClusters` (default `10`), `minStrength` (`weak`\|`moderate`\|`strong`, default `weak`), `maxFailuresToAnalyse` (default `500`), `collectUnclassified` (default `true`), `collectScope` (`blind-spots`\|`all`, default `blind-spots`), `autoUpdateModel` (default `true`), `localModel` (use the gate-passed on-device model, default `true`), `localModelPath` (share a team-trained model via a repo-committed file). See the Failure Analysis docs. |
204
205
  | `capture` | `object` | `{}` (off) | Opt-in rich execution capture for the defect log (reporter-side; no fixtures, no test-code changes). Fields: `steps` (a copy-pasteable "Steps to Reproduce" outline built from the Playwright step tree; each row is a Markdown list line indented under its parent `test.step`, default `false`), `apiSteps` (include every top-level `pw:api` action (click/fill/check/goto) in the outline for a full action trail; without it the outline shows only `test.step` intent + `expect` assertions, default `false`), `console` (Node stdout/stderr tail, default `false`), `evidence` (trace/video file links, default `false`), `maxSteps` (default `50`), `maxConsoleLines` (default `50`). Renders in the Defect Log section of the `detailed` template. |
206
+ | `redact` | `object` | `{ enabled: false }` | Opt-in masking of likely credentials/PII (passwords, tokens, API keys, Bearer/JWT values, emails, high-entropy strings) in report text and the live stream. `builtins` (default `true`) toggles the built-in patterns; `patterns` adds custom regexes (fully masked); `mask` sets the replacement text (default `'[REDACTED]'`). Screenshots cannot be redacted; use `includeScreenshots: false` for strict environments. |
205
207
  | `live` | `object` | `{}` (off) | Opt-in live test-execution streaming. When `enabled`, the reporter prints an unguessable watch link to the CI logs at run start and streams per-test progress to the hosted dashboard while tests run; all shards of one CI run converge on a single live view. Fields: `enabled` (default `false`), `runId` (override the auto-derived run id), `serverUrl` (override the streaming server), `steps` (`none`\|`failed`\|`intent`\|`all`, default `failed`; `intent` shows only your `test.step` names plus any failing step), `console` (stream stdout/stderr tails, default `false`), `flushMs` (batch debounce 500-10000, default `2000`). The PDF at the end of the run is unaffected. Requires an active subscription with the `live` entitlement. See the Live Runs docs. |
206
208
  | `historyFile` | `string` | `~/.reportforge/{key}/history.json` | Path to the history JSON file. Relative paths resolve from `cwd`. Enables pass-rate trending charts in the `detailed` template. |
207
209
  | `historySize` | `number` | `10` | Maximum number of test runs to keep in the history file (integer ≥ 2). Older runs are pruned on append. |
@@ -316,6 +318,48 @@ The `on` trigger controls when the message fires:
316
318
 
317
319
  The summary includes pass rate, test counts, duration, and the report filename. Notifications require a valid license and fire after PDF generation (or after a PDF failure; you still get the ping).
318
320
 
321
+ ### Data Protection
322
+
323
+ Two independent, opt-in controls: encrypt the PDF itself, and mask likely secrets before they ever reach report content.
324
+
325
+ ```typescript
326
+ // playwright.config.ts
327
+ reporter: [
328
+ ['@reportforge/playwright-pdf', {
329
+ pdfPassword: process.env.RF_PDF_PASSWORD,
330
+ redact: {
331
+ enabled: true,
332
+ patterns: ['MYCO_[A-Z0-9]+'], // custom regexes, fully masked
333
+ },
334
+ }],
335
+ ],
336
+ ```
337
+
338
+ **`pdfPassword`** encrypts the PDF with AES-256, applied in-process with no external tools required. When a failure-overflow sidecar is written (`maxInlineFailures` exceeded), it's encrypted too, as `{basename}-failures.json.enc`:
339
+
340
+ ```bash
341
+ npx @reportforge/playwright-pdf decrypt-failures reports/2026-04-28-report-failures.json.enc --password=$RF_PDF_PASSWORD
342
+ # or set RF_PDF_PASSWORD and drop --password
343
+ ```
344
+
345
+ **`redact`** masks likely credentials and PII in error messages, stack traces, step titles, captured console output, test/suite titles, annotations, failure-analysis text, chart labels, and in the live watch stream. It runs after failure analysis, so classifier accuracy is unaffected. Built-in patterns (`builtins: true`, the default) catch:
346
+
347
+ | Catches | Kept as-is | Example |
348
+ |---|---|---|
349
+ | `key=value` / `"key": "value"` credentials (`password`, `secret`, `token`, `apiKey`, `auth`, `credential`, `privateKey`, `accessKey`, `clientSecret`, …) | the key name | `password: "hunter2"` → `password: "[REDACTED]"` |
350
+ | `Authorization: Bearer …` / `Basic …` | the scheme word | `Bearer eyJhbGc...` → `Bearer [REDACTED]` |
351
+ | JWTs | n/a | `eyJhbGciOi...` |
352
+ | Provider key prefixes | n/a | AWS `AKIA…`, GitHub `ghp_`/`gho_`/`github_pat_`, Slack `xox*`, OpenAI-style `sk-`, Razorpay `rzp_live_`/`rzp_test_`, Google `AIza…` |
353
+ | URLs with embedded credentials | the username | `https://alice:hunter2@host` → `https://alice:[REDACTED]@host` |
354
+ | Emails | first character + domain | `jsmith@example.com` → `j***@example.com` |
355
+ | High-entropy strings (20+ mixed letters/digits) | n/a | tokens and keys with no recognizable prefix |
356
+
357
+ Add your own with `patterns` (strings compiled as case-sensitive regexes with the `g` flag); custom matches are always fully masked. `mask` overrides the default replacement text (`'[REDACTED]'`).
358
+
359
+ > **Screenshots cannot be redacted:** pixel content is opaque to text-based masking. Set `includeScreenshots: false` in strict environments.
360
+
361
+ Full details at [reportforge.org/docs/advanced/security](https://reportforge.org/docs/advanced/security).
362
+
319
363
  ### Test History Trending
320
364
 
321
365
  After each run the reporter appends a summary entry to a local JSON file and renders a pass-rate sparkline + verdict row in the `detailed` template.
@@ -678,7 +722,6 @@ Common issues:
678
722
 
679
723
  - **`Chrome/Chromium not found`** → install Google Chrome Stable; don't use the Ubuntu `chromium-browser` snap.
680
724
  - **Charts blank** → ensure `npm run bundle-chartjs` ran at build; the reporter waits up to 30s for `window.__chartsReady`.
681
- - **`pdfPassword` ignored** → requires `qpdf` on `PATH` (`apt install qpdf` / `brew install qpdf` / `choco install qpdf`).
682
725
  - **No PDF generated** → verify `RF_LICENSE_KEY` is set and your subscription is active. `RF_DEBUG=1` will show the activation result; missing key, expired subscription, network failure, or no license cache all skip PDF generation.
683
726
 
684
727
  Full guide: [reportforge.org/docs/troubleshooting](https://reportforge.org/docs/troubleshooting).
@@ -697,6 +740,7 @@ Full documentation at [reportforge.org/docs](https://reportforge.org/docs):
697
740
  - [Templates](https://reportforge.org/docs/templates): minimal, detailed, executive
698
741
  - [Live runs](https://reportforge.org/docs/advanced/live): stream per-test progress to a shared watch link
699
742
  - [Report Sections](https://reportforge.org/docs/configuration#report-sections): add or remove sections per template
743
+ - [Data protection](https://reportforge.org/docs/advanced/security): password-encrypt PDFs and redact credentials/PII from report content
700
744
  - [License & offline behaviour](https://reportforge.org/docs/licensing): license cache, machine cap, cancellation
701
745
  - [Troubleshooting](https://reportforge.org/docs/troubleshooting): common issues and debug flags
702
746
  - [Changelog](https://reportforge.org/changelog): version history and release notes
package/SECURITY.md CHANGED
@@ -43,6 +43,17 @@ Out of scope:
43
43
  - Vulnerabilities exclusively in third-party services we integrate (for
44
44
  example our payment provider, Razorpay) — report those upstream.
45
45
 
46
+ ## Report data protection
47
+
48
+ A generated PDF can contain whatever your tests captured: error text, console
49
+ output, screenshots. Two opt-in reporter options limit what a report exposes
50
+ if it ends up somewhere it shouldn't. `pdfPassword` encrypts the PDF, and the
51
+ failure-overflow sidecar when one is written, with AES-256, applied
52
+ in-process with no external tools required. `redact` masks likely credentials
53
+ and PII (tokens, API keys, emails, and more) out of report content and the
54
+ live watch stream before they're written or streamed. Neither is on by
55
+ default. Details: [reportforge.org/docs/advanced/security](https://reportforge.org/docs/advanced/security).
56
+
46
57
  ## Supported versions
47
58
 
48
59
  Only the latest published version of `@reportforge/playwright-pdf` receives