fix(browser): close scenario containment gaps
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { BrowserScenarioSecrets } from "../src/browser/BrowserScenarioSecrets.js";
|
||||
import { browserScenarioSchema } from "../src/domain/browserScenario.js";
|
||||
|
||||
const secret = (secret_id: string) => ({ source: "secret", secret_id });
|
||||
@@ -159,6 +160,16 @@ describe("browserScenarioSchema", () => {
|
||||
]);
|
||||
});
|
||||
|
||||
it("redacts overlapping secrets longest-first", () => {
|
||||
const scenario = browserScenarioSchema.parse(baseScenario());
|
||||
const secrets = BrowserScenarioSecrets.resolve(scenario, {
|
||||
REA_TEST_SESSION: "prefix",
|
||||
REA_TEST_PASSWORD: "prefix-suffix",
|
||||
REA_TEST_COOKIE: "cookie",
|
||||
});
|
||||
expect(secrets?.redact("prefix-suffix")).toBe("[REDACTED:login_input]");
|
||||
});
|
||||
|
||||
it("rejects unsupported actions", () => {
|
||||
const scenario = baseScenario();
|
||||
scenario.actions = [
|
||||
|
||||
@@ -10,6 +10,7 @@ describe("PlaywrightScenarioEvents", () => {
|
||||
it("bounds oversized page errors before validating captured events", () => {
|
||||
const listeners = new Map<string, (value: Error) => void>();
|
||||
const page = {
|
||||
url: () => "https://app.example.test/",
|
||||
on: (name: string, listener: (value: Error) => void) => {
|
||||
listeners.set(name, listener);
|
||||
},
|
||||
@@ -78,6 +79,7 @@ describe("PlaywrightScenarioEvents", () => {
|
||||
limits: scenario.limits,
|
||||
secrets,
|
||||
budget: new BrowserScenarioCaptureBudget(1, 1_000_000),
|
||||
allowedOrigins: scenario.allowed_origins,
|
||||
});
|
||||
const error = new Error("m".repeat(70_000));
|
||||
error.stack = "s".repeat(300_000);
|
||||
|
||||
Reference in New Issue
Block a user