omniqa 0.7.0 → 0.9.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 +10 -1
- package/dist/.tsbuildinfo +1 -1
- package/dist/auth.d.ts +17 -0
- package/dist/auth.d.ts.map +1 -1
- package/dist/auth.js +29 -1
- package/dist/auth.js.map +1 -1
- package/dist/cli.js +18 -5
- package/dist/cli.js.map +1 -1
- package/dist/commands/chat.js +1 -1
- package/dist/commands/chat.js.map +1 -1
- package/dist/commands/crawl.d.ts.map +1 -1
- package/dist/commands/crawl.js +17 -5
- package/dist/commands/crawl.js.map +1 -1
- package/dist/commands/doctor.d.ts +23 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +152 -6
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/generate.js +1 -1
- package/dist/commands/generate.js.map +1 -1
- package/dist/commands/init.d.ts +3 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +217 -50
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/knowledge.d.ts +61 -1
- package/dist/commands/knowledge.d.ts.map +1 -1
- package/dist/commands/knowledge.js +232 -50
- package/dist/commands/knowledge.js.map +1 -1
- package/dist/commands/persist.d.ts +6 -0
- package/dist/commands/persist.d.ts.map +1 -1
- package/dist/commands/persist.js +9 -2
- package/dist/commands/persist.js.map +1 -1
- package/dist/commands/plan-add.d.ts.map +1 -1
- package/dist/commands/plan-add.js +13 -3
- package/dist/commands/plan-add.js.map +1 -1
- package/dist/commands/plan-review.d.ts +6 -2
- package/dist/commands/plan-review.d.ts.map +1 -1
- package/dist/commands/plan-review.js +16 -5
- package/dist/commands/plan-review.js.map +1 -1
- package/dist/commands/plan.d.ts +15 -0
- package/dist/commands/plan.d.ts.map +1 -1
- package/dist/commands/plan.js +103 -32
- package/dist/commands/plan.js.map +1 -1
- package/dist/commands/reindex.d.ts +1 -1
- package/dist/commands/reindex.d.ts.map +1 -1
- package/dist/commands/reindex.js +15 -1
- package/dist/commands/reindex.js.map +1 -1
- package/dist/commands/security.d.ts +4 -2
- package/dist/commands/security.d.ts.map +1 -1
- package/dist/commands/security.js +18 -7
- package/dist/commands/security.js.map +1 -1
- package/dist/commands/serve.d.ts +2 -0
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +126 -30
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/sync.d.ts.map +1 -1
- package/dist/commands/sync.js +19 -2
- package/dist/commands/sync.js.map +1 -1
- package/dist/commands/test.d.ts +5 -1
- package/dist/commands/test.d.ts.map +1 -1
- package/dist/commands/test.js +106 -6
- package/dist/commands/test.js.map +1 -1
- package/dist/commands/write.d.ts +8 -2
- package/dist/commands/write.d.ts.map +1 -1
- package/dist/commands/write.js +101 -18
- package/dist/commands/write.js.map +1 -1
- package/dist/devices.d.ts +3 -1
- package/dist/devices.d.ts.map +1 -1
- package/dist/devices.js +5 -3
- package/dist/devices.js.map +1 -1
- package/dist/fixer.d.ts.map +1 -1
- package/dist/fixer.js +19 -9
- package/dist/fixer.js.map +1 -1
- package/dist/jobs.d.ts +6 -0
- package/dist/jobs.d.ts.map +1 -1
- package/dist/jobs.js +10 -1
- package/dist/jobs.js.map +1 -1
- package/dist/mcp/server.d.ts +1 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +1 -1
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/session.d.ts.map +1 -1
- package/dist/mcp/session.js +7 -7
- package/dist/mcp/session.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +9 -6
- package/dist/mcp/tools.js.map +1 -1
- package/dist/page.d.ts +1 -1
- package/dist/page.d.ts.map +1 -1
- package/dist/page.js +11 -0
- package/dist/page.js.map +1 -1
- package/dist/planner.d.ts.map +1 -1
- package/dist/planner.js +8 -4
- package/dist/planner.js.map +1 -1
- package/dist/prompt.d.ts +7 -1
- package/dist/prompt.d.ts.map +1 -1
- package/dist/prompt.js +23 -4
- package/dist/prompt.js.map +1 -1
- package/dist/qa.d.ts +7 -0
- package/dist/qa.d.ts.map +1 -1
- package/dist/qa.js +34 -9
- package/dist/qa.js.map +1 -1
- package/dist/runner.d.ts +7 -2
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +28 -8
- package/dist/runner.js.map +1 -1
- package/dist/security-checks.d.ts +46 -4
- package/dist/security-checks.d.ts.map +1 -1
- package/dist/security-checks.js +114 -39
- package/dist/security-checks.js.map +1 -1
- package/dist/security-gates.d.ts +64 -7
- package/dist/security-gates.d.ts.map +1 -1
- package/dist/security-gates.js +125 -16
- package/dist/security-gates.js.map +1 -1
- package/dist/security-mask.d.ts +35 -0
- package/dist/security-mask.d.ts.map +1 -0
- package/dist/security-mask.js +104 -0
- package/dist/security-mask.js.map +1 -0
- package/dist/security-report.d.ts +93 -2
- package/dist/security-report.d.ts.map +1 -1
- package/dist/security-report.js +153 -14
- package/dist/security-report.js.map +1 -1
- package/dist/security-request.d.ts +27 -4
- package/dist/security-request.d.ts.map +1 -1
- package/dist/security-request.js +56 -14
- package/dist/security-request.js.map +1 -1
- package/dist/security-research.d.ts +132 -0
- package/dist/security-research.d.ts.map +1 -0
- package/dist/security-research.js +599 -0
- package/dist/security-research.js.map +1 -0
- package/dist/security-scan.d.ts +98 -0
- package/dist/security-scan.d.ts.map +1 -0
- package/dist/security-scan.js +463 -0
- package/dist/security-scan.js.map +1 -0
- package/dist/security.d.ts +18 -4
- package/dist/security.d.ts.map +1 -1
- package/dist/security.js +181 -37
- package/dist/security.js.map +1 -1
- package/dist/sync.d.ts +55 -3
- package/dist/sync.d.ts.map +1 -1
- package/dist/sync.js +403 -54
- package/dist/sync.js.map +1 -1
- package/dist/test.d.ts +26 -2
- package/dist/test.d.ts.map +1 -1
- package/dist/test.js +152 -29
- package/dist/test.js.map +1 -1
- package/dist/writer.d.ts +29 -10
- package/dist/writer.d.ts.map +1 -1
- package/dist/writer.js +116 -36
- package/dist/writer.js.map +1 -1
- package/package.json +7 -7
- package/skills/knowledge.md +1 -1
- package/skills/security-research.md +57 -0
- package/skills/security-review.md +27 -0
- package/skills/onboarding.md +0 -5
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ANTI_FORGERY, isJwt } from "./security-request.js";
|
|
2
|
+
/** A cookie's value shorter than this is a flag or a choice (a theme, a consent), and replacing it would rewrite the text around it. */
|
|
3
|
+
const SESSION_LENGTH = 8;
|
|
4
|
+
/** An account's field shorter than this is not masked, as the transcripts' redactor leaves it. */
|
|
5
|
+
const FIELD_LENGTH = 4;
|
|
6
|
+
/** The owner of a credential no actor of the scan holds: one the product handed out in an answer. */
|
|
7
|
+
const UNKNOWN = "unknown";
|
|
8
|
+
/** An actor's session as secrets: each cookie of its browser that is long enough to be one, and the token of each Authorization header its pages sent. */
|
|
9
|
+
export function sessionSecrets(owner, cookies, authorization = []) {
|
|
10
|
+
return [
|
|
11
|
+
...cookies.filter(([, value]) => value.length >= SESSION_LENGTH).map(([name, value]) => ({ placeholder: `<session:${owner}:${name}>`, value })),
|
|
12
|
+
...[...new Set(authorization.map((line) => line.trim().split(/\s+/).at(-1) ?? ""))].filter((token) => token !== "").map((value) => ({ placeholder: `<authorization:${owner}>`, value })),
|
|
13
|
+
];
|
|
14
|
+
}
|
|
15
|
+
/** The accounts of product.yaml as secrets: each field under its own name, `<password:free>`, `<email:free>`. */
|
|
16
|
+
export function accountSecrets(accounts) {
|
|
17
|
+
return Object.entries(accounts).flatMap(([owner, fields]) => Object.entries(fields).filter(([, value]) => value.length >= FIELD_LENGTH).map(([field, value]) => ({ placeholder: `<${field}:${owner}>`, value })));
|
|
18
|
+
}
|
|
19
|
+
/** The forms a value travels in, the plain one first: a form that reads like an earlier one is that one. */
|
|
20
|
+
const FORMS = [
|
|
21
|
+
["", (value) => value],
|
|
22
|
+
["url", encodeURIComponent],
|
|
23
|
+
["form", (value) => new URLSearchParams({ v: value }).toString().slice(2)],
|
|
24
|
+
["base64", (value) => Buffer.from(value).toString("base64")],
|
|
25
|
+
["base64url", (value) => Buffer.from(value).toString("base64url")],
|
|
26
|
+
];
|
|
27
|
+
const formed = (placeholder, form) => (form === "" ? placeholder : `${placeholder.slice(0, -1)}|${form}>`);
|
|
28
|
+
/** Each text a secret may stand as, with the placeholder that says which form it was. */
|
|
29
|
+
function needles(secrets) {
|
|
30
|
+
const found = new Map();
|
|
31
|
+
// Every value as it is before any encoded form: a session whose value reads like an account's encoded field (a cookie that is the user's email) is that session.
|
|
32
|
+
for (const [form, encode] of FORMS)
|
|
33
|
+
for (const secret of secrets)
|
|
34
|
+
if (!found.has(encode(secret.value)))
|
|
35
|
+
found.set(encode(secret.value), formed(secret.placeholder, form));
|
|
36
|
+
// The longest first: a value inside a longer one (a token that holds an id) must not break the longer one up.
|
|
37
|
+
return [...found].toSorted(([a], [b]) => b.length - a.length);
|
|
38
|
+
}
|
|
39
|
+
/** What a product calls a credential, in a field, a parameter or a header of its own: the names, since the value says nothing. ponytail: a list; a product's own word for its key is not on it, and its value is then masked only where the scan holds it. */
|
|
40
|
+
const SECRET_NAME = /token|secret|passw|session|api[-_]?key|jwt|credential/i;
|
|
41
|
+
/** A name whose value is masked by what it is called: a credential's, and not the anti-forgery token's, which an agent composes with. */
|
|
42
|
+
const secretName = (name) => SECRET_NAME.test(name) && !ANTI_FORGERY.test(name);
|
|
43
|
+
const PLACEHOLDER = /<([a-z_][\w-]*):([^:<>|\s]+)(?::([^<>|\s]+))?(?:\|(url|form|base64|base64url))?>/gi;
|
|
44
|
+
const masked = (value) => value.startsWith("<") && value.endsWith(">");
|
|
45
|
+
/** A `name=value` of a Cookie or a Set-Cookie line whose value no secret of the scan is: long enough to be a session, it is one nobody holds. */
|
|
46
|
+
const unknownCookie = (cookie) => {
|
|
47
|
+
const at = cookie.indexOf("=");
|
|
48
|
+
const [name, value] = at < 0 ? [cookie.trim(), ""] : [cookie.slice(0, at).trim(), cookie.slice(at + 1).trim()];
|
|
49
|
+
return at < 0 || value.length < SESSION_LENGTH || masked(value) ? cookie : `${cookie.slice(0, at + 1)}<session:${UNKNOWN}:${name}>`;
|
|
50
|
+
};
|
|
51
|
+
const JWT_SHAPED = /[\w-]{8,}\.[\w-]{8,}\.[\w-]*/g;
|
|
52
|
+
/**
|
|
53
|
+
* `text` as an agent may read it: every secret replaced by its placeholder, in whatever form it stands (plain, url-encoded,
|
|
54
|
+
* as a form field, base64), in a request's text and in an answer's headers and body alike. A credential that is nobody's
|
|
55
|
+
* of the scan is masked by where it stands: a cookie's value on a Cookie or a Set-Cookie line, what follows the scheme on
|
|
56
|
+
* an Authorization line, anything shaped like a JSON Web Token, and the value of whatever is called like a credential (a
|
|
57
|
+
* JSON field, a parameter of a query or a form, a header of the product's own): a token an answer hands out is one too.
|
|
58
|
+
* ponytail: a token's claims are masked with it; its header and payload decoded into the placeholder when the researcher needs to read them.
|
|
59
|
+
*/
|
|
60
|
+
export function mask(text, secrets) {
|
|
61
|
+
let out = text;
|
|
62
|
+
for (const [needle, placeholder] of needles(secrets))
|
|
63
|
+
out = out.split(needle).join(placeholder);
|
|
64
|
+
return out
|
|
65
|
+
.replace(/^(cookie[ \t]*:)(.*)$/gim, (_line, head, cookies) => `${head}${cookies.split(";").map(unknownCookie).join(";")}`)
|
|
66
|
+
.replace(/^(set-cookie[ \t]*:)([^;\n]*)(.*)$/gim, (_line, head, cookie, attributes) => `${head}${unknownCookie(cookie)}${attributes}`)
|
|
67
|
+
.replace(/^((?:proxy-)?authorization[ \t]*:[ \t]*)(.*?)(\S+)[ \t]*$/gim, (line, head, scheme, token) => (masked(token) ? line : `${head}${scheme}<authorization:${UNKNOWN}>`))
|
|
68
|
+
.replace(JWT_SHAPED, (token) => (isJwt(token) ? `<token:${UNKNOWN}>` : token))
|
|
69
|
+
.replace(/^([\w-]+)([ \t]*:[ \t]*)(\S.{7,})$/gm, (line, name, colon, value) => (secretName(name) && !/^(set-)?cookie$|authorization$/i.test(name) && !value.includes("<") ? `${name}${colon}<secret:${UNKNOWN}:${name}>` : line))
|
|
70
|
+
.replace(/"([\w.-]+)"(\s*:\s*)"([^"\\<]{8,})"/g, (field, name, colon) => (secretName(name) ? `"${name}"${colon}"<secret:${UNKNOWN}:${name}>"` : field))
|
|
71
|
+
.replace(/([?&#;]|^)([\w.-]+)=([^&\s"'<>;]{8,})/gm, (parameter, before, name) => (secretName(name) ? `${before}${name}=<secret:${UNKNOWN}:${name}>` : parameter));
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What an agent composed, with the values back where it wrote their placeholders, each in the form its placeholder names.
|
|
75
|
+
* A placeholder the scan holds no value for is an error that says why: the agent named an account nobody signed in as, or a
|
|
76
|
+
* session the product handed one of its own requests, which is never kept (a probe that gets in ends there).
|
|
77
|
+
*/
|
|
78
|
+
export function unmask(text, secrets) {
|
|
79
|
+
const owners = new Set(secrets.map((s) => /^<[^:<>]+:([^:<>|]+)/.exec(s.placeholder)?.[1]));
|
|
80
|
+
return text.replace(PLACEHOLDER, (written, kind, owner, name, form) => {
|
|
81
|
+
const plain = `<${kind}:${owner}${name === undefined ? "" : `:${name}`}>`;
|
|
82
|
+
const secret = secrets.find((s) => s.placeholder === plain);
|
|
83
|
+
if (secret !== undefined)
|
|
84
|
+
return FORMS.find(([f]) => f === (form ?? ""))[1](secret.value);
|
|
85
|
+
const session = ["session", "authorization", "token", "secret"].includes(kind.toLowerCase());
|
|
86
|
+
// Anything else between angle brackets with a colon in it is the agent's own text: an element of a namespace in an XML body.
|
|
87
|
+
if (!session && !owners.has(owner))
|
|
88
|
+
return written;
|
|
89
|
+
if (owner === UNKNOWN)
|
|
90
|
+
throw new Error(`${written} cannot be put back: a session the product handed a request of yours is not kept; report what got in and leave it unused`);
|
|
91
|
+
const signedIn = secrets.some((s) => new RegExp(`^<(session|authorization):${owner.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}[:>]`).test(s.placeholder));
|
|
92
|
+
throw new Error(session && !signedIn ? `${written} cannot be put back: ${owner} is not signed in in this scan (browse as ${owner} first)` : `${written} cannot be put back: this scan holds no such value of ${owner}`);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/** How much of a text an agent is shown at once, in characters. */
|
|
96
|
+
export const WINDOW = 8192;
|
|
97
|
+
/** 8 KB of a text from an offset, with how much is left and where the next part starts: a body is read a part at a time. */
|
|
98
|
+
export function window(text, from = 0) {
|
|
99
|
+
if (from > 0 && from >= text.length)
|
|
100
|
+
return `nothing from ${from} on: the text has ${text.length} characters`;
|
|
101
|
+
const left = text.length - from - WINDOW;
|
|
102
|
+
return left <= 0 ? text.slice(from) : `${text.slice(from, from + WINDOW)}\n… ${left} more characters: from ${from + WINDOW} shows the next part`;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=security-mask.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-mask.js","sourceRoot":"","sources":["../src/security-mask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAc5D,wIAAwI;AACxI,MAAM,cAAc,GAAG,CAAC,CAAC;AACzB,kGAAkG;AAClG,MAAM,YAAY,GAAG,CAAC,CAAC;AACvB,qGAAqG;AACrG,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B,0JAA0J;AAC1J,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,OAA2B,EAAE,gBAA0B,EAAE;IACrG,OAAO;QACL,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,IAAI,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,WAAW,EAAE,YAAY,KAAK,IAAI,IAAI,GAAG,EAAE,KAAK,EAAE,CAAC,CAAC;QAC/I,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,aAAa,CAAC,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,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,OAAO,IAAI,0BAA0B,IAAI,GAAG,MAAM,sBAAsB,CAAC;AACnJ,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import type { Claimed, ProofRequest, Severity } from "./security-research.ts";
|
|
1
2
|
/**
|
|
2
|
-
* `.omniqa/security/report.md`: where the security checks found the product open. It is the one place that
|
|
3
|
-
* folder is not in git, and what git tracks (the plan, the test, security.md, state.json) says no more than to
|
|
3
|
+
* `.omniqa/security/report.md`: where the security checks and the agent scan found the product open. It is the one place that
|
|
4
|
+
* 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
|
|
5
|
+
* look here. Two parts: the basic checks that do not hold, a section a case that `omniqa write` keeps; and the last scan,
|
|
6
|
+
* replaced by each scan.
|
|
4
7
|
*/
|
|
5
8
|
export declare const REPORT_FILE = ".omniqa/security/report.md";
|
|
6
9
|
export interface Finding {
|
|
@@ -16,9 +19,97 @@ export interface Finding {
|
|
|
16
19
|
environment: string;
|
|
17
20
|
/** The day it was seen, ISO. */
|
|
18
21
|
date: string;
|
|
22
|
+
/**
|
|
23
|
+
* Its request was kept back when the walk pressed its button as `account`, so the check was the first to send it to the
|
|
24
|
+
* product, which took it: what the request does was done. `as` is who the check sent it as, in the entry's words:
|
|
25
|
+
* `nobody`, another account's name, `the session it signed out of`, `the account itself, from another site`.
|
|
26
|
+
*/
|
|
27
|
+
keptBack?: {
|
|
28
|
+
as: string;
|
|
29
|
+
account: string;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/** A claim the reviewer confirmed, as the report keeps it between runs. */
|
|
33
|
+
export interface Claim extends Claimed {
|
|
34
|
+
/** `claim-1`: what `omniqa write --claim` takes. A claim keeps its id while it stays open. */
|
|
35
|
+
id: string;
|
|
36
|
+
environment: string;
|
|
37
|
+
/** The day it was first confirmed, ISO. */
|
|
38
|
+
date: string;
|
|
39
|
+
/** What the reviewer said. */
|
|
40
|
+
reason: string;
|
|
41
|
+
/** The model that confirmed it. */
|
|
42
|
+
by?: string;
|
|
43
|
+
}
|
|
44
|
+
/** One agent of a scan: its model as configured, what it spent of its budgets, and the models that answered. */
|
|
45
|
+
export interface AgentLine {
|
|
46
|
+
/** `anthropic/claude-opus-5.5 (high, fallback anthropic/claude-opus-4.8)`. */
|
|
47
|
+
model: string;
|
|
48
|
+
calls: number;
|
|
49
|
+
callLimit: number;
|
|
50
|
+
requests: number;
|
|
51
|
+
requestLimit: number;
|
|
52
|
+
/** The model that answered → how many answers were its. */
|
|
53
|
+
answered: Record<string, number>;
|
|
54
|
+
}
|
|
55
|
+
export interface ScanReport {
|
|
56
|
+
environment: string;
|
|
57
|
+
/** The day of the scan, ISO. */
|
|
58
|
+
date: string;
|
|
59
|
+
researcher: AgentLine;
|
|
60
|
+
reviewer: AgentLine;
|
|
61
|
+
/** `known`: the report the run started with had it, and its proof still holds; `unsettled`: it had it, and why its proof sent again says neither open nor fixed; `claimed`: the researcher's severity where the reviewer stands behind another. */
|
|
62
|
+
confirmed: (Claim & {
|
|
63
|
+
known?: boolean;
|
|
64
|
+
unsettled?: string;
|
|
65
|
+
claimed?: Severity;
|
|
66
|
+
})[];
|
|
67
|
+
discarded: {
|
|
68
|
+
title: string;
|
|
69
|
+
category: string;
|
|
70
|
+
severity: Severity;
|
|
71
|
+
reason: string;
|
|
72
|
+
}[];
|
|
73
|
+
/** The claims the reviewer gave no verdict on, each with why. */
|
|
74
|
+
unreviewed: (Claimed & {
|
|
75
|
+
why: string;
|
|
76
|
+
})[];
|
|
77
|
+
/** What the researcher tried and found closed. */
|
|
78
|
+
tried: string[];
|
|
79
|
+
/** What the researcher sent, each request by its route with how it was answered and the reason given: listed where it ended without saying what it tried (its calls ran out). */
|
|
80
|
+
sent?: string[];
|
|
81
|
+
/** What was not done: a model declined a step, a budget was reached, a switch refused a request. */
|
|
82
|
+
notDone: string[];
|
|
83
|
+
}
|
|
84
|
+
/** A case a check could not judge, whatever the product answered: left out of the plan's work, with why. */
|
|
85
|
+
export interface LeftOut {
|
|
86
|
+
id: string;
|
|
87
|
+
title: string;
|
|
88
|
+
/** What answered, by names, and why that settles nothing. */
|
|
89
|
+
why: string;
|
|
90
|
+
check: string;
|
|
91
|
+
category: string;
|
|
92
|
+
environment: string;
|
|
93
|
+
date: string;
|
|
19
94
|
}
|
|
20
95
|
/** The finding of a case, in place of what the report said of that case before. */
|
|
21
96
|
export declare function setFinding(cwd: string, f: Finding): Promise<void>;
|
|
97
|
+
/** A case a check cannot judge, in place of what the report said of that case before: kept apart from the findings, with why. */
|
|
98
|
+
export declare function setLeftOut(cwd: string, f: LeftOut): Promise<void>;
|
|
22
99
|
/** A case that now holds leaves the report; a report with nothing in it leaves the disk. */
|
|
23
100
|
export declare function clearFinding(cwd: string, id: string): Promise<void>;
|
|
101
|
+
/** 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. */
|
|
102
|
+
export declare function openFindings(cwd: string): Promise<string[]>;
|
|
103
|
+
/** A proof by request pattern: `1. POST /api/cart/coupon as free → 200`. The requests themselves are the lines under it. */
|
|
104
|
+
export declare const proofSteps: (proof: ProofRequest[]) => string;
|
|
105
|
+
/** The scan's sections in place of the last scan's; the basic checks' findings stay as they are. */
|
|
106
|
+
export declare function writeScan(cwd: string, scan: ScanReport): Promise<void>;
|
|
107
|
+
/** 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. */
|
|
108
|
+
export declare function parseClaims(text: string | undefined): Claim[];
|
|
109
|
+
export declare function readClaims(cwd: string): Promise<Claim[]>;
|
|
110
|
+
/**
|
|
111
|
+
* 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
|
|
112
|
+
* what became of it. The rest of the scan's sections stay as that scan wrote them.
|
|
113
|
+
*/
|
|
114
|
+
export declare function closeClaim(cwd: string, id: string, test: string): Promise<void>;
|
|
24
115
|
//# sourceMappingURL=security-report.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"security-report.d.ts","sourceRoot":"","sources":["../src/security-report.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"security-report.d.ts","sourceRoot":"","sources":["../src/security-report.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAG9E;;;;;GAKG;AACH,eAAO,MAAM,WAAW,+BAA+B,CAAC;AAGxD,MAAM,WAAW,OAAO;IACtB,qCAAqC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iGAAiG;IACjG,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,mCAAmC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,QAAQ,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;CAC5C;AAED,2EAA2E;AAC3E,MAAM,WAAW,KAAM,SAAQ,OAAO;IACpC,8FAA8F;IAC9F,EAAE,EAAE,MAAM,CAAC;IACX,WAAW,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,8BAA8B;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,mCAAmC;IACnC,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,gHAAgH;AAChH,MAAM,WAAW,SAAS;IACxB,8EAA8E;IAC9E,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,E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O,CAAC,IAAI,CAAC,CAGvE;AAED,iIAAiI;AACjI,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED,4FAA4F;AAC5F,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzE;AAED,iKAAiK;AACjK,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAEjE;AAOD,4HAA4H;AAC5H,eAAO,MAAM,UAAU,GAAI,OAAO,YAAY,EAAE,KAAG,MAAwN,CAAC;AA8C5Q,oGAAoG;AACpG,wBAAsB,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAE5E;AAED,mJAAmJ;AACnJ,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,KAAK,EAAE,CAgC7D;AAED,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,EAAE,CAAC,CAE9D;AAED;;;GAGG;AACH,wBAAsB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKrF"}
|
package/dist/security-report.js
CHANGED
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
2
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";
|
|
3
7
|
/**
|
|
4
|
-
* `.omniqa/security/report.md`: where the security checks found the product open. It is the one place that
|
|
5
|
-
* folder is not in git, and what git tracks (the plan, the test, security.md, state.json) says no more than to
|
|
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.
|
|
6
12
|
*/
|
|
7
13
|
export const REPORT_FILE = ".omniqa/security/report.md";
|
|
8
14
|
const IGNORED = ".omniqa/security/";
|
|
@@ -10,40 +16,173 @@ const HEAD = `# Security report
|
|
|
10
16
|
|
|
11
17
|
Where OmniQA's security checks found this product open. This file is not in git (.gitignore has ${IGNORED}), and nothing
|
|
12
18
|
in git names what is in it: keep it that way.
|
|
19
|
+
`;
|
|
20
|
+
const BASIC = "## Basic checks that do not hold";
|
|
21
|
+
const LEFT = "## Basic checks that cannot say";
|
|
22
|
+
const leftSection = (f) => `### ${f.id}: ${f.title}
|
|
13
23
|
|
|
14
|
-
|
|
24
|
+
- cannot say: ${f.why}
|
|
25
|
+
- check: ${f.check}, OWASP ${f.category}
|
|
26
|
+
- left out on ${f.environment} on ${f.date} by omniqa write: no test and no finding; omniqa write --case ${f.id} asks again
|
|
15
27
|
`;
|
|
28
|
+
const isLeft = (s) => /^- cannot say: /m.test(s);
|
|
29
|
+
const SCAN = "## Agent scan";
|
|
30
|
+
/** What an entry says more where the request had been kept back: a finding there is an action done, to the account the button was pressed as, or the one it was sent as (`doneAs` names who). */
|
|
31
|
+
const done = (kept) => (kept === undefined ? "" : `- the request was accepted: what it does was done, as ${kept.as}, to what it names. The account ${kept.account} may no longer sign in.\n`);
|
|
16
32
|
const section = (f) => `### ${f.id}: ${f.title}
|
|
17
33
|
|
|
18
34
|
- found: ${f.finding}
|
|
19
|
-
- check: ${f.check}, OWASP ${f.category}, ${f.cwe.join(", ")}
|
|
35
|
+
${done(f.keptBack)}- check: ${f.check}, OWASP ${f.category}, ${f.cwe.join(", ")}
|
|
20
36
|
- seen on ${f.environment} on ${f.date} by omniqa write
|
|
21
37
|
- after the fix, omniqa write --case ${f.id} writes the test
|
|
38
|
+
- where that is how the product is meant to work: \`${f.id}: "<why>"\` in accepted-cases.yaml, beside plan.md, and omniqa write takes the case as it is, with no test and no finding
|
|
22
39
|
`;
|
|
23
|
-
/** The report's sections, one per case, each starting at its `### <id>: ` line. */
|
|
24
|
-
|
|
40
|
+
/** 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. */
|
|
41
|
+
function parts(text) {
|
|
42
|
+
const all = text ?? "";
|
|
43
|
+
const at = all.search(new RegExp(`^${SCAN}$`, "m"));
|
|
44
|
+
const [before, scan] = at < 0 ? [all, ""] : [all.slice(0, at), all.slice(at)];
|
|
45
|
+
// A section runs to the next one: the heading of the report's second list is no line of the section before it.
|
|
46
|
+
return { basic: before.split(/^(?=### )/m).slice(1).map((s) => `${s.split("\n").filter((line) => !line.startsWith("## ")).join("\n").trimEnd()}\n`), scan: scan.trimEnd() === "" ? "" : `${scan.trimEnd()}\n` };
|
|
47
|
+
}
|
|
25
48
|
const of = (id) => (s) => s.startsWith(`### ${id}: `);
|
|
26
|
-
async function write(cwd,
|
|
49
|
+
async function write(cwd, basic, scan) {
|
|
27
50
|
const file = join(cwd, REPORT_FILE);
|
|
28
|
-
if (
|
|
51
|
+
if (basic.length === 0 && scan === "")
|
|
29
52
|
return void (await rm(file, { force: true }));
|
|
30
53
|
await mkdir(dirname(file), { recursive: true });
|
|
31
|
-
|
|
54
|
+
const [found, left] = [basic.filter((s) => !isLeft(s)), basic.filter(isLeft)];
|
|
55
|
+
await writeFile(file, [HEAD, ...(found.length === 0 ? [] : [`${BASIC}\n`, ...found]), ...(left.length === 0 ? [] : [`${LEFT}\n`, ...left]), ...(scan === "" ? [] : [scan])].join("\n"));
|
|
32
56
|
// 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.
|
|
33
57
|
const ignore = join(cwd, ".gitignore");
|
|
34
58
|
const lines = await readFile(ignore, "utf8").catch(() => "");
|
|
35
59
|
if (!lines.split("\n").some((line) => line.trim() === IGNORED))
|
|
36
60
|
await writeFile(ignore, `${lines === "" || lines.endsWith("\n") ? lines : `${lines}\n`}${IGNORED}\n`);
|
|
37
61
|
}
|
|
62
|
+
const read = (cwd) => readFile(join(cwd, REPORT_FILE), "utf8").catch(() => undefined);
|
|
38
63
|
/** The finding of a case, in place of what the report said of that case before. */
|
|
39
64
|
export async function setFinding(cwd, f) {
|
|
40
|
-
const
|
|
41
|
-
await write(cwd, [...
|
|
65
|
+
const { basic, scan } = parts(await read(cwd));
|
|
66
|
+
await write(cwd, [...basic.filter((s) => !of(f.id)(s)), section(f)], scan);
|
|
67
|
+
}
|
|
68
|
+
/** A case a check cannot judge, in place of what the report said of that case before: kept apart from the findings, with why. */
|
|
69
|
+
export async function setLeftOut(cwd, f) {
|
|
70
|
+
const { basic, scan } = parts(await read(cwd));
|
|
71
|
+
await write(cwd, [...basic.filter((s) => !of(f.id)(s)), leftSection(f)], scan);
|
|
42
72
|
}
|
|
43
73
|
/** A case that now holds leaves the report; a report with nothing in it leaves the disk. */
|
|
44
74
|
export async function clearFinding(cwd, id) {
|
|
45
|
-
const text = await
|
|
46
|
-
|
|
47
|
-
|
|
75
|
+
const text = await read(cwd);
|
|
76
|
+
const { basic, scan } = parts(text);
|
|
77
|
+
if (text !== undefined && basic.some(of(id)))
|
|
78
|
+
await write(cwd, basic.filter((s) => !of(id)(s)), scan);
|
|
79
|
+
}
|
|
80
|
+
/** 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. */
|
|
81
|
+
export async function openFindings(cwd) {
|
|
82
|
+
return parts(await read(cwd)).basic.filter((s) => !isLeft(s)).map((s) => `${(/^### (.*)$/m.exec(s)?.[1] ?? "").trim()}: ${(/^- found: (.*)$/m.exec(s)?.[1] ?? "").trim()}`);
|
|
83
|
+
}
|
|
84
|
+
const plural = (n, word) => `${n} ${word}${n === 1 ? "" : "s"}`;
|
|
85
|
+
const owasp = (id) => `OWASP ${id}${OWASP_2025.find((c) => c.id === id) === undefined ? "" : ` ${OWASP_2025.find((c) => c.id === id)?.name}`}`;
|
|
86
|
+
const rank = (severity) => SEVERITIES.indexOf(severity);
|
|
87
|
+
/** A path as a report's step names it: by its route, as every line that says what was asked. */
|
|
88
|
+
const routed = (target) => requestRoute(URL.parse(target, "http://request")?.pathname ?? target);
|
|
89
|
+
/** A proof by request pattern: `1. POST /api/cart/coupon as free → 200`. The requests themselves are the lines under it. */
|
|
90
|
+
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("; ");
|
|
91
|
+
const answers = (line) => {
|
|
92
|
+
const total = Object.values(line.answered).reduce((n, m) => n + m, 0);
|
|
93
|
+
const models = Object.entries(line.answered);
|
|
94
|
+
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(", ");
|
|
95
|
+
};
|
|
96
|
+
const agentLine = (name, line) => `- ${name}: ${line.model}; ${line.calls} of ${line.callLimit} model calls, ${line.requests} of ${line.requestLimit} requests; ${answers(line)}`;
|
|
97
|
+
/** What a claim's section holds whoever judged it: what is at stake, the fix, the steps, the proof to send again. */
|
|
98
|
+
const claimBody = (c) => [`- impact: ${c.impact}`, `- fix: ${c.fix}`, `- steps: ${proofSteps(c.proof)}`, `- in the researcher's words: ${c.steps.join("; ")}`];
|
|
99
|
+
// 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.
|
|
100
|
+
const proofBlock = (proof) => ["```proof", ...proof.map((p) => JSON.stringify({ as: p.as, request: p.request, status: p.status, ...(p.location === undefined ? {} : { location: p.location }) })), "```"];
|
|
101
|
+
function renderScan(r) {
|
|
102
|
+
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, "")));
|
|
103
|
+
const bySeverity = SEVERITIES.map((severity) => [severity, confirmed.filter((c) => c.severity === severity).length]).filter(([, n]) => n > 0).map(([severity, n]) => `${n} ${severity}`);
|
|
104
|
+
return [
|
|
105
|
+
SCAN,
|
|
106
|
+
"",
|
|
107
|
+
`- ${r.environment}, ${r.date}`,
|
|
108
|
+
agentLine("researcher", r.researcher),
|
|
109
|
+
agentLine("reviewer", r.reviewer),
|
|
110
|
+
`- ${confirmed.length} confirmed${bySeverity.length === 0 ? "" : ` (${bySeverity.join(", ")})`}, ${r.discarded.length} discarded${r.unreviewed.length === 0 ? "" : `, ${r.unreviewed.length} without a verdict`}`,
|
|
111
|
+
...(confirmed.length === 0 ? [] : ["", "## Confirmed claims", ...confirmed.flatMap((c) => [
|
|
112
|
+
"",
|
|
113
|
+
`### ${c.id}: ${c.title}`,
|
|
114
|
+
"",
|
|
115
|
+
`- severity: ${c.severity}${c.claimed === undefined || c.claimed === c.severity ? "" : ` (the researcher said ${c.claimed})`}; ${owasp(c.category)}`,
|
|
116
|
+
`- confirmed on ${c.environment} on ${c.date}${c.by === undefined ? "" : ` by ${c.by}`}: ${c.reason}`,
|
|
117
|
+
...(c.known === true ? [`- still open on ${r.date}: its proof was sent again and answered as before`] : []),
|
|
118
|
+
...(c.unsettled === undefined ? [] : [`- not settled on ${r.date}: ${c.unsettled}`]),
|
|
119
|
+
...claimBody(c),
|
|
120
|
+
`- after the fix, omniqa write --claim ${c.id} writes the test`,
|
|
121
|
+
"",
|
|
122
|
+
...proofBlock(c.proof),
|
|
123
|
+
])]),
|
|
124
|
+
...(r.discarded.length === 0 ? [] : ["", "## Discarded claims", "", ...r.discarded.map((d) => `- ${d.title} (OWASP ${d.category}, claimed ${d.severity}): ${d.reason}`)]),
|
|
125
|
+
...(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)])]),
|
|
126
|
+
"",
|
|
127
|
+
"## Tried and found closed",
|
|
128
|
+
"",
|
|
129
|
+
...(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}`)]),
|
|
130
|
+
...(r.notDone.length === 0 ? [] : ["", "## Not done", "", ...r.notDone.map((line) => `- ${line}`)]),
|
|
131
|
+
"",
|
|
132
|
+
].join("\n");
|
|
133
|
+
}
|
|
134
|
+
/** The scan's sections in place of the last scan's; the basic checks' findings stay as they are. */
|
|
135
|
+
export async function writeScan(cwd, scan) {
|
|
136
|
+
await write(cwd, parts(await read(cwd)).basic, renderScan(scan));
|
|
137
|
+
}
|
|
138
|
+
/** 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. */
|
|
139
|
+
export function parseClaims(text) {
|
|
140
|
+
const confirmed = /^## Confirmed claims$([\s\S]*?)(?=^## |(?![\s\S]))/m.exec(parts(text).scan)?.[1] ?? "";
|
|
141
|
+
return confirmed.split(/^(?=### )/m).slice(1).flatMap((s) => {
|
|
142
|
+
const head = /^### (claim-\d+): (.*)$/m.exec(s);
|
|
143
|
+
const line = (key) => new RegExp(`^- ${key}: (.*)$`, "m").exec(s)?.[1] ?? "";
|
|
144
|
+
const severity = /^- severity: (\w+)(?: \([^)]*\))?; OWASP (A\d\d)/m.exec(s);
|
|
145
|
+
const seen = /^- confirmed on (.+?) on (\d{4}-\d\d-\d\d)(?: by (\S+))?: (.*)$/m.exec(s);
|
|
146
|
+
const proof = /^```proof\n([\s\S]*?)^```$/m.exec(s)?.[1] ?? "";
|
|
147
|
+
if (head === null || severity === null || seen === null)
|
|
148
|
+
return [];
|
|
149
|
+
return [{
|
|
150
|
+
id: head[1],
|
|
151
|
+
title: head[2],
|
|
152
|
+
category: severity[2],
|
|
153
|
+
severity: severity[1],
|
|
154
|
+
steps: line("in the researcher's words").split("; ").filter((step) => step !== ""),
|
|
155
|
+
impact: line("impact"),
|
|
156
|
+
fix: line("fix"),
|
|
157
|
+
// A line that is no longer what was written costs that line: a report must never be what keeps the next scan from starting.
|
|
158
|
+
proof: proof.split("\n").filter((row) => row.trim() !== "").flatMap((row) => {
|
|
159
|
+
try {
|
|
160
|
+
const p = JSON.parse(row);
|
|
161
|
+
return typeof p?.as === "string" && typeof p.request === "string" && typeof p.status === "number" ? [p] : [];
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return [];
|
|
165
|
+
}
|
|
166
|
+
}),
|
|
167
|
+
environment: seen[1],
|
|
168
|
+
date: seen[2],
|
|
169
|
+
reason: seen[4],
|
|
170
|
+
...(seen[3] === undefined ? {} : { by: seen[3] }),
|
|
171
|
+
}];
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
export async function readClaims(cwd) {
|
|
175
|
+
return parseClaims(await read(cwd));
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 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
|
|
179
|
+
* what became of it. The rest of the scan's sections stay as that scan wrote them.
|
|
180
|
+
*/
|
|
181
|
+
export async function closeClaim(cwd, id, test) {
|
|
182
|
+
const { basic, scan } = parts(await read(cwd));
|
|
183
|
+
const without = scan.replace(new RegExp(`^### ${id}: [\\s\\S]*?(?=^###? |(?![\\s\\S]))`, "m"), "").replace(/^## Confirmed claims\n+(?=## |(?![\s\S]))/m, "");
|
|
184
|
+
if (without === scan)
|
|
185
|
+
return;
|
|
186
|
+
await write(cwd, basic, without.replace(/^(- \d+ confirmed[^\n]*\n)/m, `$1- since then: ${id} is fixed and kept as the test ${test}\n`));
|
|
48
187
|
}
|
|
49
188
|
//# sourceMappingURL=security-report.js.map
|
|
@@ -1 +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;AAE1C;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,4BAA4B,CAAC;AACxD,MAAM,OAAO,GAAG,mBAAmB,CAAC;AAiBpC,MAAM,IAAI,GAAG;;kGAEqF,OAAO;;;;CAIxG,CAAC;AACF,MAAM,OAAO,GAAG,CAAC,CAAU,EAAU,EAAE,CAAC,OAAO,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,KAAK;;WAEpD,CAAC,CAAC,OAAO;WACT,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,QAAQ,KAAK,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;YAChD,CAAC,CAAC,WAAW,OAAO,CAAC,CAAC,IAAI;uCACC,CAAC,CAAC,EAAE;CAC1C,CAAC;AACF,mFAAmF;AACnF,MAAM,QAAQ,GAAG,CAAC,IAAwB,EAAY,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAClI,MAAM,EAAE,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC,CAAS,EAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAE/E,KAAK,UAAU,KAAK,CAAC,GAAW,EAAE,IAAc;IAC9C,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EAAE,qCAAqC,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,4CAA4C,EAAE,EAAE,CAAC,CAAC;IAC7J,IAAI,OAAO,KAAK,IAAI;QAAE,OAAO;IAC7B,MAAM,KAAK,CAAC,GAAG,EAAE,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,6BAA6B,EAAE,mBAAmB,EAAE,kCAAkC,IAAI,IAAI,CAAC,CAAC,CAAC;AAC3I,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SecurityRequest, SecuritySession } from "@omniqa/core";
|
|
2
|
-
import { type Interceptor } from "@omniqa/web";
|
|
2
|
+
import { type CrawlResult, type Interceptor } from "@omniqa/web";
|
|
3
3
|
/**
|
|
4
4
|
* A captured request as the security code reads it: Interceptor's editable text (the request line, the headers, a blank line,
|
|
5
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
|
|
@@ -20,10 +20,19 @@ export declare function parseRequest(raw: string): RequestText;
|
|
|
20
20
|
export declare const renderRequest: (r: RequestText) => string;
|
|
21
21
|
/** The values of a header, whatever its case. */
|
|
22
22
|
export declare const headerValues: (r: RequestText, name: string) => string[];
|
|
23
|
+
/** The cookies of Cookie headers, each header's value a line, as name and value. */
|
|
24
|
+
export declare function cookiePairs(lines: string[]): [string, string][];
|
|
23
25
|
/** The cookies a request carries, as name and value. */
|
|
24
|
-
export declare
|
|
26
|
+
export declare const cookiesOf: (r: RequestText) => [string, string][];
|
|
25
27
|
/** `r` without the headers named, whatever their case. */
|
|
26
28
|
export declare const withoutHeaders: (r: RequestText, names: string[]) => RequestText;
|
|
29
|
+
/**
|
|
30
|
+
* A visitor's plain request for an address of the product, made from a request a page made: that request's host, browser and
|
|
31
|
+
* language, and nothing else of it. A session rides in a cookie, in Authorization or in a header of the product's own, and a
|
|
32
|
+
* page's request may ask to be read as another method: none of that is a guest's. Undefined for an address of another origin
|
|
33
|
+
* than `base` (another host, the same host over plain http): that is not the product's to ask.
|
|
34
|
+
*/
|
|
35
|
+
export declare function guestGet(was: RequestText, target: string, base: URL): RequestText | undefined;
|
|
27
36
|
/** `r` with that header's value: in the header's place when the request has it, at the end when it does not. */
|
|
28
37
|
export declare function withHeader(r: RequestText, name: string, value: string): RequestText;
|
|
29
38
|
/** `r` carrying these cookies and no other; none at all drops the Cookie header. */
|
|
@@ -79,12 +88,21 @@ export interface Observed extends RequestFacts {
|
|
|
79
88
|
sets: CookieSet[];
|
|
80
89
|
/** 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
90
|
page?: true;
|
|
91
|
+
/**
|
|
92
|
+
* The proxy answered it itself, and the product never heard of it (a press with nothing let through, `Interceptor.keepBack`).
|
|
93
|
+
* It has no status, no cookie set and no page: the answer it got was the proxy's own, and none of it is the product's.
|
|
94
|
+
*/
|
|
95
|
+
ended?: true;
|
|
82
96
|
}
|
|
83
97
|
/**
|
|
84
98
|
* What one actor's walk made, read off the sidecar before its capture is cleared for the next actor: every request that is
|
|
85
99
|
* 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
100
|
* answer's headers (for the cookies it set). `more` says requests were left unread because the share ran out. `passwords`
|
|
87
101
|
* (the walking account's) tell which request is the sign-in. What is returned holds no value; the texts are dropped here.
|
|
102
|
+
* A flow the proxy answered itself (`ended`: a button pressed with nothing let through) has a status and an answer, and both
|
|
103
|
+
* are the proxy's own. One that changes state is the request a press left: it is read for its names like any other, and is
|
|
104
|
+
* `ended` here too, with no status and nothing of its answer. One that only reads (what the page asked for meanwhile) is
|
|
105
|
+
* not a request of the walk at all: the product was not asked, and nothing says what it would have answered.
|
|
88
106
|
*/
|
|
89
107
|
export declare function readObserved(sidecar: Pick<Interceptor, "flows" | "raw" | "answer">, share: number, passwords: string[]): Promise<{
|
|
90
108
|
observed: Observed[];
|
|
@@ -95,12 +113,17 @@ export declare function readObserved(sidecar: Pick<Interceptor, "flows" | "raw"
|
|
|
95
113
|
* 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
114
|
* (a product that hands every visitor one and keeps its name across the sign-in); an anti-forgery cookie is never one.
|
|
97
115
|
* 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.
|
|
116
|
+
* A request a press left kept back (`ended`) is a row by the walk's own list of what it pressed (`pressed`): the entry whose
|
|
117
|
+
* `kept` names it gives the row the actor it was kept back for and the form that was pressed (the capture keeps nothing of a
|
|
118
|
+
* press, so no caller could add that one), and no status. What else the proxy answered itself during a press (a log line the
|
|
119
|
+
* page sends beside the action, the request of a press that left nothing kept back) is in no row and tells nothing of a session.
|
|
98
120
|
* ponytail: passive, so a session cookie a guest also has under an unusual name is missed; re-sending a request without each
|
|
99
121
|
* cookie in turn would tell, and is a request of OmniQA's own that the pass does not make.
|
|
100
122
|
*/
|
|
101
|
-
export declare function sessionsAndRequests(
|
|
123
|
+
export declare function sessionsAndRequests(walked: {
|
|
102
124
|
actor: string;
|
|
103
|
-
observed: Observed[];
|
|
125
|
+
observed: Observed[]; /** What the actor's walk pressed with nothing let through (`CrawlResult.pressed`). */
|
|
126
|
+
pressed?: CrawlResult["pressed"];
|
|
104
127
|
}[]): {
|
|
105
128
|
sessions: SecuritySession[];
|
|
106
129
|
requests: SecurityRequest[];
|
|
@@ -1 +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;
|
|
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,KAAK,WAAW,EAAE,MAAM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