@lintsure/core 0.3.12 → 0.3.13
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/dist/src/index.d.ts +2 -2
- package/dist/src/index.js +24 -2
- package/dist/src/knowledge/owasp-top10.js +1 -1
- package/dist/src/rules/more.js +6 -0
- package/docs/README.md +1 -1
- package/docs/agents.md +1 -1
- package/docs/frameworks.md +2 -2
- package/docs/rules.md +11 -2
- package/package.json +1 -1
package/dist/src/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export { toAssessmentHtml } from "./assessment.js";
|
|
|
13
13
|
export * from "./knowledge/index.js";
|
|
14
14
|
export { loadPacks, registerPack, type Pack } from "./packs.js";
|
|
15
15
|
export { checksFor } from "./plan.js";
|
|
16
|
-
export declare const RULES_VERSION = "0.3.
|
|
16
|
+
export declare const RULES_VERSION = "0.3.13";
|
|
17
17
|
/** Shown with every result, in every interface. Lintsure prepares; people decide. */
|
|
18
18
|
export declare const DISCLAIMER: string;
|
|
19
19
|
/** What a report must never be read as. Used in the report and by the MCP server. */
|
|
@@ -62,7 +62,7 @@ export declare function enclosingKey(lines: string[], i: number): string;
|
|
|
62
62
|
export declare function exampleLines(lines: string[], ext: string): boolean[];
|
|
63
63
|
export declare function taintedNames(lines: string[]): Map<string, number>;
|
|
64
64
|
export declare function hopLine(lines: string[], i: number, names: Map<string, number>): string | null;
|
|
65
|
-
export declare
|
|
65
|
+
export declare function blankStrings(l: string): string;
|
|
66
66
|
export interface Statement {
|
|
67
67
|
start: number;
|
|
68
68
|
end: number;
|
package/dist/src/index.js
CHANGED
|
@@ -22,7 +22,7 @@ export { loadPacks, registerPack } from "./packs.js";
|
|
|
22
22
|
export { checksFor } from "./plan.js";
|
|
23
23
|
import { configPacks, loadPacks, packFrameworks, packsLoaded } from "./packs.js";
|
|
24
24
|
import { buildGraph, declaredEntries, reachOf } from "./reach.js";
|
|
25
|
-
export const RULES_VERSION = "0.3.
|
|
25
|
+
export const RULES_VERSION = "0.3.13";
|
|
26
26
|
/** Shown with every result, in every interface. Lintsure prepares; people decide. */
|
|
27
27
|
export const DISCLAIMER = "Lintsure is a readiness tool, not an audit, a certification or legal advice. " +
|
|
28
28
|
"Its rules reflect our reading of the publicly available text of each framework, and they check code only. " +
|
|
@@ -279,7 +279,29 @@ export function hopLine(lines, i, names) {
|
|
|
279
279
|
}
|
|
280
280
|
const PROMPT_DOC = /(^|\/)(?:prompts?|personas?|instructions?|system)(?:\/|[._-])|(^|\/)(?:AGENTS|CLAUDE|GEMINI|SKILL|SYSTEM|PROMPT)\.mdx?$|\.prompt\.mdx?$|(^|\/)\.(?:github|cursor|claude)\//i;
|
|
281
281
|
const SINK_RULES = new Set(["path.user-input", "ssrf.user-url", "redirect.open", "code.eval", "cmd.shell-built", "deserialize.unsafe"]);
|
|
282
|
-
|
|
282
|
+
// One pass, no regex: a line with an unclosed quote and many escapes must not cost more than its length (CodeQL js/polynomial-redos).
|
|
283
|
+
export function blankStrings(l) {
|
|
284
|
+
let out = "", q = "", start = 0;
|
|
285
|
+
for (let i = 0; i < l.length; i++) {
|
|
286
|
+
const c = l[i];
|
|
287
|
+
if (q) {
|
|
288
|
+
if (c === "\\")
|
|
289
|
+
i++;
|
|
290
|
+
else if (c === q) {
|
|
291
|
+
out += q + q;
|
|
292
|
+
q = "";
|
|
293
|
+
}
|
|
294
|
+
continue;
|
|
295
|
+
}
|
|
296
|
+
if (c === "'" || c === '"') {
|
|
297
|
+
q = c;
|
|
298
|
+
start = i;
|
|
299
|
+
}
|
|
300
|
+
else
|
|
301
|
+
out += c;
|
|
302
|
+
}
|
|
303
|
+
return q ? out + l.slice(start) : out; // an unclosed quote is left as it was, like the old regex that didn't match it
|
|
304
|
+
}
|
|
283
305
|
const HASH_COMMENTS = new Set([".py", ".rb", ".sh", ".yml", ".yaml", ".toml", ".env"]);
|
|
284
306
|
const C_LIKE = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".java", ".kt", ".swift", ".go", ".css", ".scss"]);
|
|
285
307
|
// Statement window (review step A): formatters split one call over several lines, and a rule that reads one line
|
|
@@ -23,7 +23,7 @@ export const owaspTop10 = {
|
|
|
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", "agent.permissions-allow-all", "config.allowed-hosts-any", "config.default-secret-key", "xml.external-entities", "cors.any-origin", "session.cookie-insecure", "error.stack-to-client", "build.sourcemaps-public", "release.env-not-ignored", "k8s.privileged", "graphql.introspection"],
|
|
26
|
+
rules: ["config.debug-on", "agent.permissions-allow-all", "config.allowed-hosts-any", "config.default-secret-key", "xml.external-entities", "cors.any-origin", "session.cookie-insecure", "error.stack-to-client", "build.sourcemaps-public", "release.env-not-ignored", "k8s.privileged", "docker.socket-mounted", "graphql.introspection"],
|
|
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",
|
package/dist/src/rules/more.js
CHANGED
|
@@ -53,6 +53,12 @@ export const moreRules = [
|
|
|
53
53
|
fix: "Remove privileged, hostNetwork, hostPID and hostIPC, set allowPrivilegeEscalation: false, and run as a non-root user.",
|
|
54
54
|
note: "A privileged container, or one sharing the host's network or processes, can take over the machine it runs on if it is broken into (CWE-250).", extensions: [".yml", ".yaml"],
|
|
55
55
|
test: (l) => /^\s*-?\s*(privileged|allowPrivilegeEscalation|hostNetwork|hostPID|hostIPC)\s*:\s*true\b/.test(l) || /^\s*-?\s*runAsUser\s*:\s*0\s*$/.test(l) }),
|
|
56
|
+
rule({ id: "docker.socket-mounted", title: "Docker socket mounted into a container", status: "partial", severity: "high", controls: [A02],
|
|
57
|
+
fix: "Don't mount /var/run/docker.sock. If the container really needs Docker, point it at a separate, locked-down Docker daemon over TLS, or use a rootless or socket-proxy setup that allows only the calls it needs.",
|
|
58
|
+
note: "Whatever runs in the container gets the host's Docker, and with it the whole machine: it can start a privileged container that mounts the host's disk (CWE-250). Mounting it read-only (:ro) doesn't help, because the API still works.", extensions: [".yml", ".yaml", ".json", ".sh", ""],
|
|
59
|
+
unseen: "Lintsure can't tell whether this container is meant to manage Docker (a CI runner or a reverse proxy) or whether the host is a throwaway machine.",
|
|
60
|
+
// A mount, not a client setting: DOCKER_HOST=unix:///var/run/docker.sock only says where to connect.
|
|
61
|
+
test: (l) => /(?<!unix:\/)\/var\/run\/docker\.sock\b|\/\/\.\/pipe\/docker_engine/.test(l) && !/^\s*#|DOCKER_HOST\s*[:=]/.test(l) }),
|
|
56
62
|
rule({ id: "cloud.public-bucket", title: "Storage bucket open to the public", status: "gap", severity: "high", controls: [A01],
|
|
57
63
|
fix: "Keep the bucket private and block public access. Share single files with short-lived signed URLs instead.",
|
|
58
64
|
note: "Anyone on the internet can list or download what's in a public bucket, and with write access, replace it (CWE-284).", extensions: [".tf", ".json", ".yml", ".yaml", ...CODE],
|
package/docs/README.md
CHANGED
package/docs/agents.md
CHANGED
package/docs/frameworks.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<!-- Generated from Lintsure 0.3.
|
|
1
|
+
<!-- Generated from Lintsure 0.3.13 by scripts/build-docs.mjs. -->
|
|
2
2
|
# Frameworks
|
|
3
3
|
|
|
4
4
|
## EU AI Act (`eu-ai-act`)
|
|
@@ -62,7 +62,7 @@ Applies to: Any team building a web application or API. It's voluntary, but ofte
|
|
|
62
62
|
|
|
63
63
|
- A01:2025 Broken Access Control [partly in code]: 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. 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, supabase.function-no-auth, authz.no-owner-check, ws.no-origin-check, cloud.public-bucket.
|
|
64
64
|
- A01:2025 (ownership checks) Every record is checked against the signed-in user [outside code]: 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.
|
|
65
|
-
- A02:2025 Security Misconfiguration [partly in code]: 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. Rules: config.debug-on, agent.permissions-allow-all, config.allowed-hosts-any, config.default-secret-key, xml.external-entities, cors.any-origin, session.cookie-insecure, error.stack-to-client, build.sourcemaps-public, release.env-not-ignored, k8s.privileged, graphql.introspection.
|
|
65
|
+
- A02:2025 Security Misconfiguration [partly in code]: 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. Rules: config.debug-on, agent.permissions-allow-all, config.allowed-hosts-any, config.default-secret-key, xml.external-entities, cors.any-origin, session.cookie-insecure, error.stack-to-client, build.sourcemaps-public, release.env-not-ignored, k8s.privileged, docker.socket-mounted, graphql.introspection.
|
|
66
66
|
- A02:2025 (deployed settings) Server, cloud and header configuration in production [outside code]: 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.
|
|
67
67
|
- A03:2025 Software Supply Chain Failures [partly in code]: 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. Rules: deps.unpinned-version, deps.install-script, agent.config-runs-remote-code, agent.instructions-unsafe, ci.action-unpinned, ci.prt-checkout-head, ci.write-all-permissions, ci.script-injection, update.unverified-download.
|
|
68
68
|
- A03:2025 (known vulnerabilities) Dependencies with known vulnerabilities [outside code]: 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.
|
package/docs/rules.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
<!-- Generated from Lintsure 0.3.
|
|
2
|
-
# Lintsure rules (
|
|
1
|
+
<!-- Generated from Lintsure 0.3.13 by scripts/build-docs.mjs. -->
|
|
2
|
+
# Lintsure rules (85)
|
|
3
3
|
|
|
4
4
|
## pii.logged
|
|
5
5
|
**Personal data written to logs** · status when found: gap · risk: high
|
|
@@ -462,6 +462,15 @@
|
|
|
462
462
|
- Note: A privileged container, or one sharing the host's network or processes, can take over the machine it runs on if it is broken into (CWE-250).
|
|
463
463
|
- Page: https://lintsure.com/rules/k8s-privileged
|
|
464
464
|
|
|
465
|
+
## docker.socket-mounted
|
|
466
|
+
**Docker socket mounted into a container** · status when found: partial · risk: high
|
|
467
|
+
|
|
468
|
+
- Controls: owasp-top10 A02:2025 (Security Misconfiguration)
|
|
469
|
+
- Fix: Don't mount /var/run/docker.sock. If the container really needs Docker, point it at a separate, locked-down Docker daemon over TLS, or use a rootless or socket-proxy setup that allows only the calls it needs.
|
|
470
|
+
- Note: Whatever runs in the container gets the host's Docker, and with it the whole machine: it can start a privileged container that mounts the host's disk (CWE-250). Mounting it read-only (:ro) doesn't help, because the API still works.
|
|
471
|
+
- When Partial, Lintsure can't see: Lintsure can't tell whether this container is meant to manage Docker (a CI runner or a reverse proxy) or whether the host is a throwaway machine.
|
|
472
|
+
- Page: https://lintsure.com/rules/docker-socket-mounted
|
|
473
|
+
|
|
465
474
|
## cloud.public-bucket
|
|
466
475
|
**Storage bucket open to the public** · status when found: gap · risk: high
|
|
467
476
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lintsure/core",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.13",
|
|
4
4
|
"description": "Lintsure engine: rules, framework knowledge and reports for readiness checks of AI-written code. Not an audit or legal advice.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|