omniqa 0.6.1 → 0.8.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.
Files changed (110) hide show
  1. package/README.md +10 -1
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/cli.js +9 -1
  4. package/dist/cli.js.map +1 -1
  5. package/dist/commands/doctor.d.ts +7 -0
  6. package/dist/commands/doctor.d.ts.map +1 -1
  7. package/dist/commands/doctor.js +77 -5
  8. package/dist/commands/doctor.js.map +1 -1
  9. package/dist/commands/init.d.ts +15 -0
  10. package/dist/commands/init.d.ts.map +1 -1
  11. package/dist/commands/init.js +219 -26
  12. package/dist/commands/init.js.map +1 -1
  13. package/dist/commands/install.d.ts.map +1 -1
  14. package/dist/commands/install.js +20 -3
  15. package/dist/commands/install.js.map +1 -1
  16. package/dist/commands/knowledge.d.ts +23 -0
  17. package/dist/commands/knowledge.d.ts.map +1 -1
  18. package/dist/commands/knowledge.js +215 -39
  19. package/dist/commands/knowledge.js.map +1 -1
  20. package/dist/commands/plan-add.d.ts.map +1 -1
  21. package/dist/commands/plan-add.js +23 -1
  22. package/dist/commands/plan-add.js.map +1 -1
  23. package/dist/commands/plan.d.ts.map +1 -1
  24. package/dist/commands/plan.js +10 -6
  25. package/dist/commands/plan.js.map +1 -1
  26. package/dist/commands/security.d.ts +7 -0
  27. package/dist/commands/security.d.ts.map +1 -0
  28. package/dist/commands/security.js +76 -0
  29. package/dist/commands/security.js.map +1 -0
  30. package/dist/commands/status.d.ts.map +1 -1
  31. package/dist/commands/status.js +2 -2
  32. package/dist/commands/status.js.map +1 -1
  33. package/dist/commands/test.d.ts +10 -0
  34. package/dist/commands/test.d.ts.map +1 -1
  35. package/dist/commands/test.js +61 -7
  36. package/dist/commands/test.js.map +1 -1
  37. package/dist/commands/write.d.ts.map +1 -1
  38. package/dist/commands/write.js +52 -5
  39. package/dist/commands/write.js.map +1 -1
  40. package/dist/coverage-page.d.ts.map +1 -1
  41. package/dist/coverage-page.js +2 -2
  42. package/dist/coverage-page.js.map +1 -1
  43. package/dist/devices.d.ts +4 -2
  44. package/dist/devices.d.ts.map +1 -1
  45. package/dist/devices.js +3 -3
  46. package/dist/devices.js.map +1 -1
  47. package/dist/mcp/tools.d.ts.map +1 -1
  48. package/dist/mcp/tools.js +3 -2
  49. package/dist/mcp/tools.js.map +1 -1
  50. package/dist/planner.d.ts.map +1 -1
  51. package/dist/planner.js +13 -9
  52. package/dist/planner.js.map +1 -1
  53. package/dist/qa.d.ts.map +1 -1
  54. package/dist/qa.js +2 -1
  55. package/dist/qa.js.map +1 -1
  56. package/dist/runner.d.ts +1 -1
  57. package/dist/runner.d.ts.map +1 -1
  58. package/dist/runner.js +64 -56
  59. package/dist/runner.js.map +1 -1
  60. package/dist/security-checks.d.ts +146 -0
  61. package/dist/security-checks.d.ts.map +1 -0
  62. package/dist/security-checks.js +661 -0
  63. package/dist/security-checks.js.map +1 -0
  64. package/dist/security-gates.d.ts +37 -0
  65. package/dist/security-gates.d.ts.map +1 -0
  66. package/dist/security-gates.js +46 -0
  67. package/dist/security-gates.js.map +1 -0
  68. package/dist/security-mask.d.ts +35 -0
  69. package/dist/security-mask.d.ts.map +1 -0
  70. package/dist/security-mask.js +104 -0
  71. package/dist/security-mask.js.map +1 -0
  72. package/dist/security-report.d.ts +93 -0
  73. package/dist/security-report.d.ts.map +1 -0
  74. package/dist/security-report.js +170 -0
  75. package/dist/security-report.js.map +1 -0
  76. package/dist/security-request.d.ts +109 -0
  77. package/dist/security-request.d.ts.map +1 -0
  78. package/dist/security-request.js +254 -0
  79. package/dist/security-request.js.map +1 -0
  80. package/dist/security-research.d.ts +131 -0
  81. package/dist/security-research.d.ts.map +1 -0
  82. package/dist/security-research.js +581 -0
  83. package/dist/security-research.js.map +1 -0
  84. package/dist/security-scan.d.ts +98 -0
  85. package/dist/security-scan.d.ts.map +1 -0
  86. package/dist/security-scan.js +415 -0
  87. package/dist/security-scan.js.map +1 -0
  88. package/dist/security-sources.d.ts +55 -0
  89. package/dist/security-sources.d.ts.map +1 -0
  90. package/dist/security-sources.js +75 -0
  91. package/dist/security-sources.js.map +1 -0
  92. package/dist/security.d.ts +65 -0
  93. package/dist/security.d.ts.map +1 -0
  94. package/dist/security.js +624 -0
  95. package/dist/security.js.map +1 -0
  96. package/dist/sync.d.ts +12 -1
  97. package/dist/sync.d.ts.map +1 -1
  98. package/dist/sync.js +11 -3
  99. package/dist/sync.js.map +1 -1
  100. package/dist/test.d.ts +85 -0
  101. package/dist/test.d.ts.map +1 -1
  102. package/dist/test.js +337 -19
  103. package/dist/test.js.map +1 -1
  104. package/dist/writer.d.ts +5 -1
  105. package/dist/writer.d.ts.map +1 -1
  106. package/dist/writer.js +15 -12
  107. package/dist/writer.js.map +1 -1
  108. package/package.json +7 -7
  109. package/skills/security-research.md +57 -0
  110. package/skills/security-review.md +27 -0
