@lintsure/core 0.3.2 → 0.3.4

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 CHANGED
@@ -6,7 +6,7 @@ The Lintsure engine: rules, framework knowledge, scanning and report writers. Us
6
6
 
7
7
  ```js
8
8
  import { scan, toMarkdown, toAssessmentHtml } from "@lintsure/core";
9
- const report = await scan("./my-app", ["gdpr", "soc2"]);
9
+ const report = await scan("./my-app", ["gdpr", "owasp-top10"]);
10
10
  ```
11
11
 
12
12
  Docs: https://lintsure.com/docs · Source: https://github.com/lintsure/lintsure · Apache-2.0
@@ -4,7 +4,9 @@
4
4
  import { DISCLAIMER, NOT_A_VERDICT, nextSteps } from "./index.js";
5
5
  import { knowledge } from "./knowledge/index.js";
6
6
  const esc = (s) => s.replace(/[&<>"']/g, (c) => ({ "&": "&amp;", "<": "&lt;", ">": "&gt;", '"': "&quot;", "'": "&#39;" })[c]);
7
- const NAME = { "eu-ai-act": "EU AI Act", gdpr: "GDPR", soc2: "SOC 2", "iso-27001": "ISO/IEC 27001", "owasp-top10": "OWASP Top 10:2025" };
7
+ const NAME = { "eu-ai-act": "EU AI Act", gdpr: "GDPR", "owasp-top10": "OWASP Top 10:2025", cra: "EU Cyber Resilience Act", "owasp-llm": "OWASP Top 10 for LLM Applications 2025", "cwe-top25": "CWE Top 25 (2025)" };
8
+ // Frameworks from rule packs use the name in their own knowledge.
9
+ const fwName = (f) => NAME[f] ?? knowledge.find((k) => k.id === f)?.name ?? f;
8
10
  const STATUS = { gap: "Gap", partial: "Partial", met: "Met", outside: "Outside code" };
9
11
  const SEV = ["high", "medium", "low"];
10
12
  const SKIPPED = "node_modules, .git, dist, build, out, .output, .next, .nuxt, .svelte-kit, .astro, .vercel, .netlify, .wrangler, .turbo, .cache, venv, .venv, __pycache__, coverage";
@@ -18,7 +20,7 @@ function findingCard(f, i) {
18
20
  <h3>${esc(f.title)}</h3>
19
21
  <p class="where"><code>${esc(f.file)}:${f.line}</code></p>
20
22
  <dl>
21
- <dt>Rules it may affect</dt><dd>${f.controls.map((c) => `${NAME[c.framework]} ${esc(c.id)} (${esc(c.title)})`).join("<br>")}</dd>
23
+ <dt>Rules it may affect</dt><dd>${f.controls.map((c) => `${fwName(c.framework)} ${esc(c.id)} (${esc(c.title)})`).join("<br>")}</dd>
22
24
  <dt>Why it matters</dt><dd>${esc(f.note)}</dd>
23
25
  <dt>Possible fix</dt><dd>${esc(f.fix)} Review the change before it is made.</dd>
24
26
  </dl>
@@ -36,10 +38,10 @@ export function toAssessmentHtml(r, opts) {
36
38
  <table class="counts"><tr><th>Check points</th><th>Findings</th><th>Observations</th><th>Accepted</th><th>Fixed since baseline</th></tr>
37
39
  <tr><td>${rec.counts.checkPoints}</td><td>${rec.counts.findings}</td><td>${rec.counts.observations}</td><td>${rec.counts.accepted}</td><td>${rec.counts.fixedSinceBaseline}</td></tr></table>
38
40
  <p>Risk levels of open items: ${rec.counts.byRisk.high} high, ${rec.counts.byRisk.medium} medium, ${rec.counts.byRisk.low} low. A check point is one rule applied to one file (${rec.counts.rulesRun} rules ran).</p>
39
- <h3>What applies, and why</h3><ul>${rec.applies.map((a) => `<li><b>${NAME[a.framework]}</b>: ${esc(a.why)}</li>`).join("")}</ul>
41
+ <h3>What applies, and why</h3><ul>${rec.applies.map((a) => `<li><b>${fwName(a.framework)}</b>: ${esc(a.why)}</li>`).join("")}</ul>
40
42
  <h3>Results by control</h3><p class="small">Finding: a Gap the code itself shows. Observation: a Partial that depends on context a person must confirm. No issue found: the rules found nothing in the files they read, which does not mean the control is met.</p>
41
43
  <table><tr><th>Framework</th><th>Control</th><th>Rules</th><th>Check points</th><th>Result</th><th>Items</th></tr>
42
- ${rec.byControl.map((b) => `<tr><td>${NAME[b.framework]}</td><td><code>${esc(b.control)}</code> ${esc(b.title)}</td><td>${b.rules.map((x) => `<code>${esc(x)}</code>`).join(" ")}</td><td>${b.checkPoints}</td><td>${RESULT[b.result]}</td><td>${b.findingIds.join(", ") || "-"}</td></tr>`).join("")}</table>` : "";
44
+ ${rec.byControl.map((b) => `<tr><td>${fwName(b.framework)}</td><td><code>${esc(b.control)}</code> ${esc(b.title)}</td><td>${b.rules.map((x) => `<code>${esc(x)}</code>`).join(" ")}</td><td>${b.checkPoints}</td><td>${RESULT[b.result]}</td><td>${b.findingIds.join(", ") || "-"}</td></tr>`).join("")}</table>` : "";
43
45
  const cover = `<section class="page cover">
44
46
  <p class="brand">Lintsure</p>
45
47
  <h1>Readiness assessment</h1>
@@ -48,7 +50,7 @@ ${rec.byControl.map((b) => `<tr><td>${NAME[b.framework]}</td><td><code>${esc(b.c
48
50
  <tr><th>Date produced</th><td>${esc(opts.date)}</td></tr>
49
51
  ${rec ? `<tr><th>Record</th><td>${esc(rec.id)}, checked ${esc(rec.createdAt.replace("T", " ").slice(0, 19))} UTC</td></tr>` : ""}
50
52
  ${rec?.scope.commit ? `<tr><th>Code checked</th><td>${rec.scope.branch ? `branch <code>${esc(rec.scope.branch)}</code>, ` : ""}commit <code>${esc(rec.scope.commit)}</code></td></tr>` : ""}
51
- <tr><th>Frameworks checked</th><td>${fws.map((f) => NAME[f]).join(", ") || "None"}</td></tr>
53
+ <tr><th>Frameworks checked</th><td>${fws.map((f) => fwName(f)).join(", ") || "None"}</td></tr>
52
54
  <tr><th>Files checked</th><td>${r.filesChecked}${rec ? `, ${rec.counts.checkPoints} check points` : ""}</td></tr>
53
55
  <tr><th>Rules version</th><td>${esc(r.rulesVersion)}</td></tr>
54
56
  <tr><th>Status of this report</th><td><b>Draft.</b> Not complete until a qualified person reviews it and signs the review page.</td></tr>
@@ -60,14 +62,14 @@ ${rec.byControl.map((b) => `<tr><td>${NAME[b.framework]}</td><td><code>${esc(b.c
60
62
  <tr><td>${n("gap")}</td><td>${n("partial")}</td><td>${r.met.length}</td><td>${r.outside.length}</td></tr></table>
61
63
  <h3>By framework</h3>
62
64
  <table><tr><th>Framework</th><th>Gaps</th><th>Partial</th><th>Rules with no finding</th><th>Outside-code items</th></tr>
63
- ${fws.map((f) => `<tr><td>${NAME[f]}</td><td>${r.findings.filter((x) => x.status === "gap" && x.controls.some((c) => c.framework === f)).length}</td><td>${r.findings.filter((x) => x.status === "partial" && x.controls.some((c) => c.framework === f)).length}</td><td>${r.met.filter((m) => m.controls.some((c) => c.framework === f)).length}</td><td>${r.outside.filter((o) => o.framework === f).length}</td></tr>`).join("")}</table>
65
+ ${fws.map((f) => `<tr><td>${fwName(f)}</td><td>${r.findings.filter((x) => x.status === "gap" && x.controls.some((c) => c.framework === f)).length}</td><td>${r.findings.filter((x) => x.status === "partial" && x.controls.some((c) => c.framework === f)).length}</td><td>${r.met.filter((m) => m.controls.some((c) => c.framework === f)).length}</td><td>${r.outside.filter((o) => o.framework === f).length}</td></tr>`).join("")}</table>
64
66
  <div class="callout"><b>What this summary does not mean.</b> ${esc(NOT_A_VERDICT)}</div>`;
65
67
  const method = `<h3>What was checked</h3>
66
68
  <p>Lintsure read ${r.filesChecked} files in the project folder on the computer or CI runner where it ran. Nothing was uploaded. It skipped these folders: ${SKIPPED}, any paths listed under ignore in lintsure.config.yaml, minified files, and any file over 1 MB or binary.</p>
67
69
  <h3>How results are produced</h3>
68
70
  <ul><li>A fixed set of rules (version ${esc(r.rulesVersion)}) looks for known patterns, line by line or file by file. It does not use a language model to decide results, so the same code gives the same findings.</li>
69
71
  <li><b>Gap</b>: a rule found code that may break a control. <b>Partial</b>: a likely problem that depends on context only you can confirm. <b>Met</b>: the rule ran and found nothing in the files it read. <b>Outside code</b>: work that code cannot show.</li>
70
- <li>Rules reflect our reading of the publicly available text of each framework. They are in Beta: their mappings to framework controls await review by a qualified compliance professional.</li></ul>
72
+ <li>Rules reflect our reading of the publicly available text of each framework. They are in Beta: their mappings to framework controls are our own reading of the public texts, not independently reviewed.</li></ul>
71
73
  <h3>Known limits</h3>
72
74
  <ul><li>Rules can miss real problems and can flag code that is fine.</li><li>They do not follow data across files or functions.</li><li>They mainly cover JavaScript, TypeScript and Python.</li><li>They cannot see infrastructure, cloud settings, or anything outside the folder that was scanned.</li></ul>`;
73
75
  const findingsBody = sorted.length
@@ -81,11 +83,11 @@ ${fws.map((f) => `<tr><td>${NAME[f]}</td><td>${r.findings.filter((x) => x.status
81
83
  const result = o.inCode === "no" ? "Outside code: needs evidence" : related.length ? `${related.length} finding${related.length === 1 ? "" : "s"} to review` : o.inCode === "partly" ? "No finding from the rules; code shows only part of this" : "No finding from the rules";
82
84
  return `<tr><td><code>${esc(o.ref)}</code></td><td><b>${esc(o.title)}.</b> ${esc(o.plain)}</td><td>${result}</td></tr>`;
83
85
  }).join("");
84
- return `<h3>${NAME[f]}</h3>${k ? `<p>${esc(k.summary)}</p>` : ""}<table><tr><th>Ref</th><th>What it asks</th><th>What Lintsure saw</th></tr>${rows}</table>`;
86
+ return `<h3>${fwName(f)}</h3>${k ? `<p>${esc(k.summary)}</p>` : ""}<table><tr><th>Ref</th><th>What it asks</th><th>What Lintsure saw</th></tr>${rows}</table>`;
85
87
  }).join("");
86
88
  const outside = r.outside.length
87
89
  ? `<p>Code cannot show these. They still need to be done before a full review. Assign an owner to each.</p><table><tr><th>Framework</th><th>Item</th><th>Evidence an auditor may ask for</th><th>Owner</th><th>Done</th></tr>
88
- ${r.outside.map((o) => `<tr><td>${NAME[o.framework]} <code>${esc(o.control)}</code></td><td>${esc(o.title)}</td><td>${esc(o.evidence)}</td><td></td><td>☐</td></tr>`).join("")}</table>`
90
+ ${r.outside.map((o) => `<tr><td>${fwName(o.framework)} <code>${esc(o.control)}</code></td><td>${esc(o.title)}</td><td>${esc(o.evidence)}</td><td></td><td>☐</td></tr>`).join("")}</table>`
89
91
  : `<p>No outside-code items for the frameworks checked.</p>`;
90
92
  const next = `<ol>${nextSteps(r).map((s) => `<li>${esc(s)}</li>`).join("")}</ol>
91
93
  <p>Lintsure suggests; people decide. Re-run Lintsure after changes, and keep each signed report with the rules version it was produced with.</p>`;
@@ -10,6 +10,6 @@ export declare function proposalFor(f: {
10
10
  note: string;
11
11
  controls: Control[];
12
12
  }): Proposal;
13
- export declare const AGENT_GUIDANCE = "You are using Lintsure, a readiness tool that checks code against compliance frameworks.\n\nBefore you do anything (edit, create or delete a file, run a command, install a package, or treat a framework as applying), stop and present a proposal with all four parts:\n1. What you plan to do.\n2. Why: the problem and the rule or control it relates to.\n3. Where, exactly: the file and line, or the document and section.\n4. The benefit to the user if they approve it.\nThen ask the user to approve that one proposal and wait. Only a clear yes is approval. Silence, \"maybe\" or a question is not. Do only what was approved, then show what changed. One proposal at a time.\n\nWhen you report Lintsure results:\n- Never say or imply the user is compliant, certified, approved, audit-ready, \"good to go\", or that they passed. Lintsure cannot decide that.\n- Never make a decision for the user. Present findings and options; the user chooses what to do.\n- Every finding comes with a proposal (where, what, why, benefit). Show it as a proposal, never as something you have already done.\n- Say that results cover code only, against Lintsure's reading of the publicly available text of each framework.\n- Always mention the items outside code (policies, training, contracts, evidence) that still need to be done before a full review.\n- Recommend that a qualified person review the results before any audit, certification or business decision.\n- A control marked Met only means Lintsure's rules found no problem in the files they read. Say so if you mention Met.";
13
+ export declare const AGENT_GUIDANCE = "You are using Lintsure, a readiness tool that checks code against compliance frameworks.\n\nBefore you do anything (edit, create or delete a file, run a command, install a package, or treat a framework as applying), stop and present a proposal with all four parts:\n1. What you plan to do.\n2. Why: the problem and the rule or control it relates to.\n3. Where, exactly: the file and line, or the document and section.\n4. The benefit to the user if they approve it.\nThen ask the user to approve that one proposal and wait. Only a clear yes is approval. Silence, \"maybe\" or a question is not. Do only what was approved, then show what changed. One proposal at a time.\n\nWhen you report Lintsure results:\n- Never say or imply the user is compliant, certified, approved, audit-ready, \"good to go\", or that they passed. Lintsure cannot decide that.\n- Never make a decision for the user. Present findings and options; the user chooses what to do.\n- Every finding comes with a proposal (where, what, why, benefit). Show it as a proposal, never as something you have already done.\n- Say that results cover code only, against Lintsure's reading of the publicly available text of each framework.\n- Always mention the items outside code (policies, training, contracts, evidence) that still need to be done before a full review.\n- Recommend that a qualified person review the results before any audit, certification or business decision.\n- A control marked Met only means Lintsure's rules found no problem in the files they read. Say so if you mention Met.\n\nBefore you show a Partial finding, check it:\n- Read the code around it and try to rule it out. Each Partial note says what Lintsure couldn't see.\n- Then sort it as: likely real (say what you saw), needs the user's check (name the one fact to confirm), or ruled out (say why, and offer to record it in .lintsure/accepted.yaml with that reason, only if the user agrees).\n- Never drop a finding silently, and never upgrade one to a confirmed vulnerability without evidence from the code.\n- If another safeguard already stops the problem, call the missing one a hardening suggestion, not a vulnerability.";
14
14
  /** Phrases that read as a verdict. Lintsure's own output must never claim these. */
15
15
  export declare const FORBIDDEN_CLAIMS: RegExp[];
@@ -5,8 +5,8 @@ export const APPROVAL_RULES = `Before you do anything (edit, create or delete a
5
5
  3. Where, exactly: the file and line, or the document and section.
6
6
  4. The benefit to the user if they approve it.
7
7
  Then ask the user to approve that one proposal and wait. Only a clear yes is approval. Silence, "maybe" or a question is not. Do only what was approved, then show what changed. One proposal at a time.`;
8
- const NAMES = { "eu-ai-act": "EU AI Act", gdpr: "GDPR", soc2: "SOC 2", "iso-27001": "ISO 27001", "owasp-top10": "OWASP Top 10" };
9
- const refs = (cs) => cs.map((c) => `${NAMES[c.framework]} ${c.id}`).join(", ");
8
+ const NAMES = { "eu-ai-act": "EU AI Act", gdpr: "GDPR", "owasp-top10": "OWASP Top 10", cra: "Cyber Resilience Act", "owasp-llm": "OWASP LLM Top 10", "cwe-top25": "CWE Top 25" };
9
+ const refs = (cs) => cs.map((c) => `${NAMES[c.framework] ?? c.framework} ${c.id}`).join(", ");
10
10
  /** Lays a finding out as a proposal a person can approve or decline. */
11
11
  export function proposalFor(f) {
12
12
  return {
@@ -28,7 +28,13 @@ When you report Lintsure results:
28
28
  - Say that results cover code only, against Lintsure's reading of the publicly available text of each framework.
29
29
  - Always mention the items outside code (policies, training, contracts, evidence) that still need to be done before a full review.
30
30
  - Recommend that a qualified person review the results before any audit, certification or business decision.
31
- - A control marked Met only means Lintsure's rules found no problem in the files they read. Say so if you mention Met.`;
31
+ - A control marked Met only means Lintsure's rules found no problem in the files they read. Say so if you mention Met.
32
+
33
+ Before you show a Partial finding, check it:
34
+ - Read the code around it and try to rule it out. Each Partial note says what Lintsure couldn't see.
35
+ - Then sort it as: likely real (say what you saw), needs the user's check (name the one fact to confirm), or ruled out (say why, and offer to record it in .lintsure/accepted.yaml with that reason, only if the user agrees).
36
+ - Never drop a finding silently, and never upgrade one to a confirmed vulnerability without evidence from the code.
37
+ - If another safeguard already stops the problem, call the missing one a hardening suggestion, not a vulnerability.`;
32
38
  /** Phrases that read as a verdict. Lintsure's own output must never claim these. */
33
39
  export const FORBIDDEN_CLAIMS = [
34
40
  /\byou(?:'re| are) (?:now )?(?:fully )?(?:compliant|certified|audit[- ]ready|ready for (?:an |the )?audit)\b/i,
@@ -11,7 +11,8 @@ export { rules };
11
11
  export * from "./guidance.js";
12
12
  export { toAssessmentHtml } from "./assessment.js";
13
13
  export * from "./knowledge/index.js";
14
- export declare const RULES_VERSION = "0.3.2";
14
+ export { loadPacks, registerPack, type Pack } from "./packs.js";
15
+ export declare const RULES_VERSION = "0.3.4";
15
16
  /** Shown with every result, in every interface. Lintsure prepares; people decide. */
16
17
  export declare const DISCLAIMER: string;
17
18
  /** What a report must never be read as. Used in the report and by the MCP server. */
@@ -23,12 +24,14 @@ export declare const ALL_FRAMEWORKS: FrameworkId[];
23
24
  * Only the simple list form is supported:
24
25
  * frameworks:
25
26
  * - gdpr
26
- * Ids Lintsure doesn't check yet (for example "hipaa") are returned in `skipped`.
27
+ * Ids Lintsure doesn't check yet (for example "soc2" without its pack) are returned in `skipped`.
28
+ * A `packs:` list loads installed @lintsure/pack-* rule packs first, so their frameworks count as known.
27
29
  * An `ignore:` list of paths (relative to the root, for example tests/ or fixtures/) is skipped by scan(). */
28
30
  export declare function readConfig(root: string): Promise<{
29
31
  frameworks: FrameworkId[] | null;
30
32
  skipped: string[];
31
33
  ignore: string[];
34
+ packsMissing?: string[];
32
35
  }>;
33
36
  export declare const SKIP_DIRS: string[];
34
37
  /** Scout: list files to check, sorted so output order never depends on the file system. */
package/dist/src/index.js CHANGED
@@ -17,7 +17,9 @@ export { rules };
17
17
  export * from "./guidance.js";
18
18
  export { toAssessmentHtml } from "./assessment.js";
19
19
  export * from "./knowledge/index.js";
20
- export const RULES_VERSION = "0.3.2";
20
+ export { loadPacks, registerPack } from "./packs.js";
21
+ import { loadPacks } from "./packs.js";
22
+ export const RULES_VERSION = "0.3.4";
21
23
  /** Shown with every result, in every interface. Lintsure prepares; people decide. */
22
24
  export const DISCLAIMER = "Lintsure is a readiness tool, not an audit, a certification or legal advice. " +
23
25
  "Its rules reflect our reading of the publicly available text of each framework, and they check code only. " +
@@ -40,12 +42,13 @@ export function nextSteps(r) {
40
42
  "Ask a qualified compliance professional to review the results before you rely on them.",
41
43
  ].filter(Boolean);
42
44
  }
43
- export const ALL_FRAMEWORKS = ["gdpr", "soc2", "iso-27001", "eu-ai-act", "owasp-top10"];
45
+ export const ALL_FRAMEWORKS = ["gdpr", "eu-ai-act", "owasp-top10", "cra", "owasp-llm", "cwe-top25"];
44
46
  /** Reads the frameworks list from lintsure.config.yaml in the repo root, if there is one.
45
47
  * Only the simple list form is supported:
46
48
  * frameworks:
47
49
  * - gdpr
48
- * Ids Lintsure doesn't check yet (for example "hipaa") are returned in `skipped`.
50
+ * Ids Lintsure doesn't check yet (for example "soc2" without its pack) are returned in `skipped`.
51
+ * A `packs:` list loads installed @lintsure/pack-* rule packs first, so their frameworks count as known.
49
52
  * An `ignore:` list of paths (relative to the root, for example tests/ or fixtures/) is skipped by scan(). */
50
53
  export async function readConfig(root) {
51
54
  let text;
@@ -55,7 +58,7 @@ export async function readConfig(root) {
55
58
  catch {
56
59
  return { frameworks: null, skipped: [], ignore: [] };
57
60
  }
58
- const lists = { frameworks: [], ignore: [] };
61
+ const lists = { frameworks: [], ignore: [], packs: [] };
59
62
  let key = "";
60
63
  let emptyFw = false;
61
64
  for (const raw of text.split(/\r?\n/)) {
@@ -65,7 +68,7 @@ export async function readConfig(root) {
65
68
  key = "";
66
69
  continue;
67
70
  }
68
- const head = line.match(/^(frameworks|ignore)\s*:\s*$/);
71
+ const head = line.match(/^(frameworks|ignore|packs)\s*:\s*$/);
69
72
  if (head) {
70
73
  key = head[1];
71
74
  continue;
@@ -79,13 +82,14 @@ export async function readConfig(root) {
79
82
  }
80
83
  }
81
84
  const ignore = lists.ignore.map((p) => p.replace(/\\/g, "/").replace(/^\.?\//, "").replace(/\/+$/, ""));
85
+ const packsMissing = lists.packs.length ? await loadPacks(lists.packs) : undefined;
82
86
  if (emptyFw)
83
- return { frameworks: [], skipped: [], ignore };
87
+ return { frameworks: [], skipped: [], ignore, packsMissing };
84
88
  const ids = lists.frameworks;
85
89
  if (!ids.length)
86
- return { frameworks: null, skipped: [], ignore };
90
+ return { frameworks: null, skipped: [], ignore, packsMissing };
87
91
  const known = ids.filter((i) => ALL_FRAMEWORKS.includes(i));
88
- return { frameworks: known, skipped: ids.filter((i) => !known.includes(i)), ignore };
92
+ return { frameworks: known, skipped: ids.filter((i) => !known.includes(i)), ignore, packsMissing };
89
93
  }
90
94
  // Dependencies, build output and caches: generated code, not code you wrote.
91
95
  export const SKIP_DIRS = ["node_modules", ".git", "dist", "build", "out", ".output", ".next", ".nuxt", ".svelte-kit", ".astro", ".vercel", ".netlify", ".wrangler", ".turbo", ".cache", "venv", ".venv", "__pycache__", "coverage"];
@@ -113,10 +117,12 @@ export async function listFiles(root, ignore = []) {
113
117
  return out.sort();
114
118
  }
115
119
  const TEST_PATH = /(^|\/)(tests?|__tests__|__mocks__|spec|fixtures?|e2e)\/|\.(test|spec)\.[cm]?[jt]sx?$|(^|\/)test_[^/]+\.py$|_test\.(py|go)$/i;
116
- const SECRET_RULES = new Set(["secret.in-source", "config.default-secret-key", "auth.hardcoded-password"]);
120
+ // Rules that also read test files. Not auth.hardcoded-password: test logins are fake by design (field test, 50 repos).
121
+ const SECRET_RULES = new Set(["secret.in-source", "config.default-secret-key"]);
117
122
  // Lines a person already reviewed and marked for a linter or security scanner.
118
- const REVIEWED = /#\s*(noqa|nosec)\b|\/\/\s*NOSONAR\b|lintsure-ignore/;
119
- const PLACEHOLDER = /test|fake|dummy|example|sample|placeholder|sanitized|mock|xxx|changeme|localhost|["'](password|pass|secret|elastic|admin)["']/i;
123
+ const REVIEWED = /#\s*(noqa|nosec)\b|\/\/\s*NOSONAR\b|lintsure-ignore|pragma:\s*allowlist secret/;
124
+ // Also hand-typed fake keys: alphabet or number runs, words where random text should be, a whole key block on one line.
125
+ const PLACEHOLDER = /test|fake|dummy|example|sample|placeholder|sanitized|mock|xxx|changeme|localhost|["'](password|pass|secret|elastic|admin)["']|abcdef|123456|\b(xox[baprs]|gh[pousr])[-_][a-z]+(-[a-z]+)*\b|PRIVATE KEY-----.*-----END/i;
120
126
  /** The JSON object key that opens the block a line sits in, e.g. "peerDependencies". Pure. */
121
127
  export function enclosingKey(lines, i) {
122
128
  let depth = 0;
@@ -165,16 +171,40 @@ export async function scan(root, frameworks = ALL_FRAMEWORKS, opts = {}) {
165
171
  let filesChecked = 0, checkPoints = 0;
166
172
  const perRule = {};
167
173
  const { ignore } = await readConfig(root);
168
- for (const abs of await listFiles(root, ignore)) {
174
+ const all = await listFiles(root, ignore);
175
+ // Repository checks look at the file list once, not at file contents. The finding points at the file that's missing.
176
+ const paths = all.map((p) => relative(root, p).split(sep).join("/"));
177
+ for (const r of active.filter((x) => x.repoTest)) {
178
+ checkPoints++;
179
+ perRule[r.id] = 1;
180
+ const file = r.repoTest(paths);
181
+ if (!file)
182
+ continue;
183
+ const controls = r.controls.filter((c) => frameworks.includes(c.framework));
184
+ findings.push({ id: "", ruleId: r.id, file, line: 1, status: r.status, severity: r.severity, title: r.title, controls, fix: r.fix, note: r.note,
185
+ proposal: proposalFor({ file, line: 1, title: r.title, fix: r.fix, note: r.note, controls }), fingerprint: fingerprint(r.id, file, "") });
186
+ }
187
+ // Rules that look across files get the joined text of every file they read, read once up front.
188
+ const shared = new Map();
189
+ for (const r of active.filter((x) => x.sharedContext)) {
190
+ const texts = [];
191
+ for (const [k, abs] of all.entries()) {
192
+ const ext = extname(abs), file = paths[k];
193
+ if (r.extensions.includes(ext) && (!r.pathMatch || r.pathMatch.test(file)) && !r.unlessPath?.test(file))
194
+ texts.push(await readFile(abs, "utf8").catch(() => ""));
195
+ }
196
+ shared.set(r.id, texts.join("\n"));
197
+ }
198
+ for (const abs of all) {
169
199
  const ext = extname(abs) || (abs.endsWith(".env") ? ".env" : "");
170
200
  const name = basename(abs);
171
- const relevant = active.filter((r) => r.extensions.includes(ext) && (!r.fileName || r.fileName.test(name)));
201
+ const file = relative(root, abs).split(sep).join("/");
202
+ const relevant = active.filter((r) => r.extensions.includes(ext) && (!r.fileName || r.fileName.test(name)) && (!r.pathMatch || r.pathMatch.test(file)) && !r.unlessPath?.test(file));
172
203
  if (!relevant.length)
173
204
  continue;
174
205
  const buf = await readFile(abs);
175
206
  if (buf.length > MAX_BYTES || buf.includes(0))
176
207
  continue; // skip big or binary files
177
- const file = relative(root, abs).split(sep).join("/");
178
208
  const lines = buf.toString("utf8").split(/\r?\n/);
179
209
  if (lines.some((l) => l.length > MAX_LINE))
180
210
  continue; // minified or generated
@@ -213,8 +243,9 @@ export async function scan(root, frameworks = ALL_FRAMEWORKS, opts = {}) {
213
243
  return; // someone already looked at this line and marked it
214
244
  add(r, i + 1, hit === "partial" ? "partial" : r.status);
215
245
  });
246
+ // File rules see comment lines as blank, so "<img> in a comment" or a commented-out call doesn't count (field test).
216
247
  if (r.fileTest)
217
- for (const n of r.fileTest(lines))
248
+ for (const n of r.fileTest(skip ? lines.map((l, i) => (skip[i] ? "" : l)) : lines, shared.get(r.id)))
218
249
  add(r, n);
219
250
  }
220
251
  }
@@ -280,7 +311,9 @@ export function toMarkdown(r) {
280
311
  lines.splice(lines.length - 2, 0, `Since the baseline of ${r.baseline.created}: ${r.baseline.newCount} new, ${r.baseline.fixed.length} fixed, ${r.baseline.unchangedCount} unchanged.`, "");
281
312
  if (!r.findings.length)
282
313
  lines.push("No issues found by the current rules.", "");
283
- for (const f of r.findings)
314
+ // Fix first: Gaps before Partials, then by severity; file order within each group.
315
+ const rank = (f) => (f.status === "gap" ? 0 : 3) + { high: 0, medium: 1, low: 2 }[f.severity];
316
+ for (const f of [...r.findings].sort((a, b) => rank(a) - rank(b)))
284
317
  lines.push(`### ${f.id} · ${f.status === "gap" ? "Finding" : "Observation"} (${LABEL[f.status]}) · \`${f.file}:${f.line}\`${f.change === "new" ? " · New since baseline" : ""}`, `**${f.title}** · Risk level: ${f.severity}`, "", ...(f.accepted ? [acceptedLine(f.accepted), ""] : []), `- Rules: ${ctl(f.controls)}`, `- Auditor note: ${f.note}`, "", `**${PROPOSAL_HEADING}**`, "", `- Where: \`${f.proposal.where}\``, `- What: ${f.proposal.what}`, `- Why: ${f.proposal.why}`, `- Benefit: ${f.proposal.benefit}`, "");
285
318
  if (r.baseline?.fixed.length)
286
319
  lines.push(`## Fixed since baseline (${r.baseline.fixed.length})`, "", ...r.baseline.fixed.map((x) => `- ${x.ruleId} in \`${x.file}\``), "");
@@ -1,2 +1,2 @@
1
1
  import type { FrameworkKnowledge } from "./types.js";
2
- export declare const soc2: FrameworkKnowledge;
2
+ export declare const cra: FrameworkKnowledge;
@@ -0,0 +1,87 @@
1
+ // Own-words summary of the EU Cyber Resilience Act, Regulation (EU) 2024/2847. References article and annex numbers only.
2
+ export const cra = {
3
+ id: "cra",
4
+ name: "EU Cyber Resilience Act",
5
+ kind: "law",
6
+ summary: "The Cyber Resilience Act sets security rules for software and connected devices sold in the EU. Makers must build products that are secure by default, ship without known exploitable vulnerabilities, fix vulnerabilities with free security updates for the support period, and report actively exploited vulnerabilities quickly. Most products can assess themselves; some categories, such as password managers, VPNs and firewalls, face stricter checks.",
7
+ whoItAppliesTo: "Businesses that make, import or sell software or connected hardware in the EU, including apps and the cloud back ends they need to work. Open source made outside any commercial activity is out of scope, and some sectors with their own rules (such as medical devices and cars) are excluded.",
8
+ applies(p) {
9
+ if (p.digitalProductEU)
10
+ return "You supply software or a connected device in the EU as a business, so the Cyber Resilience Act's security and reporting duties likely apply.";
11
+ return null;
12
+ },
13
+ timeline: [
14
+ { date: "2024-12-10", what: "The Act enters into force." },
15
+ { date: "2026-09-11", what: "Reporting duties start: actively exploited vulnerabilities and severe incidents must be reported (early warning within 24 hours, notification within 72 hours)." },
16
+ { date: "2027-12-11", what: "Everything else applies: the security requirements, conformity assessment and CE marking." },
17
+ ],
18
+ obligations: [
19
+ { ref: "Annex I Part I (2)(b)", title: "Secure by default configuration", inCode: "partly",
20
+ rules: ["config.debug-on", "config.allowed-hosts-any", "config.default-secret-key", "cors.any-origin", "build.sourcemaps-public", "csrf.disabled", "session.cookie-insecure"],
21
+ plain: "The product ships with safe settings switched on: debug off, real host names, strong secrets, secure cookies, nothing left open that the user has to close.",
22
+ evidence: "Production configuration and the default settings a new install starts with." },
23
+ { ref: "Annex I Part I (2)(d)", title: "Protection from unauthorised access", inCode: "partly",
24
+ rules: ["auth.hardcoded-password", "jwt.unverified", "jwt.no-expiry", "supabase.rls-disabled", "supabase.policy-allows-all", "supabase.service-key-in-client", "cookie.trusted-role", "path.user-input", "fs.world-writable"],
25
+ plain: "Logins, tokens and permissions that keep people out of what isn't theirs: no built-in passwords, verified tokens that expire, and access rules on data.",
26
+ evidence: "How users sign in, how roles are checked, and tests between two accounts." },
27
+ { ref: "Annex I Part I (2)(e)", title: "Confidentiality of data", inCode: "yes",
28
+ rules: ["transport.plain-http", "transport.tls-verify-off", "crypto.weak-cipher", "crypto.weak-password-hash", "crypto.weak-random-token", "secret.in-source", "secret.public-env"],
29
+ plain: "Data stored or sent is protected with current encryption, and keys stay out of code and out of the browser.",
30
+ evidence: "Where data is encrypted in transit and at rest, and how keys are stored." },
31
+ { ref: "Annex I Part I (2)(f)", title: "Integrity of data and programs", inCode: "yes",
32
+ rules: ["sql.string-built", "cmd.shell-built", "code.eval", "deserialize.unsafe", "xss.raw-html", "template.user-string", "nosql.operator-input", "xml.external-entities", "mass-assignment", "html.script-no-sri"],
33
+ plain: "Input can't change data, commands or code it shouldn't: no injection, no unsafe parsing, and checks on scripts loaded from elsewhere.",
34
+ evidence: "Use of parameterised queries, safe parsers and integrity checks." },
35
+ { ref: "Annex I Part I (2)(g)", title: "Data minimisation", inCode: "partly",
36
+ rules: ["pii.logged", "pii.in-url", "pii.to-analytics"],
37
+ plain: "Only the data the product needs is processed, and it doesn't leak into logs, URLs or analytics.",
38
+ evidence: "A list of the personal data collected and why each item is needed." },
39
+ { ref: "Annex I Part I (2)(j)", title: "Limited attack surface", inCode: "partly",
40
+ rules: ["ssrf.user-url", "redirect.open", "upload.unrestricted", "error.stack-to-client"],
41
+ plain: "Fewer ways in: no open redirects, no server requests to any address a user picks, limits on uploads, and errors that don't reveal internals.",
42
+ evidence: "A list of exposed endpoints and interfaces." },
43
+ { ref: "Annex I Part I (2)(l)", title: "Security logging", inCode: "partly",
44
+ rules: ["log.secret", "log.injection"],
45
+ plain: "Security-relevant activity is recorded so problems can be spotted, without putting secrets in the logs or letting entries be forged. Users should be able to opt out where it fits.",
46
+ evidence: "What is logged for logins, access changes and admin actions, and how long it's kept." },
47
+ { ref: "Annex I Part I (2)(a)", title: "No known exploitable vulnerabilities", inCode: "no",
48
+ plain: "Nothing ships with a vulnerability that's already public and exploitable, including in dependencies. This needs advisory data, which Lintsure doesn't download, so use a dependency scanner alongside it.",
49
+ evidence: "Dependency scanner results at release and how alerts are handled." },
50
+ { ref: "Annex I Part II (1)", title: "Components identified, including an SBOM", inCode: "partly",
51
+ rules: ["repo.no-sbom", "repo.binary-committed", "deps.unpinned-version", "deps.install-script"],
52
+ plain: "You know what's in your product: pinned dependencies, no unexplained compiled files, and a machine-readable software bill of materials (SBOM) covering at least the top-level components.",
53
+ evidence: "An SBOM per release in CycloneDX or SPDX format." },
54
+ { ref: "Annex I Part II (5)", title: "Coordinated vulnerability disclosure policy", inCode: "partly",
55
+ rules: ["repo.no-security-policy"],
56
+ plain: "A published way for anyone to report a vulnerability to you, and a process for handling reports.",
57
+ evidence: "SECURITY.md or a security page, and records of reports received and handled." },
58
+ { ref: "Annex I Part II (7)", title: "Updates distributed securely", inCode: "partly",
59
+ rules: ["update.unverified-download", "ci.action-unpinned", "ci.prt-checkout-head", "ci.write-all-permissions", "ci.script-injection"],
60
+ plain: "Builds and updates can't be swapped or tampered with: pinned CI steps, workflow tokens limited to what they need, untrusted pull requests and issue text kept away from secrets and commands, and nothing run straight from a download without a check.",
61
+ evidence: "Release signing, CI configuration and how users receive updates." },
62
+ { ref: "Annex I Part II (2)", title: "Vulnerabilities fixed without delay", inCode: "partly",
63
+ rules: ["repo.no-dependency-updates"],
64
+ plain: "When a component you use gets a security fix, it reaches your product quickly. Automated update pull requests are the usual way to make that happen.",
65
+ evidence: "Dependency update settings and how long security updates take to merge." },
66
+ { ref: "Annex I Part II (2), (8)", title: "Free security updates for the support period", inCode: "no",
67
+ plain: "Vulnerabilities are fixed without delay and security updates are free for the support period, which is at least five years unless the product is expected to be used for less, and stated when it's sold (Art. 13(8)).",
68
+ evidence: "The published support period and the update and patch history." },
69
+ { ref: "Art. 13(2)", title: "Cybersecurity risk assessment", inCode: "no",
70
+ plain: "A documented assessment of the product's security risks, kept up to date and used to decide which requirements apply and how.",
71
+ evidence: "The risk assessment and when it was last reviewed." },
72
+ { ref: "Art. 14", title: "Reporting exploited vulnerabilities and severe incidents", inCode: "no",
73
+ plain: "An actively exploited vulnerability or severe incident must be reported through the EU single reporting platform: early warning within 24 hours, notification within 72 hours, and a final report later. This already applies.",
74
+ evidence: "An incident and vulnerability reporting procedure with named owners." },
75
+ { ref: "Annex V, VII; Art. 30-32", title: "Technical documentation, declaration and CE marking", inCode: "no",
76
+ plain: "Technical documentation, an EU declaration of conformity and the CE marking, using the right assessment route for the product's category. Documentation is kept for ten years.",
77
+ evidence: "The technical file, the declaration of conformity and the conformity assessment route." },
78
+ ],
79
+ watchOut: [
80
+ "Check the product's category first. Most software is a default product and can assess itself; important and critical products (for example password managers, VPNs, firewalls) need stricter routes.",
81
+ "Reporting has applied since 11 September 2026, more than a year before the rest of the Act.",
82
+ "Open source shared without any commercial activity is out of scope, but a company selling or monetising it is not.",
83
+ "Harmonised standards for the Act were still being written in late 2026. Until they're published, there's no ready-made checklist that proves conformity.",
84
+ "A code check covers part of Annex I. It can't show the risk assessment, support period, reporting process or documentation.",
85
+ ],
86
+ checkedOn: "2026-11-09",
87
+ };
@@ -6,6 +6,9 @@ export const gdpr = {
6
6
  kind: "law",
7
7
  summary: "The EU's privacy law. If you handle data about people in the EU, you need a valid reason for each use, should collect only what you need, keep it safe, tell people what you do, and let them see, fix or delete their data. AI doesn't get special treatment: training on or feeding personal data into a model is still processing.",
8
8
  whoItAppliesTo: "Any organization that handles personal data while based in the EU, or that offers goods or services to people in the EU or tracks their behavior there.",
9
+ timeline: [
10
+ { date: "2018-05-25", what: "GDPR applies in full across the EU and EEA. There is no transition period left: every duty below applies today." },
11
+ ],
9
12
  applies(p) {
10
13
  if (!p.personalData)
11
14
  return null;
@@ -47,7 +50,7 @@ export const gdpr = {
47
50
  plain: "Keep a list of what personal data you process, why, with whom you share it and how long you keep it.",
48
51
  evidence: "The register of processing activities." },
49
52
  { ref: "Art. 32", title: "Security of processing", inCode: "yes",
50
- rules: ["pii.logged", "secret.in-source", "transport.plain-http", "transport.tls-verify-off", "crypto.weak-password-hash", "sql.string-built", "pii.in-url"],
53
+ rules: ["pii.logged", "secret.in-source", "transport.plain-http", "transport.tls-verify-off", "crypto.weak-password-hash", "sql.string-built", "pii.in-url", "supabase.rls-disabled", "supabase.policy-allows-all", "supabase.service-key-in-client", "secret.public-env", "mobile.token-in-plain-storage", "mobile.cleartext-traffic", "mobile.backup-allowed"],
51
54
  plain: "Protect personal data with security that fits the risk: encryption, access control, testing and the ability to recover.",
52
55
  evidence: "Security measures and when they were last tested." },
53
56
  { ref: "Art. 33–34", title: "Breach notification", inCode: "no",
@@ -66,5 +69,5 @@ export const gdpr = {
66
69
  "Analytics and session-replay tools often collect more than you think. Check what each SDK sends.",
67
70
  "Legitimate interests is not a free pass. It needs a written balancing test.",
68
71
  ],
69
- checkedOn: "2026-11-07",
72
+ checkedOn: "2026-11-09",
70
73
  };
@@ -1,10 +1,10 @@
1
1
  import { euAiAct } from "./eu-ai-act.js";
2
2
  import { gdpr } from "./gdpr.js";
3
- import { iso27001 } from "./iso-27001.js";
4
- import { soc2 } from "./soc2.js";
5
3
  import { owaspTop10 } from "./owasp-top10.js";
4
+ import { cra } from "./cra.js";
5
+ import { cweTop25, owaspLlm } from "./more.js";
6
6
  export * from "./types.js";
7
- export const knowledge = [euAiAct, gdpr, soc2, iso27001, owaspTop10];
7
+ export const knowledge = [euAiAct, gdpr, owaspTop10, cra, owaspLlm, cweTop25];
8
8
  export const getKnowledge = (id) => knowledge.find((k) => k.id === id);
9
9
  /** Classifier: suggest frameworks with a reason. The user confirms; nothing is auto-applied. */
10
10
  export function classify(p) {
@@ -0,0 +1,3 @@
1
+ import type { FrameworkKnowledge } from "./types.js";
2
+ export declare const owaspLlm: FrameworkKnowledge;
3
+ export declare const cweTop25: FrameworkKnowledge;
@@ -0,0 +1,66 @@
1
+ // Own-words summaries. OWASP texts are CC BY-SA 4.0: we reference IDs and names only.
2
+ // Not affiliated with or endorsed by OWASP or MITRE.
3
+ export const owaspLlm = {
4
+ id: "owasp-llm", name: "OWASP Top 10 for LLM Applications 2025", kind: "standard",
5
+ summary: "The ten most serious security risks in apps built on large language models: prompt injection, leaking sensitive data, supply chain, poisoned data, unsafe use of model output, too much agency, system prompt leakage, weak vector stores, misinformation and runaway usage. It's an awareness list, not a law or certification.",
6
+ whoItAppliesTo: "Any team that builds a feature on an AI model: chatbots, assistants, agents, retrieval (RAG) and AI features inside other apps.",
7
+ applies(p) {
8
+ if (p.usesAI && (p.generativeAI || p.interactsWithPeople))
9
+ return "Your product sends text to an AI model and shows or acts on what comes back, so the common LLM risks apply.";
10
+ return null;
11
+ },
12
+ obligations: [
13
+ { ref: "LLM01:2025", title: "Prompt Injection", inCode: "partly", rules: ["llm.user-input-in-system-prompt"],
14
+ plain: "User text, web pages or files can carry instructions that change what the model does. Keep instructions and user content apart, and limit what the model can do.",
15
+ evidence: "How prompts are built, and tests with hostile input." },
16
+ { ref: "LLM02:2025", title: "Sensitive Information Disclosure", inCode: "partly", rules: ["secret.in-source", "secret.public-env", "pii.logged", "log.secret"],
17
+ plain: "Keys, personal data and internal details must not reach the model, its logs or its answers unless they're meant to.",
18
+ evidence: "What data is sent to the model provider, and the provider's data retention terms." },
19
+ { ref: "LLM03:2025", title: "Supply Chain", inCode: "partly", rules: ["deps.unpinned-version", "deps.install-script"],
20
+ plain: "Models, datasets, plugins and packages come from others. Pin and check them like any dependency.",
21
+ evidence: "Where each model and dataset comes from, and its licence." },
22
+ { ref: "LLM04:2025", title: "Data and Model Poisoning", inCode: "no",
23
+ plain: "Training, fine-tuning or retrieval data can be tampered with to change the model's behaviour.",
24
+ evidence: "Data sources, who can change them, and checks on new data." },
25
+ { ref: "LLM05:2025", title: "Improper Output Handling", inCode: "yes", rules: ["llm.output-to-sink"],
26
+ plain: "Treat what the model returns as untrusted. Never run it as code, a shell command or SQL, and escape it before showing it as HTML.",
27
+ evidence: "How model output is validated before use." },
28
+ { ref: "LLM06:2025", title: "Excessive Agency", inCode: "no",
29
+ plain: "Tools and permissions given to an agent should be the minimum it needs, with a person approving anything risky.",
30
+ evidence: "A list of the tools each agent can call and which need approval." },
31
+ { ref: "LLM07:2025", title: "System Prompt Leakage", inCode: "partly", rules: ["llm.user-input-in-system-prompt"],
32
+ plain: "Assume users can read the system prompt. Don't put secrets or access rules in it, and don't mix user text into it.",
33
+ evidence: "System prompts reviewed for secrets and access logic." },
34
+ { ref: "LLM08:2025", title: "Vector and Embedding Weaknesses", inCode: "no",
35
+ plain: "Retrieval stores must keep one user's or customer's documents away from another's, and resist planted content.",
36
+ evidence: "Access rules on the vector store and tests across two accounts." },
37
+ { ref: "LLM09:2025", title: "Misinformation", inCode: "no",
38
+ plain: "Models state wrong things confidently. Show sources, say it's AI and keep a person in the loop where it matters.",
39
+ evidence: "How answers are checked and how users are told the limits." },
40
+ { ref: "LLM10:2025", title: "Unbounded Consumption", inCode: "partly", rules: ["llm.no-output-limit", "ai.call-not-logged"],
41
+ plain: "Limit output size, request rate and cost per user, so one person can't run up a bill or take the service down.",
42
+ evidence: "Rate limits, spending alerts and usage monitoring." },
43
+ ],
44
+ watchOut: ["Prompt injection has no complete fix today. Reduce what a fooled model can do, rather than relying on filters alone.", "Lintsure reads one line or file at a time, so prompts built across several files may be missed."],
45
+ checkedOn: "2026-11-09",
46
+ };
47
+ export const cweTop25 = {
48
+ id: "cwe-top25", name: "CWE Top 25 (2025)", kind: "standard",
49
+ summary: "MITRE's yearly list of the 25 most dangerous software weaknesses, ranked from real vulnerability data. Security teams, scanners and buyers use CWE numbers as a shared language, so mapping findings to them makes reports easy to compare.",
50
+ whoItAppliesTo: "Anyone writing software. It's a reference list, not a law or certification.",
51
+ applies(p) { return p.b2bCustomers || p.governmentCustomers ? "Security teams and buyers often ask how you handle the CWE Top 25." : null; },
52
+ obligations: [
53
+ { ref: "CWE-79, CWE-89, CWE-78, CWE-77, CWE-94", title: "Injection: scripting, SQL, commands and code", inCode: "yes", rules: ["xss.raw-html", "template.user-string", "sql.string-built", "cmd.shell-built", "code.eval", "llm.output-to-sink"], plain: "Input never becomes part of a page, query, command or code without the right handling." },
54
+ { ref: "CWE-862, CWE-863, CWE-284, CWE-639", title: "Missing or broken authorization", inCode: "partly", rules: ["supabase.rls-disabled", "supabase.policy-allows-all", "supabase.service-key-in-client", "cookie.trusted-role", "fs.world-writable", "mass-assignment"], plain: "Every action and record is checked against what the user may do.", evidence: "Access tests between two accounts." },
55
+ { ref: "CWE-352", title: "Cross-site request forgery", inCode: "yes", rules: ["csrf.disabled"], plain: "Other sites can't make a signed-in user's browser perform actions." },
56
+ { ref: "CWE-22, CWE-434", title: "Path traversal and dangerous uploads", inCode: "yes", rules: ["path.user-input", "upload.unrestricted"], plain: "File paths and uploads are limited to what's expected." },
57
+ { ref: "CWE-502, CWE-20", title: "Unsafe deserialization and input validation", inCode: "partly", rules: ["deserialize.unsafe", "nosql.operator-input", "mass-assignment"], plain: "Untrusted data is validated and never turned back into objects unsafely." },
58
+ { ref: "CWE-918", title: "Server-side request forgery", inCode: "yes", rules: ["ssrf.user-url"], plain: "The server doesn't fetch any address a user picks." },
59
+ { ref: "CWE-200", title: "Exposure of sensitive information", inCode: "partly", rules: ["pii.logged", "pii.in-url", "log.secret", "error.stack-to-client", "build.sourcemaps-public", "secret.public-env"], plain: "Personal data, secrets and internals don't leak into logs, URLs, errors or the browser." },
60
+ { ref: "CWE-770", title: "Resources without limits", inCode: "partly", rules: ["llm.no-output-limit"], plain: "Expensive work, including AI calls, has limits.", evidence: "Rate limits and quotas." },
61
+ { ref: "CWE-306", title: "Missing authentication for a critical function", inCode: "no", plain: "Every sensitive endpoint requires a signed-in user. Needs a route-by-route review.", evidence: "A list of endpoints and their authentication." },
62
+ { ref: "CWE-787, 416, 125, 120, 476, 121, 122", title: "Memory safety", inCode: "no", plain: "Buffer and pointer errors in C and C++. Lintsure doesn't check these languages; use a memory-safe language or a dedicated tool.", evidence: "Results from a C/C++ analyser or fuzzing." },
63
+ ],
64
+ watchOut: ["The list ranks weaknesses by data from published vulnerabilities; it changes a little each year.", "Seven of the 25 are memory-safety weaknesses that don't apply to JavaScript, TypeScript or Python code."],
65
+ checkedOn: "2026-11-09",
66
+ };
@@ -11,33 +11,33 @@ export const owaspTop10 = {
11
11
  if (p.b2bCustomers)
12
12
  return "Business customers and security questionnaires often ask how you handle the OWASP Top 10.";
13
13
  if (p.personalData)
14
- return "You handle personal data in a web app, so the common web security risks apply.";
14
+ return "You handle personal data. If you offer it through a web app or API, the common web security risks apply.";
15
15
  return null;
16
16
  },
17
17
  obligations: [
18
18
  { ref: "A01:2025", title: "Broken Access Control", inCode: "partly",
19
- rules: ["path.user-input", "redirect.open", "ssrf.user-url", "csrf.disabled", "fs.world-writable", "cors.any-origin", "cookie.trusted-role"],
19
+ rules: ["path.user-input", "redirect.open", "ssrf.user-url", "csrf.disabled", "fs.world-writable", "cors.any-origin", "cookie.trusted-role", "supabase.rls-disabled", "supabase.policy-allows-all", "supabase.service-key-in-client"],
20
20
  plain: "People must only reach the data and actions meant for them. This covers file paths, redirects, requests your server makes on a user's behalf (SSRF), forged requests from other sites, and permissions kept where users can change them.",
21
21
  evidence: "A list of roles and what each may do, and tests showing one user can't read or change another user's data." },
22
22
  { ref: "A01:2025 (ownership checks)", title: "Every record is checked against the signed-in user", inCode: "no",
23
23
  plain: "Whether each endpoint checks that the record belongs to the person asking (often called IDOR). A line-by-line code check can't tell; it needs design review and testing with two accounts.",
24
24
  evidence: "Access control tests per role, or a penetration test report." },
25
25
  { ref: "A02:2025", title: "Security Misconfiguration", inCode: "partly",
26
- rules: ["config.debug-on", "config.allowed-hosts-any", "config.default-secret-key", "xml.external-entities", "cors.any-origin", "session.cookie-insecure", "error.stack-to-client"],
26
+ rules: ["config.debug-on", "config.allowed-hosts-any", "config.default-secret-key", "xml.external-entities", "cors.any-origin", "session.cookie-insecure", "error.stack-to-client", "build.sourcemaps-public"],
27
27
  plain: "Safe settings by default: debug off, real host names, strong secret keys, cookies marked secure, XML parsers that don't load outside files, and errors that don't reveal internals.",
28
28
  evidence: "Production configuration and a hardening checklist." },
29
29
  { ref: "A02:2025 (deployed settings)", title: "Server, cloud and header configuration in production", inCode: "no",
30
30
  plain: "What is actually running: server and cloud settings, open ports, default accounts, security headers on real responses. These need a scan of the deployed system.",
31
31
  evidence: "Infrastructure configuration, a header scan and a cloud configuration review." },
32
32
  { ref: "A03:2025", title: "Software Supply Chain Failures", inCode: "partly",
33
- rules: ["deps.unpinned-version", "deps.install-script", "ci.action-unpinned", "ci.prt-checkout-head"],
34
- plain: "The code you didn't write: dependencies, build tools and CI. Versions should be pinned, install scripts shouldn't fetch code, CI actions should be pinned, and untrusted pull requests must not run with your secrets.",
33
+ rules: ["deps.unpinned-version", "deps.install-script", "ci.action-unpinned", "ci.prt-checkout-head", "ci.write-all-permissions", "ci.script-injection", "update.unverified-download"],
34
+ plain: "The code you didn't write: dependencies, build tools and CI. Versions should be pinned, install scripts shouldn't fetch code, CI actions should be pinned, untrusted pull requests must not run with your secrets, and text from issues or pull requests must never become part of a CI command.",
35
35
  evidence: "Lockfiles, CI workflow files and the dependency update process." },
36
36
  { ref: "A03:2025 (known vulnerabilities)", title: "Dependencies with known vulnerabilities", inCode: "no",
37
37
  plain: "Whether any dependency version has a published vulnerability, and whether it's maintained. This needs vulnerability advisory data, which Lintsure doesn't download, so use a dependency scanner alongside it.",
38
38
  evidence: "Dependency scanner results (for example npm audit, OSV-Scanner or Dependabot) and how alerts are handled." },
39
39
  { ref: "A04:2025", title: "Cryptographic Failures", inCode: "yes",
40
- rules: ["crypto.weak-password-hash", "crypto.weak-random-token", "crypto.weak-cipher", "jwt.unverified", "transport.plain-http", "transport.tls-verify-off", "secret.in-source"],
40
+ rules: ["crypto.weak-password-hash", "crypto.weak-random-token", "crypto.weak-cipher", "jwt.unverified", "transport.plain-http", "transport.tls-verify-off", "secret.in-source", "secret.public-env", "mobile.token-in-plain-storage", "mobile.cleartext-traffic"],
41
41
  plain: "Protect data with sound cryptography: HTTPS everywhere, certificate checks on, strong password hashing, modern ciphers, unpredictable tokens, signed tokens that are verified, and no keys in code.",
42
42
  evidence: "Where data is encrypted in transit and at rest, and how keys are stored and rotated." },
43
43
  { ref: "A04:2025 (key management)", title: "Key management and encryption at rest", inCode: "no",
@@ -48,7 +48,7 @@ export const owaspTop10 = {
48
48
  plain: "Keep data and code apart, so input can't become part of a SQL query, a shell command, a template, HTML on the page or code that gets run.",
49
49
  evidence: "Use of parameterised queries, output escaping, and code review practice." },
50
50
  { ref: "A06:2025", title: "Insecure Design", inCode: "partly",
51
- rules: ["upload.unrestricted", "mass-assignment", "pii.in-url"],
51
+ rules: ["upload.unrestricted", "mass-assignment", "pii.in-url", "mobile.webview-any-origin"],
52
52
  plain: "Security planned in from the start: limits on uploads, only the fields users may change, sensitive data kept out of URLs. Most of this category is about design, not individual lines.",
53
53
  evidence: "Design notes for sensitive features." },
54
54
  { ref: "A06:2025 (threat modelling)", title: "Threat modelling and abuse cases", inCode: "no",