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
@@ -0,0 +1,170 @@
1
+ import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
2
+ import { dirname, join } from "node:path";
3
+ import { OWASP_2025 } from "@omniqa/core";
4
+ import { requestRoute } from "@omniqa/web";
5
+ import { parseRequest } from "./security-request.js";
6
+ import { SEVERITIES } from "./security-research.js";
7
+ /**
8
+ * `.omniqa/security/report.md`: where the security checks and the agent scan found the product open. It is the one place that
9
+ * says so: the folder is not in git, and what git tracks (the plan, the test, security.md, state.json) says no more than to
10
+ * look here. Two parts: the basic checks that do not hold, a section a case that `omniqa write` keeps; and the last scan,
11
+ * replaced by each scan.
12
+ */
13
+ export const REPORT_FILE = ".omniqa/security/report.md";
14
+ const IGNORED = ".omniqa/security/";
15
+ const HEAD = `# Security report
16
+
17
+ Where OmniQA's security checks found this product open. This file is not in git (.gitignore has ${IGNORED}), and nothing
18
+ in git names what is in it: keep it that way.
19
+ `;
20
+ const BASIC = "## Basic checks that do not hold";
21
+ const SCAN = "## Agent scan";
22
+ const section = (f) => `### ${f.id}: ${f.title}
23
+
24
+ - found: ${f.finding}
25
+ - check: ${f.check}, OWASP ${f.category}, ${f.cwe.join(", ")}
26
+ - seen on ${f.environment} on ${f.date} by omniqa write
27
+ - after the fix, omniqa write --case ${f.id} writes the test
28
+ `;
29
+ /** The report's two parts: the basic checks' sections, one per case, each starting at its `### <id>: ` line, and the last scan as it stands, from its heading on. */
30
+ function parts(text) {
31
+ const all = text ?? "";
32
+ const at = all.search(new RegExp(`^${SCAN}$`, "m"));
33
+ const [before, scan] = at < 0 ? [all, ""] : [all.slice(0, at), all.slice(at)];
34
+ return { basic: before.split(/^(?=### )/m).slice(1).map((s) => `${s.trimEnd()}\n`), scan: scan.trimEnd() === "" ? "" : `${scan.trimEnd()}\n` };
35
+ }
36
+ const of = (id) => (s) => s.startsWith(`### ${id}: `);
37
+ async function write(cwd, basic, scan) {
38
+ const file = join(cwd, REPORT_FILE);
39
+ if (basic.length === 0 && scan === "")
40
+ return void (await rm(file, { force: true }));
41
+ await mkdir(dirname(file), { recursive: true });
42
+ await writeFile(file, [HEAD, ...(basic.length === 0 ? [] : [`${BASIC}\n`, ...basic]), ...(scan === "" ? [] : [scan])].join("\n"));
43
+ // A project set up before the kind existed, or by hand, may not ignore the folder yet: a report must never be one `git add` away.
44
+ const ignore = join(cwd, ".gitignore");
45
+ const lines = await readFile(ignore, "utf8").catch(() => "");
46
+ if (!lines.split("\n").some((line) => line.trim() === IGNORED))
47
+ await writeFile(ignore, `${lines === "" || lines.endsWith("\n") ? lines : `${lines}\n`}${IGNORED}\n`);
48
+ }
49
+ const read = (cwd) => readFile(join(cwd, REPORT_FILE), "utf8").catch(() => undefined);
50
+ /** The finding of a case, in place of what the report said of that case before. */
51
+ export async function setFinding(cwd, f) {
52
+ const { basic, scan } = parts(await read(cwd));
53
+ await write(cwd, [...basic.filter((s) => !of(f.id)(s)), section(f)], scan);
54
+ }
55
+ /** A case that now holds leaves the report; a report with nothing in it leaves the disk. */
56
+ export async function clearFinding(cwd, id) {
57
+ const text = await read(cwd);
58
+ const { basic, scan } = parts(text);
59
+ if (text !== undefined && basic.some(of(id)))
60
+ await write(cwd, basic.filter((s) => !of(id)(s)), scan);
61
+ }
62
+ /** The basic checks that do not hold, as the report lists them: `sec-access-2: <title>`, then what was found. What a scan's researcher is told not to repeat. */
63
+ export async function openFindings(cwd) {
64
+ return parts(await read(cwd)).basic.map((s) => `${(/^### (.*)$/m.exec(s)?.[1] ?? "").trim()}: ${(/^- found: (.*)$/m.exec(s)?.[1] ?? "").trim()}`);
65
+ }
66
+ const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
67
+ const owasp = (id) => `OWASP ${id}${OWASP_2025.find((c) => c.id === id) === undefined ? "" : ` ${OWASP_2025.find((c) => c.id === id)?.name}`}`;
68
+ const rank = (severity) => SEVERITIES.indexOf(severity);
69
+ /** A path as a report's step names it: by its route, as every line that says what was asked. */
70
+ const routed = (target) => requestRoute(URL.parse(target, "http://request")?.pathname ?? target);
71
+ /** A proof by request pattern: `1. POST /api/cart/coupon as free → 200`. The requests themselves are the lines under it. */
72
+ export const proofSteps = (proof) => proof.map((p, i) => `${i + 1}. ${parseRequest(p.request).method} ${routed(parseRequest(p.request).target)} as ${p.as} → ${p.status}${p.location === undefined ? "" : ` to ${routed(p.location)}`}`).join("; ");
73
+ const answers = (line) => {
74
+ const total = Object.values(line.answered).reduce((n, m) => n + m, 0);
75
+ const models = Object.entries(line.answered);
76
+ return models.length === 0 ? "no answer" : models.length === 1 ? `${plural(total, "answer")} from ${models[0]?.[0]}` : models.map(([model, n]) => `${n} of ${total} answers from ${model}`).join(", ");
77
+ };
78
+ const agentLine = (name, line) => `- ${name}: ${line.model}; ${line.calls} of ${line.callLimit} model calls, ${line.requests} of ${line.requestLimit} requests; ${answers(line)}`;
79
+ /** What a claim's section holds whoever judged it: what is at stake, the fix, the steps, the proof to send again. */
80
+ const claimBody = (c) => [`- impact: ${c.impact}`, `- fix: ${c.fix}`, `- steps: ${proofSteps(c.proof)}`, `- in the researcher's words: ${c.steps.join("; ")}`];
81
+ // One request a line, as JSON: whatever a body holds (a fence, a heading) stays inside its line, and reads back as it was written.
82
+ const proofBlock = (proof) => ["```proof", ...proof.map((p) => JSON.stringify({ as: p.as, request: p.request, status: p.status, ...(p.location === undefined ? {} : { location: p.location }) })), "```"];
83
+ function renderScan(r) {
84
+ const confirmed = r.confirmed.toSorted((a, b) => rank(a.severity) - rank(b.severity) || Number(b.id.replace(/\D/g, "")) - Number(a.id.replace(/\D/g, "")));
85
+ const bySeverity = SEVERITIES.map((severity) => [severity, confirmed.filter((c) => c.severity === severity).length]).filter(([, n]) => n > 0).map(([severity, n]) => `${n} ${severity}`);
86
+ return [
87
+ SCAN,
88
+ "",
89
+ `- ${r.environment}, ${r.date}`,
90
+ agentLine("researcher", r.researcher),
91
+ agentLine("reviewer", r.reviewer),
92
+ `- ${confirmed.length} confirmed${bySeverity.length === 0 ? "" : ` (${bySeverity.join(", ")})`}, ${r.discarded.length} discarded${r.unreviewed.length === 0 ? "" : `, ${r.unreviewed.length} without a verdict`}`,
93
+ ...(confirmed.length === 0 ? [] : ["", "## Confirmed claims", ...confirmed.flatMap((c) => [
94
+ "",
95
+ `### ${c.id}: ${c.title}`,
96
+ "",
97
+ `- severity: ${c.severity}${c.claimed === undefined || c.claimed === c.severity ? "" : ` (the researcher said ${c.claimed})`}; ${owasp(c.category)}`,
98
+ `- confirmed on ${c.environment} on ${c.date}${c.by === undefined ? "" : ` by ${c.by}`}: ${c.reason}`,
99
+ ...(c.known === true ? [`- still open on ${r.date}: its proof was sent again and answered as before`] : []),
100
+ ...(c.unsettled === undefined ? [] : [`- not settled on ${r.date}: ${c.unsettled}`]),
101
+ ...claimBody(c),
102
+ `- after the fix, omniqa write --claim ${c.id} writes the test`,
103
+ "",
104
+ ...proofBlock(c.proof),
105
+ ])]),
106
+ ...(r.discarded.length === 0 ? [] : ["", "## Discarded claims", "", ...r.discarded.map((d) => `- ${d.title} (OWASP ${d.category}, claimed ${d.severity}): ${d.reason}`)]),
107
+ ...(r.unreviewed.length === 0 ? [] : ["", "## Claims without a verdict", ...r.unreviewed.flatMap((c) => ["", `### ${c.title}`, "", `- no verdict: ${c.why}`, `- claimed ${c.severity}; ${owasp(c.category)}`, ...claimBody(c), "", ...proofBlock(c.proof)])]),
108
+ "",
109
+ "## Tried and found closed",
110
+ "",
111
+ ...(r.tried.length > 0 ? r.tried.map((line) => `- ${line}`) : (r.sent ?? []).length === 0 ? ["Nothing: the researcher ended without a list."] : ["Nothing: the researcher ended without a list. What it sent, each with the reason it gave:", "", ...r.sent.map((line) => `- ${line}`)]),
112
+ ...(r.notDone.length === 0 ? [] : ["", "## Not done", "", ...r.notDone.map((line) => `- ${line}`)]),
113
+ "",
114
+ ].join("\n");
115
+ }
116
+ /** The scan's sections in place of the last scan's; the basic checks' findings stay as they are. */
117
+ export async function writeScan(cwd, scan) {
118
+ await write(cwd, parts(await read(cwd)).basic, renderScan(scan));
119
+ }
120
+ /** The confirmed claims of a report, each as it was written: what the next scan sends again, and what `omniqa write --claim` turns into a test. */
121
+ export function parseClaims(text) {
122
+ const confirmed = /^## Confirmed claims$([\s\S]*?)(?=^## |(?![\s\S]))/m.exec(parts(text).scan)?.[1] ?? "";
123
+ return confirmed.split(/^(?=### )/m).slice(1).flatMap((s) => {
124
+ const head = /^### (claim-\d+): (.*)$/m.exec(s);
125
+ const line = (key) => new RegExp(`^- ${key}: (.*)$`, "m").exec(s)?.[1] ?? "";
126
+ const severity = /^- severity: (\w+)(?: \([^)]*\))?; OWASP (A\d\d)/m.exec(s);
127
+ const seen = /^- confirmed on (.+?) on (\d{4}-\d\d-\d\d)(?: by (\S+))?: (.*)$/m.exec(s);
128
+ const proof = /^```proof\n([\s\S]*?)^```$/m.exec(s)?.[1] ?? "";
129
+ if (head === null || severity === null || seen === null)
130
+ return [];
131
+ return [{
132
+ id: head[1],
133
+ title: head[2],
134
+ category: severity[2],
135
+ severity: severity[1],
136
+ steps: line("in the researcher's words").split("; ").filter((step) => step !== ""),
137
+ impact: line("impact"),
138
+ fix: line("fix"),
139
+ // A line that is no longer what was written costs that line: a report must never be what keeps the next scan from starting.
140
+ proof: proof.split("\n").filter((row) => row.trim() !== "").flatMap((row) => {
141
+ try {
142
+ const p = JSON.parse(row);
143
+ return typeof p?.as === "string" && typeof p.request === "string" && typeof p.status === "number" ? [p] : [];
144
+ }
145
+ catch {
146
+ return [];
147
+ }
148
+ }),
149
+ environment: seen[1],
150
+ date: seen[2],
151
+ reason: seen[4],
152
+ ...(seen[3] === undefined ? {} : { by: seen[3] }),
153
+ }];
154
+ });
155
+ }
156
+ export async function readClaims(cwd) {
157
+ return parseClaims(await read(cwd));
158
+ }
159
+ /**
160
+ * A claim that was fixed and is kept as a test leaves the list of what is open: its section goes, and the scan's lines say
161
+ * what became of it. The rest of the scan's sections stay as that scan wrote them.
162
+ */
163
+ export async function closeClaim(cwd, id, test) {
164
+ const { basic, scan } = parts(await read(cwd));
165
+ const without = scan.replace(new RegExp(`^### ${id}: [\\s\\S]*?(?=^###? |(?![\\s\\S]))`, "m"), "").replace(/^## Confirmed claims\n+(?=## |(?![\s\S]))/m, "");
166
+ if (without === scan)
167
+ return;
168
+ await write(cwd, basic, without.replace(/^(- \d+ confirmed[^\n]*\n)/m, `$1- since then: ${id} is fixed and kept as the test ${test}\n`));
169
+ }
170
+ //# sourceMappingURL=security-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-report.js","sourceRoot":"","sources":["../src/security-report.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,C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qa/web";
3
+ /**
4
+ * A captured request as the security code reads it: Interceptor's editable text (the request line, the headers, a blank line,
5
+ * the body) taken apart, and what of it may be kept. The text holds credentials, so what leaves this module for a file is names
6
+ * and shapes: a route pattern, the names of parameters and cookies, whether a value looks like an identifier. Never a value.
7
+ */
8
+ export interface RequestText {
9
+ method: string;
10
+ /** The request line's target: a path with its query, or an absolute url. */
11
+ target: string;
12
+ version: string;
13
+ /** In order, duplicates kept. */
14
+ headers: [string, string][];
15
+ /** As it is: only the header block's line ends are normalised. */
16
+ body: string;
17
+ }
18
+ /** The separator is whichever of CRLFCRLF and LFLF comes first, as in Interceptor's own parser. */
19
+ export declare function parseRequest(raw: string): RequestText;
20
+ export declare const renderRequest: (r: RequestText) => string;
21
+ /** The values of a header, whatever its case. */
22
+ export declare const headerValues: (r: RequestText, name: string) => string[];
23
+ /** The cookies a request carries, as name and value. */
24
+ export declare function cookiesOf(r: RequestText): [string, string][];
25
+ /** `r` without the headers named, whatever their case. */
26
+ export declare const withoutHeaders: (r: RequestText, names: string[]) => RequestText;
27
+ /** `r` with that header's value: in the header's place when the request has it, at the end when it does not. */
28
+ export declare function withHeader(r: RequestText, name: string, value: string): RequestText;
29
+ /** `r` carrying these cookies and no other; none at all drops the Cookie header. */
30
+ export declare function withCookies(r: RequestText, cookies: [string, string][]): RequestText;
31
+ export interface Parameter {
32
+ name: string;
33
+ value: string;
34
+ in: "query" | "form" | "json";
35
+ }
36
+ /**
37
+ * Each parameter of a request: the query's, and the top-level fields of a form-encoded or a JSON body.
38
+ * ponytail: a multipart body's fields and anything nested are not parameters; add them when a check needs to reach one.
39
+ */
40
+ export declare function parametersOf(r: RequestText): Parameter[];
41
+ /** `r` with that parameter holding `value`, where it is (the query, the form, the JSON body); `undefined` takes it out. */
42
+ export declare function withParameter(r: RequestText, p: Pick<Parameter, "name" | "in">, value: string | undefined): RequestText;
43
+ /** What a product calls its anti-forgery token, in a header or a field: the names the common frameworks give it. ponytail: a list; a product's own name for it is not known, and its `csrf` check then says the forged request was taken, for a human to judge. */
44
+ export declare const ANTI_FORGERY: RegExp;
45
+ /** A JSON Web Token by its shape: three base64url parts, the first a JSON object that names its algorithm. */
46
+ export declare function isJwt(value: string): boolean;
47
+ /** The JSON Web Token a request carries, in its Authorization header or else a cookie, with a way to send the request with another in its place (`undefined`: with none). */
48
+ export declare function jwtOf(r: RequestText): {
49
+ token: string;
50
+ put(token: string | undefined): RequestText;
51
+ } | undefined;
52
+ /** A parameter or a cookie that is called like a value (a map keyed by ids or emails, a cookie named after its user) is named by its shape, as a route is. */
53
+ export declare const nameOf: (name: string) => string;
54
+ /** The parts of a request's query, and of its body when that is a form, that are a value with no name: not parameters, and their text is no name to say. */
55
+ export declare function namelessOf(r: RequestText): Set<string>;
56
+ /** A request by names and shapes alone: what security.md may hold of it. */
57
+ export interface RequestFacts {
58
+ method: string;
59
+ /** Its path as the crawl names a route: no query, a number as `{n}`, an id as `{id}`. */
60
+ route: string;
61
+ /** The names of its parameters. */
62
+ parameters: string[];
63
+ /** The names of the cookies it carries. */
64
+ cookies: string[];
65
+ authorization: boolean;
66
+ /** The header or the body field that carries an anti-forgery token. */
67
+ antiForgery?: string;
68
+ /** What its values look like: `credentials` (a field holds a password it was given to look for: it is the sign-in), `an identifier`, `a JWT`, `a url`, `a file name`. */
69
+ carries: string[];
70
+ }
71
+ /** `passwords` are the values that make a request the sign-in: the walking account's password. */
72
+ export declare function requestFacts(raw: string, passwords?: string[]): RequestFacts;
73
+ type CookieSet = SecuritySession["cookies"][number];
74
+ /** The cookies an answer sets, each with the flags it is set with; a cookie that is being deleted (no value, no age, a past end) sets nothing. */
75
+ export declare function setCookies(headers: [string, string][]): CookieSet[];
76
+ /** One request as the pass read it: its facts, the status it was answered with, the cookies its answer set. */
77
+ export interface Observed extends RequestFacts {
78
+ status?: number;
79
+ sets: CookieSet[];
80
+ /** Its answer was a page (html that is no redirect) and it carried a parameter: where markup in one could become part of a page. */
81
+ page?: true;
82
+ }
83
+ /**
84
+ * What one actor's walk made, read off the sidecar before its capture is cleared for the next actor: every request that is
85
+ * no asset with its status, and of at most `share` of them, a few of each kind, the text (for the names in it) and the
86
+ * answer's headers (for the cookies it set). `more` says requests were left unread because the share ran out. `passwords`
87
+ * (the walking account's) tell which request is the sign-in. What is returned holds no value; the texts are dropped here.
88
+ */
89
+ export declare function readObserved(sidecar: Pick<Interceptor, "flows" | "raw" | "answer">, share: number, passwords: string[]): Promise<{
90
+ observed: Observed[];
91
+ more: boolean;
92
+ }>;
93
+ /**
94
+ * Sessions and Requests of security.md from what each actor's walk made.
95
+ * An account's session cookies are the ones its requests carry that no guest's request did, or that are called like a session
96
+ * (a product that hands every visitor one and keeps its name across the sign-in); an anti-forgery cookie is never one.
97
+ * A request's pages and an account's sign-out page are not in what the sidecar saw: the caller adds them from the crawl.
98
+ * ponytail: passive, so a session cookie a guest also has under an unusual name is missed; re-sending a request without each
99
+ * cookie in turn would tell, and is a request of OmniQA's own that the pass does not make.
100
+ */
101
+ export declare function sessionsAndRequests(walks: {
102
+ actor: string;
103
+ observed: Observed[];
104
+ }[]): {
105
+ sessions: SecuritySession[];
106
+ requests: SecurityRequest[];
107
+ };
108
+ export {};
109
+ //# sourceMappingURL=security-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-request.d.ts","sourceRoot":"","sources":["../src/security-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAgB,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,iCAAiC;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAC5B,kEAAkE;IAClE,IAAI,EAAE,MAAM,C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H,wBAAsB,YAAY,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,OAAO,GAAG,KAAK,GAAG,QAAQ,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC,CA8B/K;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,QAAQ,EAAE,CAAA;CAAE,EAAE,GAAG;IAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;IAAC,QAAQ,EAAE,eAAe,EAAE,CAAA;CAAE,CA6BlJ"}
@@ -0,0 +1,254 @@
1
+ import { requestRoute } from "@omniqa/web";
2
+ /** The separator is whichever of CRLFCRLF and LFLF comes first, as in Interceptor's own parser. */
3
+ export function parseRequest(raw) {
4
+ const crlf = raw.indexOf("\r\n\r\n");
5
+ const lf = raw.indexOf("\n\n");
6
+ const [head, body] = crlf !== -1 && (lf === -1 || crlf < lf) ? [raw.slice(0, crlf), raw.slice(crlf + 4)] : lf !== -1 ? [raw.slice(0, lf), raw.slice(lf + 2)] : [raw, ""];
7
+ const [line = "", ...rest] = head.replaceAll("\r\n", "\n").split("\n");
8
+ const [method = "", target = "", version = "HTTP/1.1"] = line.trim().split(/\s+/);
9
+ const headers = rest.flatMap((header) => {
10
+ const at = header.indexOf(":");
11
+ return at <= 0 ? [] : [[header.slice(0, at).trim(), header.slice(at + 1).trim()]];
12
+ });
13
+ return { method, target, version, headers, body };
14
+ }
15
+ export const renderRequest = (r) => `${[`${r.method} ${r.target} ${r.version}`, ...r.headers.map(([name, value]) => `${name}: ${value}`)].join("\n")}\n\n${r.body}`;
16
+ /** The values of a header, whatever its case. */
17
+ export const headerValues = (r, name) => r.headers.filter(([header]) => header.toLowerCase() === name.toLowerCase()).map(([, value]) => value);
18
+ /** The cookies a request carries, as name and value. */
19
+ export function cookiesOf(r) {
20
+ return headerValues(r, "cookie").flatMap((line) => line.split(";")).flatMap((pair) => {
21
+ const at = pair.indexOf("=");
22
+ const name = (at < 0 ? pair : pair.slice(0, at)).trim();
23
+ return name === "" ? [] : [[name, at < 0 ? "" : pair.slice(at + 1).trim()]];
24
+ });
25
+ }
26
+ /** `r` without the headers named, whatever their case. */
27
+ export const withoutHeaders = (r, names) => ({ ...r, headers: r.headers.filter(([header]) => !names.some((name) => name.toLowerCase() === header.toLowerCase())) });
28
+ /** `r` with that header's value: in the header's place when the request has it, at the end when it does not. */
29
+ export function withHeader(r, name, value) {
30
+ const at = r.headers.findIndex(([header]) => header.toLowerCase() === name.toLowerCase());
31
+ return { ...r, headers: at < 0 ? [...r.headers, [name, value]] : r.headers.map((header, i) => (i === at ? [header[0], value] : header)) };
32
+ }
33
+ /** `r` carrying these cookies and no other; none at all drops the Cookie header. */
34
+ export function withCookies(r, cookies) {
35
+ const line = cookies.map(([name, value]) => `${name}=${value}`).join("; ");
36
+ const bare = withoutHeaders(r, ["cookie"]);
37
+ if (line === "")
38
+ return bare;
39
+ const at = r.headers.findIndex(([header]) => header.toLowerCase() === "cookie");
40
+ return at < 0 ? { ...bare, headers: [...bare.headers, ["Cookie", line]] } : { ...bare, headers: [...r.headers.slice(0, at).filter(([header]) => header.toLowerCase() !== "cookie"), [r.headers[at][0], line], ...r.headers.slice(at + 1).filter(([header]) => header.toLowerCase() !== "cookie")] };
41
+ }
42
+ /**
43
+ * Each parameter of a request: the query's, and the top-level fields of a form-encoded or a JSON body.
44
+ * ponytail: a multipart body's fields and anything nested are not parameters; add them when a check needs to reach one.
45
+ */
46
+ export function parametersOf(r) {
47
+ const query = [...(URL.parse(r.target, "http://request")?.searchParams ?? [])].map(([name, value]) => ({ name, value, in: "query" }));
48
+ const type = (headerValues(r, "content-type")[0] ?? "").toLowerCase();
49
+ if (type.includes("application/x-www-form-urlencoded"))
50
+ return [...query, ...[...new URLSearchParams(r.body)].map(([name, value]) => ({ name, value, in: "form" }))];
51
+ if (!type.includes("json"))
52
+ return query;
53
+ let parsed;
54
+ try {
55
+ parsed = JSON.parse(r.body);
56
+ }
57
+ catch {
58
+ return query;
59
+ }
60
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed))
61
+ return query;
62
+ return [...query, ...Object.entries(parsed).map(([name, value]) => ({ name, value: typeof value === "string" ? value : JSON.stringify(value), in: "json" }))];
63
+ }
64
+ /** `r` with that parameter holding `value`, where it is (the query, the form, the JSON body); `undefined` takes it out. */
65
+ export function withParameter(r, p, value) {
66
+ if (p.in === "query") {
67
+ const url = new URL(r.target, "http://request");
68
+ if (value === undefined)
69
+ url.searchParams.delete(p.name);
70
+ else
71
+ url.searchParams.set(p.name, value);
72
+ return { ...r, target: /^https?:\/\//i.test(r.target) ? url.href : `${url.pathname}${url.search}` };
73
+ }
74
+ if (p.in === "form") {
75
+ const form = new URLSearchParams(r.body);
76
+ if (value === undefined)
77
+ form.delete(p.name);
78
+ else
79
+ form.set(p.name, value);
80
+ return { ...r, body: form.toString() };
81
+ }
82
+ const body = JSON.parse(r.body);
83
+ if (value === undefined)
84
+ delete body[p.name];
85
+ else
86
+ body[p.name] = value;
87
+ return { ...r, body: JSON.stringify(body) };
88
+ }
89
+ /** What a product calls its anti-forgery token, in a header or a field: the names the common frameworks give it. ponytail: a list; a product's own name for it is not known, and its `csrf` check then says the forged request was taken, for a human to judge. */
90
+ export const ANTI_FORGERY = /csrf|xsrf|authenticity|^_token$|requestverificationtoken|wpnonce|^_?nonce$/i;
91
+ /** A JSON Web Token by its shape: three base64url parts, the first a JSON object that names its algorithm. */
92
+ export function isJwt(value) {
93
+ const m = /^([\w-]+)\.[\w-]+\.[\w-]*$/.exec(value.trim());
94
+ if (m === null)
95
+ return false;
96
+ try {
97
+ const header = JSON.parse(Buffer.from(m[1], "base64url").toString("utf8"));
98
+ return typeof header === "object" && header !== null && "alg" in header;
99
+ }
100
+ catch {
101
+ return false;
102
+ }
103
+ }
104
+ /** The JSON Web Token a request carries, in its Authorization header or else a cookie, with a way to send the request with another in its place (`undefined`: with none). */
105
+ export function jwtOf(r) {
106
+ const authorization = r.headers.find(([header, value]) => header.toLowerCase() === "authorization" && isJwt(value.split(/\s+/).at(-1) ?? ""));
107
+ if (authorization !== undefined) {
108
+ const [name, value] = authorization;
109
+ const token = value.split(/\s+/).at(-1);
110
+ return { token, put: (other) => (other === undefined ? withoutHeaders(r, [name]) : withHeader(r, name, `${value.slice(0, value.length - token.length)}${other}`)) };
111
+ }
112
+ const cookies = cookiesOf(r);
113
+ const cookie = cookies.find(([, value]) => isJwt(value));
114
+ return cookie === undefined ? undefined : { token: cookie[1], put: (other) => withCookies(r, cookies.flatMap(([name, value]) => (name !== cookie[0] ? [[name, value]] : other === undefined ? [] : [[name, other]]))) };
115
+ }
116
+ const UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
117
+ const LONG_HEX = /^[0-9a-f]{12,}$/i;
118
+ /** A value that names one thing of someone's: a uuid or a long hex id whatever it is called, a number only in a parameter called an id (a page, a count and a price are numbers too). */
119
+ const identifies = (p) => UUID.test(p.value) || LONG_HEX.test(p.value) || (/^\d+$/.test(p.value) && /id$/i.test(p.name));
120
+ const isUrl = (value) => /^https?:\/\/\S+$/i.test(value) || /^\/[^\s/]\S*$/.test(value);
121
+ const isFileName = (value) => /^[\w][\w .-]*\.[a-z0-9]{1,5}$/i.test(value) && !/^\d+\.\d+$/.test(value) && !isJwt(value);
122
+ /** What a name looks like: letters, digits and the few signs a field's or a cookie's name uses, forty characters at most. */
123
+ const NAME = /^[A-Za-z_.][\w.\-[\]]{0,39}$/;
124
+ /** A parameter or a cookie that is called like a value (a map keyed by ids or emails, a cookie named after its user) is named by its shape, as a route is. */
125
+ export const nameOf = (name) => (/^\d+$/.test(name) ? "{n}" : LONG_HEX.test(name) || UUID.test(name) ? "{id}" : NAME.test(name) ? name : "{value}");
126
+ /** The parts of a query or a form body that are a value with no name (`/search?blue+shoes`, a JSON text sent as a form): what such a part holds is nobody's name. */
127
+ const unnamed = (encoded) => encoded.split("&").filter((part) => part !== "" && !part.includes("=")).map((part) => [...new URLSearchParams(part).keys()][0] ?? "");
128
+ /** The parts of a request's query, and of its body when that is a form, that are a value with no name: not parameters, and their text is no name to say. */
129
+ export function namelessOf(r) {
130
+ const form = (headerValues(r, "content-type")[0] ?? "").toLowerCase().includes("x-www-form-urlencoded");
131
+ return new Set([...unnamed(r.target.split("?")[1] ?? ""), ...(form ? unnamed(r.body) : [])]);
132
+ }
133
+ /** `passwords` are the values that make a request the sign-in: the walking account's password. */
134
+ export function requestFacts(raw, passwords = []) {
135
+ const r = parseRequest(raw);
136
+ const route = requestRoute(URL.parse(r.target, "http://request")?.pathname ?? "/");
137
+ const parameters = parametersOf(r);
138
+ const cookies = cookiesOf(r);
139
+ const authorization = headerValues(r, "authorization");
140
+ const antiForgery = r.headers.find(([name]) => ANTI_FORGERY.test(name))?.[0] ?? parameters.find((p) => p.in !== "query" && ANTI_FORGERY.test(p.name))?.name;
141
+ // An Authorization value is its scheme and its token; a cookie's value may be a token too. One in a parameter is not counted: the token check changes a token where a session rides.
142
+ const tokens = [...authorization.map((value) => value.split(/\s+/).at(-1) ?? ""), ...cookies.map(([, value]) => value)];
143
+ const carries = [
144
+ ...(parameters.some((p) => p.in !== "query" && passwords.includes(p.value)) ? ["credentials"] : []),
145
+ ...(route.includes("{") || parameters.some(identifies) ? ["an identifier"] : []),
146
+ ...(tokens.some(isJwt) ? ["a JWT"] : []),
147
+ ...(parameters.some((p) => isUrl(p.value)) ? ["a url"] : []),
148
+ ...(parameters.some((p) => isFileName(p.value)) ? ["a file name"] : []),
149
+ ];
150
+ const values = namelessOf(r);
151
+ return { method: r.method.toUpperCase(), route, parameters: [...new Set(parameters.map((p) => (values.has(p.name) ? "{value}" : nameOf(p.name))))], cookies: [...new Set(cookies.map(([name]) => nameOf(name)))], authorization: authorization.length > 0, ...(antiForgery === undefined ? {} : { antiForgery: nameOf(antiForgery) }), carries };
152
+ }
153
+ /** The cookies an answer sets, each with the flags it is set with; a cookie that is being deleted (no value, no age, a past end) sets nothing. */
154
+ export function setCookies(headers) {
155
+ return headers.filter(([name]) => name.toLowerCase() === "set-cookie").flatMap(([, line]) => {
156
+ const [pair = "", ...attributes] = line.split(";").map((part) => part.trim());
157
+ const at = pair.indexOf("=");
158
+ const attribute = (name) => attributes.find((a) => a.toLowerCase() === name || a.toLowerCase().startsWith(`${name}=`));
159
+ // Max-Age decides where both are given, as a browser reads them.
160
+ const [maxAge, expires] = [attribute("max-age")?.slice("max-age=".length), attribute("expires")?.slice("expires=".length)];
161
+ if (at <= 0 || pair.slice(at + 1) === "" || (maxAge !== undefined ? Number(maxAge) <= 0 : expires !== undefined && Date.parse(expires) < Date.now()))
162
+ return [];
163
+ const sameSite = attribute("samesite")?.slice("samesite=".length).toLowerCase();
164
+ return [{ name: pair.slice(0, at), flags: { secure: attribute("secure") !== undefined, httpOnly: attribute("httponly") !== undefined, ...(sameSite === undefined || sameSite === "" ? {} : { sameSite }) } }];
165
+ });
166
+ }
167
+ /** The requests of one kind (a method and a route) that are read: three tell what thirty would, and the share goes to requests that differ. */
168
+ const READ_PER_KIND = 3;
169
+ /**
170
+ * What one actor's walk made, read off the sidecar before its capture is cleared for the next actor: every request that is
171
+ * no asset with its status, and of at most `share` of them, a few of each kind, the text (for the names in it) and the
172
+ * answer's headers (for the cookies it set). `more` says requests were left unread because the share ran out. `passwords`
173
+ * (the walking account's) tell which request is the sign-in. What is returned holds no value; the texts are dropped here.
174
+ */
175
+ export async function readObserved(sidecar, share, passwords) {
176
+ const flows = sidecar.flows().filter((flow) => !flow.asset);
177
+ const perKind = new Map();
178
+ let read = 0;
179
+ let more = false;
180
+ // Of a kind, the requests that carried a query are read first: a page a walk opened five times by its address and once with what it
181
+ // takes is known by that once.
182
+ const picked = flows.map(() => false);
183
+ for (const i of flows.map((_, index) => index).toSorted((a, b) => Number(flows[b]?.query) - Number(flows[a]?.query))) {
184
+ const flow = flows[i];
185
+ const kind = `${flow.method} ${requestRoute(flow.path)}`;
186
+ perKind.set(kind, (perKind.get(kind) ?? 0) + 1);
187
+ if (perKind.get(kind) > READ_PER_KIND)
188
+ continue;
189
+ if (read >= share)
190
+ more = true;
191
+ picked[i] = read++ < share;
192
+ }
193
+ const observed = [];
194
+ // A few at a time: each answer comes on Interceptor's next tick, whoever asked.
195
+ for (let i = 0; i < flows.length; i += 8) {
196
+ observed.push(...(await Promise.all(flows.slice(i, i + 8).map(async (flow, j) => {
197
+ // An answer that has not come by the end of the walk (a request a page keeps open) is not asked for: the sidecar would wait for it.
198
+ const [raw, answer] = picked[i + j] === true ? await Promise.all([sidecar.raw(flow.id), flow.status === undefined ? undefined : sidecar.answer(flow.id)]) : [undefined, undefined];
199
+ // Unread, or with no text to read (a streamed body): the request by its summary, which still says who got which status.
200
+ const facts = raw === undefined ? { method: flow.method, route: requestRoute(flow.path), parameters: [], cookies: [], authorization: false, carries: [] } : requestFacts(raw, passwords);
201
+ // What a router's script fetches of a page's route is answered data, and a page a visitor is sent on from is a redirect: neither is a page.
202
+ const page = flow.page && flow.status !== undefined && (flow.status < 300 || flow.status >= 400) && facts.parameters.length > 0;
203
+ return { ...facts, ...(flow.status === undefined ? {} : { status: flow.status }), sets: answer === undefined ? [] : setCookies(answer.headers), ...(page ? { page } : {}) };
204
+ }))));
205
+ }
206
+ return { observed, more };
207
+ }
208
+ /** A cookie every visitor gets that is a session all the same, by what products call one. */
209
+ const SESSION_NAME = /sess|sid/i;
210
+ /**
211
+ * Sessions and Requests of security.md from what each actor's walk made.
212
+ * An account's session cookies are the ones its requests carry that no guest's request did, or that are called like a session
213
+ * (a product that hands every visitor one and keeps its name across the sign-in); an anti-forgery cookie is never one.
214
+ * A request's pages and an account's sign-out page are not in what the sidecar saw: the caller adds them from the crawl.
215
+ * ponytail: passive, so a session cookie a guest also has under an unusual name is missed; re-sending a request without each
216
+ * cookie in turn would tell, and is a request of OmniQA's own that the pass does not make.
217
+ */
218
+ export function sessionsAndRequests(walks) {
219
+ const guestCookies = new Set(walks.filter((w) => w.actor === "guest").flatMap((w) => w.observed.flatMap((o) => o.cookies)));
220
+ const guestSets = walks.filter((w) => w.actor === "guest").flatMap((w) => w.observed.flatMap((o) => o.sets));
221
+ const sessionCookies = new Map();
222
+ const sessions = walks.filter((w) => w.actor !== "guest").map((w) => {
223
+ const names = [...new Set(w.observed.flatMap((o) => o.cookies))].filter((name) => !ANTI_FORGERY.test(name) && (!guestCookies.has(name) || SESSION_NAME.test(name)));
224
+ sessionCookies.set(w.actor, new Set(names));
225
+ // The flags of the newest answer that set it: the sign-in's, where the sign-in renews a cookie the visitor already had.
226
+ const sets = [...guestSets, ...w.observed.flatMap((o) => o.sets)];
227
+ const antiForgery = w.observed.find((o) => o.antiForgery !== undefined)?.antiForgery;
228
+ return { account: w.actor, cookies: names.map((name) => sets.findLast((c) => c.name === name) ?? { name }), authorization: w.observed.some((o) => o.authorization), ...(antiForgery === undefined ? {} : { antiForgery }) };
229
+ });
230
+ const rows = new Map();
231
+ for (const w of walks) {
232
+ for (const o of w.observed) {
233
+ const key = `${o.method} ${o.route}`;
234
+ const row = rows.get(key) ?? { request: key, statuses: {}, parameters: [], carries: [], pages: [], pageFor: [], forms: [] };
235
+ rows.set(key, row);
236
+ // A request that got no answer is not written for that actor: a row says who was answered what.
237
+ if (o.status !== undefined && !(row.statuses[w.actor] ??= []).includes(o.status))
238
+ row.statuses[w.actor].push(o.status);
239
+ for (const name of o.parameters)
240
+ if (!row.parameters.includes(name))
241
+ row.parameters.push(name);
242
+ const carries = [...(o.cookies.some((name) => sessionCookies.get(w.actor)?.has(name)) ? ["cookie"] : []), ...(o.authorization ? ["authorization"] : []), ...o.carries];
243
+ for (const kind of carries)
244
+ if (!row.carries.includes(kind))
245
+ row.carries.push(kind);
246
+ if (o.page === true && !row.pageFor.includes(w.actor))
247
+ row.pageFor.push(w.actor);
248
+ }
249
+ }
250
+ // In one order whatever the walks' order was: a session first, then the shapes.
251
+ const order = ["cookie", "authorization", "credentials", "an identifier", "a JWT", "a url", "a file name"];
252
+ return { sessions, requests: [...rows.values()].map((row) => ({ ...row, carries: row.carries.toSorted((a, b) => order.indexOf(a) - order.indexOf(b)) })) };
253
+ }
254
+ //# sourceMappingURL=security-request.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"security-request.js","sourceRoot":"","sources":["../src/security-request.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAoB,MAAM,aAAa,CAAC;AAkB7D,mGAAmG;AACnG,MAAM,UAAU,YAAY,CAAC,GAAW;IACtC,MAAM,IAAI,GAAG,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACrC,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,IAAI,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACzK,MAAM,CAAC,IAAI,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACvE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