@@ -1 +1 @@
1
- {"version":3,"file":"test.d.ts","sourceRoot":"","sources":["../src/test.ts"],"names":[],"mappings":"AAKA,OAAO,EAAc,KAAK,iBAAiB,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5G,OAAO,EAAoI,KAAK,KAAK,EAAqB,KAAK,MAAM,EAAa,MAAM,cAAc,CAAC;AACvN,OAAO,EAAgD,KAAK,YAAY,EAAqB,MAAM,gBAAgB,CAAC;AACpH,OAAO,EAAsD,KAAK,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvJ,OAAO,EAAqE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACjH,OAAO,KAAK,EAAE,aAAa,EAAc,MAAM,aAAa,CAAC;AAE7D,MAAM,WAAW,aAAa;IAC5B,uFAAuF;IACvF,MAAM,EAAE,SAAS,CAAC;IAClB,kFAAkF;IAClF,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,qGAAqG;IACrG,YAAY,EA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AAM,EAAE,MAAM,aAAa,CAAC;AACrC,YAAY,EAAE,eAAe,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC3F,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACjF,YAAY,EAAE,YAAY,EAAE,CAAC;AAC7B,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,CAAC;AACvF,iHAAiH;AACjH,MAAM,MAAM,OAAO,GAAG,WAAW,CAAC;AAClC,MAAM,MAAM,cAAc,GAAG,WAAW,CAAC;AACzC,MAAM,MAAM,IAAI,GAAG,QAAQ,CAAC"}
package/dist/test.js CHANGED
@@ -4,11 +4,14 @@ import { appendFileSync, existsSync, mkdirSync, readdirSync, readFileSync, rmdir
4
4
  import { dirname, join, relative } from "node:path";
5
5
  import { after, describe as nodeDescribe, test as nodeTest } from "node:test";
6
6
  import { requestApi } from "@omniqa/browser";
7
- import { createAgent, createMemory, createModels, modelFor, openIndex, openRecording, parseProduct, PRODUCT_FILE, recordingPath, redactor } from "@omniqa/core";
7
+ import { createAgent, createMemory, createModels, fileKind, KIND_TAG, modelFor, openIndex, openRecording, parseProduct, PRODUCT_FILE, recordingPath, redactor, SPEC_FILE } from "@omniqa/core";
8
8
  import { browserOf, connectDevice, createDeviceEngine } from "@omniqa/device";
9
- import { createWebEngine, expectLogin, pageApi, seedContext } from "@omniqa/web";
9
+ import { createWebEngine, expectLogin, hostPatterns, pageApi, requestRoute, seedContext, sendForm, startInterceptor } from "@omniqa/web";
10
10
  import { parseSignUp, quoteAnswer, signUpRefusal, signUpWith, tearDown } from "./auth.js";
11
11
  import { browserFor, grepPattern, posix, webContextOptions } from "./devices.js";
12
+ import { checkNamed, CHECKS, NotHeld, Refused, SIGN_OUT } from "./security-checks.js";
13
+ import { CHECK_REQUESTS, gate } from "./security-gates.js";
14
+ import { ANTI_FORGERY, parametersOf, parseRequest, renderRequest, setCookies, withHeader } from "./security-request.js";
12
15
  /** OMNIQA_RUN: the options file omniqa test writes for every test process (product.yaml and instructions.md ride in it, more than one environment string may hold). */
13
16
  const run = process.env.OMNIQA_RUN === undefined ? undefined : JSON.parse(readFileSync(process.env.OMNIQA_RUN, "utf8"));
14
17
  const options = () => {
@@ -29,6 +32,9 @@ const describes = [];
29
32
  const describeTags = [];
30
33
  const hooks = { beforeEach: [], afterEach: [] };
31
34
  let browser;
35
+ /** A *.security.ts file's process has an Interceptor sidecar of its own, started before the file's browser and ended with it: nothing a test armed outlives the file. */
36
+ const securityFile = fileKind(specFile) === "security";
37
+ let sidecar;
32
38
  /** The environment's url as the browser's pages reach it: on a phone the port adb reversed, else the environment's own (set with the browser). */
33
39
  let pageUrl;
34
40
  const urlFor = (omniqa) => pageUrl ?? omniqa.environment?.url;
@@ -36,6 +42,7 @@ if (run !== undefined) {
36
42
  // A launch that failed has nothing to close.
37
43
  after(async () => {
38
44
  await browser?.then((b) => b.close(), () => undefined);
45
+ await sidecar?.then((s) => s.stop(), () => undefined);
39
46
  });
40
47
  }
41
48
  const warned = new Set();
@@ -107,34 +114,64 @@ function appFor(device, environment, project) {
107
114
  throw new Error(`omniqa: project ${JSON.stringify(project)} has no app: set app in omniqa.config.ts or apps.${device.platform} in product.yaml environment ${JSON.stringify(environment.name)}`);
108
115
  return app;
109
116
  }
117
+ /** A context of the run's browser as every test gets one: the project's options, the test id attribute, the environment's seeded cookies and localStorage. Closing it is the caller's. */
118
+ async function openContext(s) {
119
+ const o = options();
120
+ const omniqa = o.omniqa;
121
+ const context = await (await s.get("browser")).newContext({
122
+ ...(urlFor(omniqa) === undefined ? {} : { baseURL: urlFor(omniqa) }),
123
+ ...webContextOptions(o),
124
+ ...uses.context,
125
+ testIdAttribute: omniqa.testIdAttribute,
126
+ });
127
+ // Playwright Test's defaults: an action or a navigation waits as long as the test may; the deadline closes the context and settles it.
128
+ context.setDefaultTimeout(0);
129
+ context.setDefaultNavigationTimeout(0);
130
+ const environment = omniqa.environment === undefined || omniqa.product === undefined ? undefined : parseProduct(omniqa.product, process.env).environments[omniqa.environment.name];
131
+ if (environment !== undefined && omniqa.environment !== undefined)
132
+ await seedContext(context, environment, urlFor(omniqa));
133
+ return context;
134
+ }
135
+ /** A path as the crawl names a route (a number as `{n}`, an id as `{id}`): how a failure names a request, since its line ends in a run's output. */
136
+ const routeOf = requestRoute;
137
+ /** Where a redirect points, as a path (with its origin when that is another one): a query may carry a value, and the test that asserts it is committed. */
138
+ const pointsTo = (location, from) => {
139
+ const to = URL.parse(location, from);
140
+ return to === null ? location.split("?")[0] : `${to.origin === from.origin ? "" : to.origin}${to.pathname}`;
141
+ };
142
+ /** The whole url a captured request, as this text has it, goes to. */
143
+ const urlOf = (captured, text) => new URL(text.target, `${captured.scheme}://${captured.host}:${captured.port}`);
144
+ /** The check of that name, when it is one a test runs by name on a request the page made, or on the site. */
145
+ function runnable(name, target) {
146
+ const check = checkNamed(name);
147
+ if (check?.run !== undefined && check.target === target)
148
+ return check;
149
+ const names = CHECKS.filter((c) => c.run !== undefined && c.target === target).map((c) => c.name);
150
+ throw new Error(`omniqa: no check ${JSON.stringify(name)} runs on ${target === "site" ? "the site" : "a request"}: there ${names.length === 1 ? "is" : "are"} ${names.join(", ")}`);
151
+ }
152
+ /** The headers a session rides in: what `replay({ as })` swaps for the other account's. */
153
+ const sessionHeader = (name) => ["cookie", "authorization"].includes(name.toLowerCase()) || ANTI_FORGERY.test(name);
110
154
  const FIXTURES = {
111
155
  omniqa: async () => options().omniqa,
112
156
  models: async () => uses.models,
113
157
  deviceClient: async () => uses.deviceClient,
114
158
  browser: async () => {
115
159
  const o = options();
116
- browser ??= browserFor({ android: o.android, descriptor: o.descriptor, headless: !o.headed, url: o.omniqa.environment?.url }).then((b) => {
160
+ const url = o.omniqa.environment?.url;
161
+ browser ??= (async () => {
162
+ // A security file's browser is behind the sidecar, which decrypts the environment's own hosts and no other.
163
+ if (securityFile)
164
+ sidecar ??= startInterceptor({ hosts: url === undefined ? [] : hostPatterns(url), env: process.env });
165
+ const b = await browserFor({ android: o.android, descriptor: o.descriptor, headless: !o.headed, url, ...(sidecar === undefined ? {} : { args: (await sidecar).args }) });
117
166
  pageUrl = b.url;
118
167
  return b.browser;
119
- });
168
+ })();
120
169
  return browser;
121
170
  },
122
171
  // Every test's context carries the environment's cookies and localStorage before its first page, so a cookie banner or a news modal is never in the way.
123
172
  context: async (s, info) => {
124
173
  const o = options();
125
- const omniqa = o.omniqa;
126
- const context = await (await s.get("browser")).newContext({
127
- ...(urlFor(omniqa) === undefined ? {} : { baseURL: urlFor(omniqa) }),
128
- ...webContextOptions(o),
129
- ...uses.context,
130
- testIdAttribute: omniqa.testIdAttribute,
131
- });
132
- // Playwright Test's defaults: an action or a navigation waits as long as the test may; the deadline closes the context and settles it.
133
- context.setDefaultTimeout(0);
134
- context.setDefaultNavigationTimeout(0);
135
- const environment = omniqa.environment === undefined || omniqa.product === undefined ? undefined : parseProduct(omniqa.product, process.env).environments[omniqa.environment.name];
136
- if (environment !== undefined && omniqa.environment !== undefined)
137
- await seedContext(context, environment, urlFor(omniqa));
174
+ const context = await openContext(s);
138
175
  s.cleanup(async () => {
139
176
  const failed = info.status !== info.expectedStatus;
140
177
  if (o.screenshot === "on" || (o.screenshot === "only-on-failure" && failed)) {
@@ -231,6 +268,275 @@ const FIXTURES = {
231
268
  });
232
269
  return api;
233
270
  },
271
+ security: async (s, info) => {
272
+ if (!securityFile)
273
+ throw new Error("omniqa: the security fixture is available in *.security.ts files");
274
+ await s.get("browser");
275
+ const interceptor = await sidecar;
276
+ // A test reads its own traffic: what an earlier test of the file raised is forgotten before this one's first page.
277
+ await interceptor.clear();
278
+ const omniqa = options().omniqa;
279
+ /** The one way a request of the test's own leaves: the gates on what would be sent, then the repeater. `text` undefined sends the captured request as it was. `id` is the copy's flow. */
280
+ const send = async (captured, was, text, label) => {
281
+ if (omniqa.environment === undefined)
282
+ throw new Error("omniqa: a security request needs .omniqa/product.yaml in the project; run omniqa init");
283
+ const going = text ?? was;
284
+ const url = urlOf(captured, going);
285
+ const refusal = gate(omniqa.environment, { method: going.method, url: url.href, body: going.body, headers: going.headers.map(([header]) => header) }, interceptor.sent());
286
+ if (refusal !== undefined)
287
+ throw new Refused(`omniqa: ${refusal}`);
288
+ const answer = await interceptor.replay(captured.id, { ...(text === undefined ? {} : { raw: renderRequest(text) }), label });
289
+ return { id: answer.id, status: answer.status, ...(answer.location === undefined ? {} : { location: pointsTo(answer.location, url) }) };
290
+ };
291
+ /** The requests of this test's capture that are no asset, read a few at a time: each answer comes on Interceptor's next tick. */
292
+ const eachFlow = async (pick, read) => {
293
+ const flows = interceptor.flows().filter((flow) => !flow.asset && pick(flow));
294
+ const out = [];
295
+ for (let i = 0; i < flows.length; i += 8)
296
+ out.push(...(await Promise.all(flows.slice(i, i + 8).map((flow) => read(flow.id)))));
297
+ return out;
298
+ };
299
+ /** The other accounts a test asks as, each signed in on a context of its own in the same browser, behind the same sidecar. */
300
+ const others = new Map();
301
+ const other = (account) => {
302
+ const opened = others.get(account) ?? (async () => {
303
+ if (omniqa.environment === undefined || omniqa.product === undefined)
304
+ throw new Error("omniqa: replay({ as }) needs .omniqa/product.yaml in the project; run omniqa init");
305
+ const product = parseProduct(omniqa.product, process.env);
306
+ const fields = product.accounts[account];
307
+ if (fields === undefined)
308
+ throw new Error(`omniqa: account ${JSON.stringify(account)} is not in product.yaml`);
309
+ const context = await openContext(s);
310
+ s.cleanup(() => context.close());
311
+ const page = await context.newPage();
312
+ try {
313
+ await expectLogin(page, urlFor(omniqa), product.crawl.loginPath, fields, account);
314
+ }
315
+ catch (err) {
316
+ throw new Error(`omniqa: ${err.message}`, { cause: err });
317
+ }
318
+ // From here on: what this page sends carries that account's session.
319
+ const requests = [];
320
+ page.on("request", (request) => requests.push(request));
321
+ return { context, page, requests };
322
+ })();
323
+ others.set(account, opened);
324
+ return opened;
325
+ };
326
+ /**
327
+ * `text` with the session of another account: its cookies from that context's jar, and each other session header of the
328
+ * request (Authorization, an anti-forgery token) as that account's page sent it, on the same request when it made it (it
329
+ * opens the page the test's own page is on), else on its newest request that has the header.
330
+ */
331
+ const asAccount = async (account, captured, name, text) => {
332
+ const o = await other(account);
333
+ const here = (await s.get("page")).url();
334
+ if (o.at !== here && here !== "about:blank") {
335
+ await o.page.goto(here);
336
+ await o.page.waitForLoadState("networkidle", { timeout: 5_000 }).catch(() => undefined);
337
+ o.at = here;
338
+ }
339
+ const url = new URL(text.target, `${captured.scheme}://${captured.host}:${captured.port}`);
340
+ const jar = (await o.context.cookies(url.href)).map((c) => `${c.name}=${c.value}`).join("; ");
341
+ const sent = await Promise.all(o.requests.map(async (request) => ({ request, headers: await request.allHeaders().catch(() => request.headers()) })));
342
+ const same = sent.findLast(({ request }) => request.method() === captured.method && URL.parse(request.url())?.host === url.host && routeOf(new URL(request.url()).pathname) === routeOf(captured.path));
343
+ const swapped = [];
344
+ for (const [header, value] of text.headers) {
345
+ if (!sessionHeader(header))
346
+ swapped.push([header, value]);
347
+ else if (header.toLowerCase() === "cookie")
348
+ continue;
349
+ else {
350
+ const theirs = same?.headers[header.toLowerCase()] ?? sent.findLast(({ request, headers }) => URL.parse(request.url())?.host === url.host && headers[header.toLowerCase()] !== undefined)?.headers[header.toLowerCase()];
351
+ if (theirs === undefined)
352
+ throw new Error(`omniqa: ${name} cannot be re-sent as ${account}: it carries a ${header} header, and no request of ${account}'s page had one after signing in`);
353
+ swapped.push([header, theirs]);
354
+ }
355
+ }
356
+ return { ...text, headers: jar === "" ? swapped : [...swapped, ["Cookie", jar]] };
357
+ };
358
+ /** Runs a basic check on a request of the capture: what the check works with, and how its outcome is said. */
359
+ const runOn = async (captured, name, check) => {
360
+ const raw = await interceptor.raw(captured.id);
361
+ if (raw === undefined)
362
+ throw new Error(`omniqa: ${name} cannot be re-sent: Interceptor holds no editable text of it (streamed, or over 5 MB)`);
363
+ const was = parseRequest(raw);
364
+ const product = parseProduct(omniqa.product ?? "", process.env);
365
+ const passwords = Object.values(product.accounts).flatMap((fields) => (fields.password === undefined ? [] : [fields.password]));
366
+ /** An answer of the capture. One Interceptor does not hand over (it no longer holds the flow, or did not answer in time) is no empty answer: a check that read it as one would compare with nothing. */
367
+ const answerOf = async (id) => {
368
+ const read = await interceptor.answer(id);
369
+ if (read === undefined)
370
+ throw new Error(`an answer to ${name} could not be read from Interceptor`);
371
+ return read;
372
+ };
373
+ const reply = (answer) => ({
374
+ status: answer.status,
375
+ ...(answer.location === undefined ? {} : { location: answer.location }),
376
+ read: async () => answerOf(answer.id),
377
+ });
378
+ try {
379
+ await check.run({
380
+ name,
381
+ request: was,
382
+ origin: urlOf(captured, was).origin,
383
+ // The request itself handed back is sent as it was, with no text of OmniQA's between.
384
+ send: async (text, what) => reply(await send(captured, was, text === was ? undefined : text, `${check.name}: ${what}`)),
385
+ answered: async () => {
386
+ const own = await answerOf(captured.id);
387
+ const location = own.headers.find(([header]) => header.toLowerCase() === "location")?.[1];
388
+ return reply({ id: captured.id, status: own.status, ...(location === undefined ? {} : { location: pointsTo(location, urlOf(captured, was)) }) });
389
+ },
390
+ left: () => CHECK_REQUESTS - interceptor.sent(),
391
+ // Said in the run's output and kept with the test's result, as a guard's "no longer seen" is: it fails nothing.
392
+ note: (line) => {
393
+ const message = `omniqa: ${line}`;
394
+ info.annotations.push({ type: "omniqa", description: message });
395
+ console.log(message);
396
+ },
397
+ loginPath: product.crawl.loginPath,
398
+ accounts: product.accounts,
399
+ // How this test's answers set each cookie: the sign-in is among them, since the capture began before it.
400
+ cookieFlags: async () => Object.fromEntries((await eachFlow((flow) => flow.status !== undefined, async (id) => setCookies((await answerOf(id)).headers))).flat().map((cookie) => [cookie.name, cookie.flags ?? {}])),
401
+ // The first request of the capture to carry an account's password is a sign-in; a later one that carries it asks for the password again.
402
+ signsIn: async () => {
403
+ const held = parametersOf(was).find((p) => p.in !== "query" && passwords.includes(p.value))?.value;
404
+ const carriers = await eachFlow((flow) => flow.method !== "GET", async (id) => ({ id, text: parseRequest((await interceptor.raw(id)) ?? "") }));
405
+ return held !== undefined && carriers.find(({ text }) => parametersOf(text).some((p) => p.in !== "query" && p.value === held))?.id === captured.id;
406
+ },
407
+ // The request that carried an account's password: the newest one, where a test signed in twice.
408
+ signIn: async () => (await eachFlow((flow) => flow.method !== "GET", async (id) => parseRequest((await interceptor.raw(id)) ?? ""))).findLast((text) => parametersOf(text).some((p) => p.in !== "query" && passwords.includes(p.value))),
409
+ });
410
+ }
411
+ catch (err) {
412
+ // A gate's refusal is said as it is; a reply that does not hold names the check; anything else is a check that could not say.
413
+ if (err.message.startsWith("omniqa: "))
414
+ throw err;
415
+ throw new Error(err instanceof NotHeld ? `omniqa: ${check.name} does not hold: ${err.message}` : `omniqa: the ${check.name} check cannot say: ${err.message}`, { cause: err });
416
+ }
417
+ };
418
+ return {
419
+ async request(pattern) {
420
+ const captured = await interceptor.request(pattern).catch((err) => {
421
+ throw new Error(`omniqa: ${err.message}`);
422
+ });
423
+ const name = `${captured.method} ${routeOf(captured.path)}`;
424
+ return {
425
+ name,
426
+ async replay(o = {}) {
427
+ const raw = await interceptor.raw(captured.id);
428
+ if (raw === undefined)
429
+ throw new Error(`omniqa: ${name} cannot be re-sent: Interceptor holds no editable text of it (streamed, or over 5 MB)`);
430
+ const was = parseRequest(raw);
431
+ const dropped = (o.without ?? []).map((header) => header.toLowerCase());
432
+ let text = { ...was, headers: was.headers.filter(([header]) => !dropped.includes(header.toLowerCase())) };
433
+ // A request of the test's own on top of the page's: where it goes and what it carries, the rest as the page sent it.
434
+ const own = o.method !== undefined || o.path !== undefined || o.headers !== undefined || o.body !== undefined;
435
+ if (o.path !== undefined && !o.path.startsWith("/"))
436
+ throw new Error(`omniqa: replay({ path }) takes a path of the product, with its query: ${JSON.stringify(o.path)}`);
437
+ text = { ...text, ...(o.method === undefined ? {} : { method: o.method.toUpperCase() }), ...(o.path === undefined ? {} : { target: o.path }), ...(o.body === undefined ? {} : { body: o.body }) };
438
+ // A request whose session rides somewhere else (a header of the product's own, its url, its body) would go out with
439
+ // that session in it, and its answer would be read as the answer to a guest or to the other account.
440
+ if (dropped.length > 0 && text.headers.length === was.headers.length)
441
+ throw new Error(`omniqa: ${name} carries none of ${dropped.join(", ")}: there is nothing to send it without, and its session rides somewhere a replay does not reach`);
442
+ if (o.as !== undefined && !was.headers.some(([header]) => ["cookie", "authorization"].includes(header.toLowerCase())))
443
+ throw new Error(`omniqa: ${name} carries no Cookie and no Authorization header: its session rides somewhere a replay cannot swap for ${o.as}'s`);
444
+ if (o.as !== undefined)
445
+ text = await asAccount(o.as, captured, name, text);
446
+ for (const [header, value] of Object.entries(o.headers ?? {}))
447
+ text = withHeader(text, header, value);
448
+ const edited = own || o.as !== undefined || text.headers.length !== was.headers.length;
449
+ const { status, location } = await send(captured, was, edited ? text : undefined, [...(own ? [`${text.method} ${routeOf(URL.parse(text.target, "http://request")?.pathname ?? text.target)}`] : []), ...(o.as === undefined ? [] : [`as ${o.as}`]), ...(dropped.length === 0 ? [] : [`without ${dropped.join(", ")}`])].join(", ") || "as it was");
450
+ // omniqa write runs a check once to learn what the product answers: that run says it, and the test is written with it.
451
+ if (process.env.OMNIQA_SECURITY_ACCEPT !== undefined)
452
+ appendFileSync(process.env.OMNIQA_SECURITY_ACCEPT, `replay ${status}${location === undefined ? "" : ` ${location}`}\n`);
453
+ return { status, ...(location === undefined ? {} : { location }) };
454
+ },
455
+ async check(check) {
456
+ await runOn(captured, name, runnable(check, "request"));
457
+ },
458
+ };
459
+ },
460
+ async check(check) {
461
+ const basic = runnable(check, "site");
462
+ const at = URL.parse((await s.get("page")).url());
463
+ // Whatever passed the proxy before the page was there is known once Interceptor has answered anything.
464
+ await interceptor.findings();
465
+ // The request for the page's own address; where a script put another address in the browser (a single-page product's router), the newest page the test was served.
466
+ const asked = at === null ? [] : interceptor.flows().filter((flow) => !flow.asset && flow.method === "GET" && flow.host === at.hostname);
467
+ const document = asked.findLast((flow) => flow.path === at?.pathname) ?? asked.findLast((flow) => flow.page);
468
+ if (document === undefined)
469
+ throw new Error("omniqa: open a page first: a check on the site asks from a request the page made");
470
+ await runOn(document, `GET ${routeOf(document.path)}`, basic);
471
+ },
472
+ async signOut() {
473
+ const page = await s.get("page");
474
+ const jar = async () => (await page.context().cookies()).map((c) => `${c.name}=${c.value}`).toSorted().join("; ");
475
+ const before = await jar();
476
+ const where = routeOf(new URL(page.url()).pathname);
477
+ const clicked = await (async () => {
478
+ for (const role of ["link", "button"]) {
479
+ const controls = page.getByRole(role, { name: SIGN_OUT });
480
+ for (let i = 0, n = await controls.count(); i < n; i++) {
481
+ if (!(await controls.nth(i).isVisible()))
482
+ continue;
483
+ await controls.nth(i).click();
484
+ return true;
485
+ }
486
+ }
487
+ // A link a menu keeps folded away is a link all the same: its address is followed.
488
+ const href = await page.evaluate(`[...document.querySelectorAll("a[href]")].find((a) => ${String(SIGN_OUT)}.test(a.textContent ?? ""))?.getAttribute("href") ?? null`);
489
+ if (href === null)
490
+ return false;
491
+ await page.goto(new URL(href, page.url()).href);
492
+ return true;
493
+ })();
494
+ if (!clicked)
495
+ throw new Error(`omniqa: no sign-out control on ${where}: security.signOut clicks a link or a visible button named "Log out" or "Sign out"`);
496
+ await page.waitForLoadState("networkidle", { timeout: 5_000 }).catch(() => undefined);
497
+ // A click that left every cookie as it was signed nobody out (a dialog to confirm, a session kept elsewhere): a request
498
+ // replayed after it would be answered as before, and that would read as a session the product does not end.
499
+ if ((await jar()) === before)
500
+ throw new Error(`omniqa: the sign-out control on ${where} was used and no cookie changed: nothing shows that a session ended, so what a request is answered after it proves nothing`);
501
+ },
502
+ async submit(button) {
503
+ if (omniqa.environment === undefined)
504
+ throw new Error("omniqa: security.submit needs .omniqa/product.yaml in the project; run omniqa init");
505
+ const page = await s.get("page");
506
+ const why = await sendForm(page, button, omniqa.environment);
507
+ if (why !== undefined)
508
+ throw new Error(`omniqa: the form ${JSON.stringify(button)} on ${routeOf(new URL(page.url()).pathname)} is not sent: ${why}`);
509
+ },
510
+ async visit(path) {
511
+ const page = await s.get("page");
512
+ await page.goto(path);
513
+ // A page that never goes quiet (it polls) is left after five seconds: the walk goes on.
514
+ await page.waitForLoadState("networkidle", { timeout: 5_000 }).catch(() => undefined);
515
+ },
516
+ async findings({ accepted = [] } = {}) {
517
+ const seen = (await interceptor.findings()).map((f) => ({ line: `${f.code} ${f.subject}`, code: f.code }));
518
+ // omniqa write walks a guard once to learn what to accept: that run lists what was seen and fails on nothing.
519
+ if (process.env.OMNIQA_SECURITY_ACCEPT !== undefined) {
520
+ appendFileSync(process.env.OMNIQA_SECURITY_ACCEPT, seen.map((f) => `${f.line}\n`).join(""));
521
+ return [];
522
+ }
523
+ for (const line of accepted.filter((a) => !seen.some((f) => f.line === a))) {
524
+ const message = `omniqa: no longer seen: ${line}; delete it`;
525
+ info.annotations.push({ type: "omniqa", description: message });
526
+ console.log(message);
527
+ }
528
+ const fresh = seen.filter((f) => !accepted.includes(f.line));
529
+ if (fresh.length === 0)
530
+ return [];
531
+ // The first line names the findings: a run's summary and a CI annotation carry that line alone.
532
+ throw new Error([
533
+ `omniqa: ${fresh.length} finding${fresh.length === 1 ? "" : "s"} beyond the accepted ones: ${fresh.map((f) => f.line).join(", ")}`,
534
+ ...fresh.map((f) => ` ${f.line} — ${interceptor.explanations[f.code] ?? "no explanation from Interceptor"}`),
535
+ ` Fix ${fresh.length === 1 ? "it" : "them"}, or accept ${fresh.length === 1 ? "it" : "them"} by adding the line${fresh.length === 1 ? "" : "s"} to the test's accepted list.`,
536
+ ].join("\n"));
537
+ },
538
+ };
539
+ },
234
540
  agent: async (s, info) => {
235
541
  const o = options();
236
542
  const omniqa = o.omniqa;
@@ -405,7 +711,7 @@ function slug(s) {
405
711
  return words.length <= 60 ? words : `${words.slice(0, 53)}-${createHash("sha1").update(s).digest("hex").slice(0, 6)}`;
406
712
  }
407
713
  function createInfo(o, file, title, titlePath, retry, repeat) {
408
- const rel = relative(o.testDir, file).replace(/\.(e2e|api)\.ts$/, "");
714
+ const rel = relative(o.testDir, file).replace(SPEC_FILE, "");
409
715
  const outputDir = join(o.rootDir, "test-results", `${slug(rel)}-${slug(titlePath.join(" "))}-${o.project}${repeat === 0 ? "" : `-repeat${repeat}`}${retry === 0 ? "" : `-retry${retry}`}`);
410
716
  rmSync(outputDir, { recursive: true, force: true });
411
717
  const info = {
@@ -533,10 +839,22 @@ function split(a, b) {
533
839
  throw new Error("omniqa: test() needs a function: test(title, { tag }, async ({ page, agent }) => { … })");
534
840
  return [opts, body];
535
841
  }
842
+ /** Why the tests of a security file do not run here: the proxy switches are Chrome's, and a security test belongs to a production-tier environment. */
843
+ function securitySkip(o) {
844
+ if (!securityFile)
845
+ return undefined;
846
+ if (o.android !== undefined || o.omniqa.device !== undefined || o.descriptor?.defaultBrowserType === "firefox")
847
+ return "security tests run on a desktop Chrome project";
848
+ return o.omniqa.environment?.tier === "production" ? undefined : "security tests run on a production-tier environment";
849
+ }
536
850
  function register(title, opts, body, node) {
537
851
  const o = options();
538
852
  const titlePath = [...describes, title];
539
853
  const tags = [...describeTags, ...[opts.tag ?? []].flat()];
854
+ // A test that names no kind is of the kind its file's suffix says: --grep @api takes the tests written before the kind tags, and the hand-written ones.
855
+ const kind = fileKind(specFile);
856
+ if (kind !== undefined && !tags.some((tag) => Object.values(KIND_TAG).includes(tag)))
857
+ tags.push(KIND_TAG[kind]);
540
858
  const rel = posix(relative(o.testDir, specFile));
541
859
  // Playwright's grep ran over the project, the file, the titles and the tags joined by spaces: --tier's `--grep @production` and the writer's `--grep "<id>: "` rely on it.
542
860
  const text = [o.project, rel, ...titlePath, ...tags].join(" ");
@@ -548,7 +866,7 @@ function register(title, opts, body, node) {
548
866
  console.log(`[${o.project}] › ${rel} › ${titlePath.join(" › ")}`);
549
867
  return;
550
868
  }
551
- const skip = uses.skip?.reason ?? node.skip;
869
+ const skip = uses.skip?.reason ?? node.skip ?? securitySkip(o);
552
870
  const only = node.only === undefined ? {} : { only: node.only };
553
871
  // No node timeout: the attempts' deadline bounds every phase (test.setTimeout moves it), so a stuck action settles when the context closes.
554
872
  for (let i = 0; i < o.repeatEach; i++)