@piwitests/reporter 0.20.0 → 0.22.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.
@@ -222,6 +222,32 @@ var HttpClient = class {
222
222
  this.serverUrl = serverUrl;
223
223
  this.logger = logger;
224
224
  this.timeout = timeout;
225
+ this.warnIfInsecureTransport();
226
+ }
227
+ /**
228
+ * Warn once when the dashboard URL is plaintext `http://` to a non-loopback
229
+ * host. The reporter sends the API key as a Bearer token — and uploads
230
+ * captured test data, including request URLs whose query strings the server
231
+ * only strips after receipt — over this connection, so a non-TLS remote
232
+ * endpoint exposes the key and payloads on the wire. Loopback (localhost /
233
+ * 127.0.0.1 / ::1) is exempt: that traffic never leaves the machine. This
234
+ * warns rather than refuses so internal HTTP deployments (e.g. behind a VPN)
235
+ * still work, but the exposure is no longer silent.
236
+ */
237
+ warnIfInsecureTransport() {
238
+ let url;
239
+ try {
240
+ url = new import_node_url.URL(this.serverUrl);
241
+ } catch {
242
+ return;
243
+ }
244
+ if (url.protocol !== "http:") return;
245
+ const host = url.hostname.toLowerCase();
246
+ const isLoopback = host === "localhost" || host.endsWith(".localhost") || host === "127.0.0.1" || host === "::1" || host === "[::1]";
247
+ if (isLoopback) return;
248
+ this.logger.warn(
249
+ `Dashboard URL ${this.serverUrl} uses plaintext http:// \u2014 the API key and captured test data are transmitted unencrypted. Use https:// for any non-local server.`
250
+ );
225
251
  }
226
252
  /** Base URL of the Piwi Dashboard server this client talks to (used to print run links). */
227
253
  get baseUrl() {
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ import { FullConfig, Suite, TestCase, TestResult, FullResult } from '@playwright
2
2
  import { PlaywrightTestConfig } from '@playwright/test';
3
3
  export { PlaywrightTestConfig } from '@playwright/test';
4
4
  export { PiwiFixtures, extendPiwiFixtures, piwiFixtures } from './internal/capture/capture-fixtures.js';
5
+ import '@piwitests/picker-dom';
5
6
 
6
7
  /**
7
8
  * Options for configuring the Piwi Dashboard reporter.
@@ -50,7 +51,7 @@ interface PiwiDashboardOptions {
50
51
  /**
51
52
  * Capture server-side spans for each API/document request the test makes,
52
53
  * read from the `X-Piwi-Trace` response header emitted by a Piwi
53
- * instrumentation plugin (e.g. `@piwitests/instrumentation`). The spans show
54
+ * instrumentation plugin (e.g. `@piwitests/instrumentation-nitro`). The spans show
54
55
  * up next to the network request in the dashboard and feed AI diagnosis. Free
55
56
  * when no instrumentation is present (the header is simply absent). Defaults
56
57
  * to `true`; automatically disabled when `collectPerformanceMetrics` is