@skillsmith/core 0.12.2 → 0.12.3
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/CHANGELOG.md +9 -0
- package/README.md +2 -2
- package/dist/.tsbuildinfo +1 -1
- package/dist/src/index.d.ts +2 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js +9 -1
- package/dist/src/scripts/__tests__/scan-imported-skills.test.js.map +1 -1
- package/dist/src/scripts/scan-imported-skills.d.ts +7 -1
- package/dist/src/scripts/scan-imported-skills.d.ts.map +1 -1
- package/dist/src/scripts/scan-imported-skills.js +15 -2
- package/dist/src/scripts/scan-imported-skills.js.map +1 -1
- package/dist/src/scripts/skill-scanner/allowlist.d.ts +10 -0
- package/dist/src/scripts/skill-scanner/allowlist.d.ts.map +1 -1
- package/dist/src/scripts/skill-scanner/allowlist.js +10 -0
- package/dist/src/scripts/skill-scanner/allowlist.js.map +1 -1
- package/dist/src/scripts/skill-scanner/index.d.ts +8 -0
- package/dist/src/scripts/skill-scanner/index.d.ts.map +1 -1
- package/dist/src/scripts/skill-scanner/index.js +13 -5
- package/dist/src/scripts/skill-scanner/index.js.map +1 -1
- package/dist/src/scripts/skill-scanner/trust-scorer.d.ts.map +1 -1
- package/dist/src/scripts/skill-scanner/trust-scorer.js +6 -0
- package/dist/src/scripts/skill-scanner/trust-scorer.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.action-context.d.ts +15 -0
- package/dist/src/security/scanner/SecurityScanner.action-context.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.action-context.js +209 -0
- package/dist/src/security/scanner/SecurityScanner.action-context.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts +25 -0
- package/dist/src/security/scanner/SecurityScanner.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.helpers.d.ts +40 -1
- package/dist/src/security/scanner/SecurityScanner.helpers.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.helpers.js +88 -51
- package/dist/src/security/scanner/SecurityScanner.helpers.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.js +39 -6
- package/dist/src/security/scanner/SecurityScanner.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts +30 -0
- package/dist/src/security/scanner/SecurityScanner.pii.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.pii.js +8 -1
- package/dist/src/security/scanner/SecurityScanner.pii.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.d.ts +60 -0
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.js +228 -0
- package/dist/src/security/scanner/SecurityScanner.prose-lexicon.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.scanners.d.ts.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.scanners.js +35 -5
- package/dist/src/security/scanner/SecurityScanner.scanners.js.map +1 -1
- package/dist/src/security/scanner/SecurityScanner.value-gate.d.ts +49 -0
- package/dist/src/security/scanner/SecurityScanner.value-gate.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.value-gate.js +134 -0
- package/dist/src/security/scanner/SecurityScanner.value-gate.js.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.d.ts +55 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.d.ts.map +1 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.js +313 -0
- package/dist/src/security/scanner/SecurityScanner.weak-passwords.js.map +1 -0
- package/dist/src/security/scanner/patterns.d.ts +16 -6
- package/dist/src/security/scanner/patterns.d.ts.map +1 -1
- package/dist/src/security/scanner/patterns.js +25 -61
- package/dist/src/security/scanner/patterns.js.map +1 -1
- package/dist/src/security/scanner/patterns.sensitive-path.d.ts +45 -0
- package/dist/src/security/scanner/patterns.sensitive-path.d.ts.map +1 -0
- package/dist/src/security/scanner/patterns.sensitive-path.js +137 -0
- package/dist/src/security/scanner/patterns.sensitive-path.js.map +1 -0
- package/dist/src/security/scanner/regex-utils.d.ts +31 -17
- package/dist/src/security/scanner/regex-utils.d.ts.map +1 -1
- package/dist/src/security/scanner/regex-utils.js +31 -17
- package/dist/src/security/scanner/regex-utils.js.map +1 -1
- package/dist/src/security/scanner/types.d.ts +9 -0
- package/dist/src/security/scanner/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +2 -0
- package/dist/src/utils/index.js.map +1 -1
- package/dist/src/utils/skill-name.d.ts +19 -0
- package/dist/src/utils/skill-name.d.ts.map +1 -0
- package/dist/src/utils/skill-name.js +26 -0
- package/dist/src/utils/skill-name.js.map +1 -0
- package/dist/src/utils/skill-name.test.d.ts +2 -0
- package/dist/src/utils/skill-name.test.d.ts.map +1 -0
- package/dist/src/utils/skill-name.test.js +34 -0
- package/dist/src/utils/skill-name.test.js.map +1 -0
- package/dist/tests/security/ContinuousSecurity.performance.test.js +12 -7
- package/dist/tests/security/ContinuousSecurity.performance.test.js.map +1 -1
- package/dist/tests/security/ContinuousSecurity.test.js +14 -2
- package/dist/tests/security/ContinuousSecurity.test.js.map +1 -1
- package/dist/tests/security/ai-defence-multiline-promotion.test.d.ts +10 -12
- package/dist/tests/security/ai-defence-multiline-promotion.test.d.ts.map +1 -1
- package/dist/tests/security/ai-defence-multiline-promotion.test.js +26 -33
- package/dist/tests/security/ai-defence-multiline-promotion.test.js.map +1 -1
- package/dist/tests/security/nested-instruction-long-attribute.test.js +20 -10
- package/dist/tests/security/nested-instruction-long-attribute.test.js.map +1 -1
- package/dist/tests/security/scanner-evidence-tiers.test.js +15 -0
- package/dist/tests/security/scanner-evidence-tiers.test.js.map +1 -1
- package/dist/tests/security/scanner-multiline-cap.test.d.ts +21 -0
- package/dist/tests/security/scanner-multiline-cap.test.d.ts.map +1 -0
- package/dist/tests/security/scanner-multiline-cap.test.js +152 -0
- package/dist/tests/security/scanner-multiline-cap.test.js.map +1 -0
- package/dist/tests/security/scanner-regression-guard.test.js +37 -0
- package/dist/tests/security/scanner-regression-guard.test.js.map +1 -1
- package/dist/tests/security/scanner-witness-sw1.test.d.ts +32 -0
- package/dist/tests/security/scanner-witness-sw1.test.d.ts.map +1 -0
- package/dist/tests/security/scanner-witness-sw1.test.js +255 -0
- package/dist/tests/security/scanner-witness-sw1.test.js.map +1 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.d.ts +2 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.d.ts.map +1 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.js +193 -0
- package/dist/tests/security/sensitive-path-adversarial-review.test.js.map +1 -0
- package/dist/tests/security/sensitive-path-fp.test.js +248 -0
- package/dist/tests/security/sensitive-path-fp.test.js.map +1 -1
- package/dist/tests/security/smi5879-corroboration.core.test.js +44 -0
- package/dist/tests/security/smi5879-corroboration.core.test.js.map +1 -1
- package/dist/tests/security/weak-password-lexicon.test.d.ts +18 -0
- package/dist/tests/security/weak-password-lexicon.test.d.ts.map +1 -0
- package/dist/tests/security/weak-password-lexicon.test.js +122 -0
- package/dist/tests/security/weak-password-lexicon.test.js.map +1 -0
- package/dist/tests/skill-scanner/allowlist.test.js +58 -4
- package/dist/tests/skill-scanner/allowlist.test.js.map +1 -1
- package/dist/tests/skill-scanner/categorizer.test.d.ts +2 -0
- package/dist/tests/skill-scanner/categorizer.test.d.ts.map +1 -0
- package/dist/tests/skill-scanner/categorizer.test.js +71 -0
- package/dist/tests/skill-scanner/categorizer.test.js.map +1 -0
- package/dist/tests/skill-scanner/cli-guard.test.d.ts +23 -0
- package/dist/tests/skill-scanner/cli-guard.test.d.ts.map +1 -0
- package/dist/tests/skill-scanner/cli-guard.test.js +71 -0
- package/dist/tests/skill-scanner/cli-guard.test.js.map +1 -0
- package/dist/tests/unit/services/skill-installation.content.test.js +36 -0
- package/dist/tests/unit/services/skill-installation.content.test.js.map +1 -1
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.d.ts +29 -0
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.d.ts.map +1 -0
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.js +200 -0
- package/dist/tests/unit/services/skill-installation.service.sensitive-path-fp.test.js.map +1 -0
- package/package.json +6 -1
|
@@ -7,14 +7,14 @@ export declare const DEFAULT_ALLOWED_DOMAINS: string[];
|
|
|
7
7
|
export declare const ANON_PASTE_HOSTS: string[];
|
|
8
8
|
export declare const TRANSIENT_TRANSFER_HOSTS: string[];
|
|
9
9
|
export declare const URL_SHORTENER_DOMAINS: string[];
|
|
10
|
-
export
|
|
11
|
-
export declare const SENSITIVE_PATH_PATTERNS: RegExp[];
|
|
12
|
-
export declare const VALUE_GATED_KEYWORD_PATTERNS: ReadonlySet<RegExp>;
|
|
10
|
+
export { ENV_PATH_PATTERN, SENSITIVE_PATH_PATTERNS, VALUE_GATED_KEYWORD_PATTERNS, PATH_FORM_PATTERNS, VALUE_GATED_ASSIGNMENT_PATTERNS, } from './patterns.sensitive-path.js';
|
|
13
11
|
export { JAILBREAK_PATTERNS, AI_DEFENCE_PATTERNS } from './patterns.jailbreak.js';
|
|
14
12
|
export { EVIDENCE_TYPE_BY_PATTERN } from './patterns.jailbreak.evidence.js';
|
|
15
13
|
/**
|
|
16
14
|
* SMI-5876 §0.1/§0.2: bump on ANY pattern-array or evidence-table change in
|
|
17
|
-
* this module
|
|
15
|
+
* this module, patterns.jailbreak.ts, or patterns.sensitive-path.ts (SMI-5207
|
|
16
|
+
* moved the sensitive_path family there; the bump obligation moved with it).
|
|
17
|
+
* The security-audit baseline
|
|
18
18
|
* (packages/mcp-server/src/audit/security-baseline.ts /
|
|
19
19
|
* security-audit.ts) stamps every stored entry with the version that
|
|
20
20
|
* produced it and treats a mismatch as "not comparable" — forcing a re-scan
|
|
@@ -70,11 +70,21 @@ export { EVIDENCE_TYPE_BY_PATTERN } from './patterns.jailbreak.evidence.js';
|
|
|
70
70
|
* produced advisory-tier findings before. All three are the
|
|
71
71
|
* previously-clean-content-now-fires scenario this gate exists for. Scope
|
|
72
72
|
* note (unchanged from Wave 3): this forces re-evaluation of the local MCP
|
|
73
|
-
* audit baseline only (
|
|
73
|
+
* audit baseline only (this constant and its `comparable` consumer,
|
|
74
74
|
* packages/mcp-server/src/audit/security-audit.ts:219-222); the edge indexer
|
|
75
75
|
* never reads this constant, which is why it has no edge counterpart.
|
|
76
|
+
* (SMI-5207 replaced a `patterns.ts:100-125` line-range citation here — that
|
|
77
|
+
* range addressed the sensitive_path family, which moved to
|
|
78
|
+
* patterns.sensitive-path.ts, so the numbers no longer resolve.)
|
|
79
|
+
*
|
|
80
|
+
* Bumped to `2026-09-07.1`: SMI-5207 added the MF-3 (path-form
|
|
81
|
+
* action-context, negation-aware) and MF-4 (assignment-form value,
|
|
82
|
+
* default-HIGH-unless-prose) severity gates. Unlike every bump above, this
|
|
83
|
+
* one is *previously-flagged-content-now-clean* — without it, the
|
|
84
|
+
* `comparable` gate keeps reusing a stored `malicious` verdict produced by
|
|
85
|
+
* the pre-fix ruleset, and the fix never reaches an already-scanned skill.
|
|
76
86
|
*/
|
|
77
|
-
export declare const SCANNER_RULESET_VERSION: "2026-
|
|
87
|
+
export declare const SCANNER_RULESET_VERSION: "2026-09-07.1";
|
|
78
88
|
export declare const SUSPICIOUS_PATTERNS: RegExp[];
|
|
79
89
|
export { CODE_EXECUTION_PATTERNS, IMPERATIVE_FETCH_EXEC_PROSE } from './patterns.exec.js';
|
|
80
90
|
export declare const SOCIAL_ENGINEERING_PATTERNS: RegExp[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.d.ts","sourceRoot":"","sources":["../../../../src/security/scanner/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,eAAO,MAAM,uBAAuB,UAanC,CAAA;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TRANSFER_HOSTS = ['transfer.sh', 'file.io', 'tmpfiles.org
|
|
|
52
52
|
// execution-correlated — a shortened URL piped to a shell has no legitimate
|
|
53
53
|
// install shape (a bare shortened link stays at url:medium like any tier here).
|
|
54
54
|
export const URL_SHORTENER_DOMAINS = ['bit.ly', 'tinyurl.com', 't.co', 'is.gd'];
|
|
55
|
-
//
|
|
56
|
-
//
|
|
57
|
-
//
|
|
58
|
-
//
|
|
59
|
-
//
|
|
60
|
-
//
|
|
61
|
-
//
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
// `apiKey: <YOUR_KEY>` placeholders. They are now VALUE-GATED: HIGH only when the
|
|
66
|
-
// line assigns a real (non-placeholder, sufficiently-entropic) secret. The
|
|
67
|
-
// value-BEARING leak is already caught at PII (PII_PATTERNS[0/2]); the
|
|
68
|
-
// credential-in-an-outbound-curl exfil is caught by DATA_EXFILTRATION_PATTERNS
|
|
69
|
-
// (the `$API_KEY`-in-a-fetched-URL pattern added below). See
|
|
70
|
-
// VALUE_GATED_KEYWORD_PATTERNS.
|
|
71
|
-
// MF-2: lone /\.env/i fired HIGH on every `.env` mention AND on the benign committed
|
|
72
|
-
// family (.envrc, .env.example/.sample/.template/.schema/.dist). ENV_PATH_PATTERN
|
|
73
|
-
// negative-lookaheads exclude that family; scanSensitivePaths downgrades a LONE
|
|
74
|
-
// `.env` to MEDIUM and keeps HIGH when it co-occurs with a read/exfil verb or
|
|
75
|
-
// shell pipe/redirect (`cat .env | curl ...`).
|
|
76
|
-
// MF-2: `.env` as a real env-file reference. Excludes `.envrc` (direnv config) and the
|
|
77
|
-
// committed placeholder family (.env.example/.sample/.template/.schema/.dist). The
|
|
78
|
-
// `(?![A-Za-z])` guard also drops the `.environment`/`.envision` English-word FP while
|
|
79
|
-
// still matching real variants like `.env`, `.env.local`, `.env.production`.
|
|
80
|
-
export const ENV_PATH_PATTERN = /\.env(?![A-Za-z])(?!\.(?:example|sample|template|schema|dist))/i;
|
|
81
|
-
// MF-1: bare credential keywords — value-gated in scanSensitivePaths, never standalone HIGH.
|
|
82
|
-
const API_KEY_KEYWORD = /api[_-]?key/i;
|
|
83
|
-
const AUTH_TOKEN_KEYWORD = /auth[_-]?token/i;
|
|
84
|
-
export const SENSITIVE_PATH_PATTERNS = [
|
|
85
|
-
ENV_PATH_PATTERN,
|
|
86
|
-
// Contextual credentials: filename or assignment, not bare prose
|
|
87
|
-
/credentials\.(?:json|ya?ml|env|toml|txt)/i,
|
|
88
|
-
/credentials\s*[:=]/i,
|
|
89
|
-
// Contextual secrets: assignment or path, not bare word
|
|
90
|
-
/\bsecrets?\s*[:=]/i,
|
|
91
|
-
/\bsecrets?\/[a-z0-9_.-]+/i,
|
|
92
|
-
/\.pem$/i,
|
|
93
|
-
/\.key$/i,
|
|
94
|
-
/\.crt$/i,
|
|
95
|
-
// Contextual password: assignment or URL (postgres://user:pass@host) only
|
|
96
|
-
/password\s*[:=]/i,
|
|
97
|
-
API_KEY_KEYWORD,
|
|
98
|
-
AUTH_TOKEN_KEYWORD,
|
|
99
|
-
/~\/\.ssh/i,
|
|
100
|
-
/~\/\.aws/i,
|
|
101
|
-
/~\/\.config/i,
|
|
102
|
-
// SMI-4396 Wave 2: explicit system-file paths. Added so that tightening
|
|
103
|
-
// bare /credentials/i and /password/i into assignment-context variants
|
|
104
|
-
// doesn't drop coverage of obvious sensitive references like /etc/passwd.
|
|
105
|
-
/\/etc\/(?:passwd|shadow|sudoers|hosts)\b/i,
|
|
106
|
-
];
|
|
107
|
-
// MF-1: the two bare-keyword patterns above emit HIGH only when accompanied by a real
|
|
108
|
-
// assigned secret value; scanSensitivePaths suppresses an otherwise-bare match.
|
|
109
|
-
export const VALUE_GATED_KEYWORD_PATTERNS = new Set([
|
|
110
|
-
API_KEY_KEYWORD,
|
|
111
|
-
AUTH_TOKEN_KEYWORD,
|
|
112
|
-
]);
|
|
55
|
+
// SMI-5207: the whole `sensitive_path` family (ENV_PATH_PATTERN, the 15-entry
|
|
56
|
+
// SENSITIVE_PATH_PATTERNS array and the three ReadonlySets that classify its
|
|
57
|
+
// entries by severity gate) moved to patterns.sensitive-path.ts — this file
|
|
58
|
+
// had only 18 lines of headroom under the 500-line pre-commit gate, and the
|
|
59
|
+
// MF-3/MF-4 classification needed ~42. Re-exported here unchanged so every
|
|
60
|
+
// existing import path (index.ts, SecurityScanner.scanners.ts,
|
|
61
|
+
// scanner-regression-guard.test.ts) keeps working AND reference identity is
|
|
62
|
+
// preserved — scanSensitivePaths classifies patterns by reference, so this
|
|
63
|
+
// re-export is load-bearing exactly like the two below it; do not remove.
|
|
64
|
+
export { ENV_PATH_PATTERN, SENSITIVE_PATH_PATTERNS, VALUE_GATED_KEYWORD_PATTERNS, PATH_FORM_PATTERNS, VALUE_GATED_ASSIGNMENT_PATTERNS, } from './patterns.sensitive-path.js';
|
|
113
65
|
// Jailbreak attempt patterns
|
|
114
66
|
// SMI-5876 Wave 1: JAILBREAK_PATTERNS and AI_DEFENCE_PATTERNS (below) moved to
|
|
115
67
|
// patterns.jailbreak.ts together with the evidence-tier classification map
|
|
@@ -125,7 +77,9 @@ export { JAILBREAK_PATTERNS, AI_DEFENCE_PATTERNS } from './patterns.jailbreak.js
|
|
|
125
77
|
export { EVIDENCE_TYPE_BY_PATTERN } from './patterns.jailbreak.evidence.js';
|
|
126
78
|
/**
|
|
127
79
|
* SMI-5876 §0.1/§0.2: bump on ANY pattern-array or evidence-table change in
|
|
128
|
-
* this module
|
|
80
|
+
* this module, patterns.jailbreak.ts, or patterns.sensitive-path.ts (SMI-5207
|
|
81
|
+
* moved the sensitive_path family there; the bump obligation moved with it).
|
|
82
|
+
* The security-audit baseline
|
|
129
83
|
* (packages/mcp-server/src/audit/security-baseline.ts /
|
|
130
84
|
* security-audit.ts) stamps every stored entry with the version that
|
|
131
85
|
* produced it and treats a mismatch as "not comparable" — forcing a re-scan
|
|
@@ -181,11 +135,21 @@ export { EVIDENCE_TYPE_BY_PATTERN } from './patterns.jailbreak.evidence.js';
|
|
|
181
135
|
* produced advisory-tier findings before. All three are the
|
|
182
136
|
* previously-clean-content-now-fires scenario this gate exists for. Scope
|
|
183
137
|
* note (unchanged from Wave 3): this forces re-evaluation of the local MCP
|
|
184
|
-
* audit baseline only (
|
|
138
|
+
* audit baseline only (this constant and its `comparable` consumer,
|
|
185
139
|
* packages/mcp-server/src/audit/security-audit.ts:219-222); the edge indexer
|
|
186
140
|
* never reads this constant, which is why it has no edge counterpart.
|
|
141
|
+
* (SMI-5207 replaced a `patterns.ts:100-125` line-range citation here — that
|
|
142
|
+
* range addressed the sensitive_path family, which moved to
|
|
143
|
+
* patterns.sensitive-path.ts, so the numbers no longer resolve.)
|
|
144
|
+
*
|
|
145
|
+
* Bumped to `2026-09-07.1`: SMI-5207 added the MF-3 (path-form
|
|
146
|
+
* action-context, negation-aware) and MF-4 (assignment-form value,
|
|
147
|
+
* default-HIGH-unless-prose) severity gates. Unlike every bump above, this
|
|
148
|
+
* one is *previously-flagged-content-now-clean* — without it, the
|
|
149
|
+
* `comparable` gate keeps reusing a stored `malicious` verdict produced by
|
|
150
|
+
* the pre-fix ruleset, and the fix never reaches an already-scanned skill.
|
|
187
151
|
*/
|
|
188
|
-
export const SCANNER_RULESET_VERSION = '2026-
|
|
152
|
+
export const SCANNER_RULESET_VERSION = '2026-09-07.1';
|
|
189
153
|
// Suspicious patterns that might indicate malicious intent
|
|
190
154
|
export const SUSPICIOUS_PATTERNS = [
|
|
191
155
|
/eval\s*\(/i,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../../../src/security/scanner/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,YAAY;IACZ,uBAAuB;IACvB,2BAA2B;IAC3B,WAAW;IACX,WAAW;IACX,oBAAoB;IACpB,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB,uBAAuB;IACvB,YAAY;IACZ,oBAAoB;CACrB,CAAA;AAED,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,sDAAsD;AACtD,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAC5E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS;IACT,cAAc;IACd,UAAU;IACV,cAAc;IACd,OAAO;IACP,QAAQ;IACR,YAAY;IACZ,YAAY;IACZ,cAAc;IACd,UAAU;IACV,cAAc;IACd,WAAW;IACX,UAAU;IACV,cAAc;CACf,CAAA;AAED,yEAAyE;AACzE,0EAA0E;AAC1E,sEAAsE;AACtE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,SAAS,CAAC,CAAA;AAE7F,sEAAsE;AACtE,4EAA4E;AAC5E,gFAAgF;AAChF,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAQ,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AAE/E
|
|
1
|
+
{"version":3,"file":"patterns.js","sourceRoot":"","sources":["../../../../src/security/scanner/patterns.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,0BAA0B;AAC1B,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,YAAY;IACZ,uBAAuB;IACvB,2BAA2B;IAC3B,WAAW;IACX,WAAW;IACX,oBAAoB;IACpB,eAAe;IACf,WAAW;IACX,iBAAiB;IACjB,uBAAuB;IACvB,YAAY;IACZ,oBAAoB;CACrB,CAAA;AAED,0EAA0E;AAC1E,0EAA0E;AAC1E,6EAA6E;AAC7E,sDAAsD;AACtD,4EAA4E;AAC5E,yEAAyE;AACzE,6EAA6E;AAC7E,4EAA4E;AAC5E,6DAA6D;AAC7D,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS;IACT,cAAc;IACd,UAAU;IACV,cAAc;I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AS;IACpD,0CAA0C,EAAE,aAAa;IACzD,iCAAiC,EAAE,kBAAkB;IACrD,kBAAkB,EAAE,iBAAiB;IAErC,4EAA4E;IAC5E,+EAA+E;IAC/E,gDAAgD;IAEhD,6BAA6B;IAC7B,uBAAuB;IAEvB,eAAe;IACf,4CAA4C;IAE5C,+BAA+B;IAC/B,qDAAqD;CACtD,CAAA;AAED,gFAAgF"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Scanner Patterns — the `sensitive_path` family
|
|
3
|
+
* @module @skillsmith/core/security/scanner/patterns.sensitive-path
|
|
4
|
+
*
|
|
5
|
+
* SMI-5207: extracted from patterns.ts, which sat 18 lines under the repo's
|
|
6
|
+
* 500-line pre-commit gate (scripts/check-file-length.mjs) before this wave —
|
|
7
|
+
* not enough headroom for the 12 hoisted pattern consts plus the two new
|
|
8
|
+
* severity-gate classification sets below (~42 lines). Same
|
|
9
|
+
* move-the-family-then-re-export convention already used twice in patterns.ts
|
|
10
|
+
* (patterns.jailbreak.ts, SMI-5876; patterns.exec.ts, SMI-6033 Wave 4).
|
|
11
|
+
*
|
|
12
|
+
* Every symbol here is re-exported unchanged from patterns.ts, so every
|
|
13
|
+
* existing import path keeps working AND reference identity is preserved —
|
|
14
|
+
* load-bearing, because scanSensitivePaths() classifies patterns by reference
|
|
15
|
+
* (`pattern === ENV_PATH_PATTERN`, `VALUE_GATED_KEYWORD_PATTERNS.has(pattern)`,
|
|
16
|
+
* and now `PATH_FORM_PATTERNS.has(pattern)` /
|
|
17
|
+
* `VALUE_GATED_ASSIGNMENT_PATTERNS.has(pattern)`).
|
|
18
|
+
*
|
|
19
|
+
* NOTE: a change to SENSITIVE_PATH_PATTERNS or to the severity classification
|
|
20
|
+
* below requires bumping SCANNER_RULESET_VERSION in patterns.ts — see that
|
|
21
|
+
* constant's own doc comment.
|
|
22
|
+
*/
|
|
23
|
+
export declare const ENV_PATH_PATTERN: RegExp;
|
|
24
|
+
export declare const SENSITIVE_PATH_PATTERNS: RegExp[];
|
|
25
|
+
export declare const VALUE_GATED_KEYWORD_PATTERNS: ReadonlySet<RegExp>;
|
|
26
|
+
/**
|
|
27
|
+
* SMI-5207 (MF-3): the 9 path/filename-form entries. HIGH only when an action
|
|
28
|
+
* verb or shell operator appears within +/-1 line of the match; otherwise
|
|
29
|
+
* MEDIUM — a bare path *mention* is the common case, so evidence is required
|
|
30
|
+
* to escalate. See scanSensitivePaths' hasPathActionContext().
|
|
31
|
+
*/
|
|
32
|
+
export declare const PATH_FORM_PATTERNS: ReadonlySet<RegExp>;
|
|
33
|
+
/**
|
|
34
|
+
* SMI-5207 (MF-4): the 3 keyword-assignment entries. HIGH BY DEFAULT —
|
|
35
|
+
* `keyword: value` is a syntactic credential-assignment shape, rare in
|
|
36
|
+
* innocent prose — downgraded to MEDIUM only on positive prose evidence about
|
|
37
|
+
* the assigned value. See scanSensitivePaths' assignmentHasRealValue().
|
|
38
|
+
*
|
|
39
|
+
* Partition check (guarded by a dedicated test): 1 (ENV) + 9 (PATH_FORM) +
|
|
40
|
+
* 3 (ASSIGNMENT) + 2 (VALUE_GATED_KEYWORD) = 15, total and disjoint. An
|
|
41
|
+
* unclassified future pattern falls through to scanSensitivePaths' fail-CLOSED
|
|
42
|
+
* `else` branch and stays HIGH.
|
|
43
|
+
*/
|
|
44
|
+
export declare const VALUE_GATED_ASSIGNMENT_PATTERNS: ReadonlySet<RegExp>;
|
|
45
|
+
//# sourceMappingURL=patterns.sensitive-path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.sensitive-path.d.ts","sourceRoot":"","sources":["../../../../src/security/scanner/patterns.sensitive-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAmCH,eAAO,MAAM,gBAAgB,QAAoE,CAAA;AA6BjG,eAAO,MAAM,uBAAuB,UAgBnC,CAAA;AAID,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,CAG3D,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAUjD,CAAA;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,MAAM,CAI9D,CAAA"}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Scanner Patterns — the `sensitive_path` family
|
|
3
|
+
* @module @skillsmith/core/security/scanner/patterns.sensitive-path
|
|
4
|
+
*
|
|
5
|
+
* SMI-5207: extracted from patterns.ts, which sat 18 lines under the repo's
|
|
6
|
+
* 500-line pre-commit gate (scripts/check-file-length.mjs) before this wave —
|
|
7
|
+
* not enough headroom for the 12 hoisted pattern consts plus the two new
|
|
8
|
+
* severity-gate classification sets below (~42 lines). Same
|
|
9
|
+
* move-the-family-then-re-export convention already used twice in patterns.ts
|
|
10
|
+
* (patterns.jailbreak.ts, SMI-5876; patterns.exec.ts, SMI-6033 Wave 4).
|
|
11
|
+
*
|
|
12
|
+
* Every symbol here is re-exported unchanged from patterns.ts, so every
|
|
13
|
+
* existing import path keeps working AND reference identity is preserved —
|
|
14
|
+
* load-bearing, because scanSensitivePaths() classifies patterns by reference
|
|
15
|
+
* (`pattern === ENV_PATH_PATTERN`, `VALUE_GATED_KEYWORD_PATTERNS.has(pattern)`,
|
|
16
|
+
* and now `PATH_FORM_PATTERNS.has(pattern)` /
|
|
17
|
+
* `VALUE_GATED_ASSIGNMENT_PATTERNS.has(pattern)`).
|
|
18
|
+
*
|
|
19
|
+
* NOTE: a change to SENSITIVE_PATH_PATTERNS or to the severity classification
|
|
20
|
+
* below requires bumping SCANNER_RULESET_VERSION in patterns.ts — see that
|
|
21
|
+
* constant's own doc comment.
|
|
22
|
+
*/
|
|
23
|
+
// Sensitive file path patterns
|
|
24
|
+
// SMI-4396 Wave 2: bare-keyword variants (credentials, secrets?, password) tightened
|
|
25
|
+
// to require assignment/path/file-extension context. Without this tuning,
|
|
26
|
+
// documentation keywords in SKILL.md frontmatter and prose (1Password integration
|
|
27
|
+
// guides, security-research skill domain vocabulary) tripped HIGH severity.
|
|
28
|
+
//
|
|
29
|
+
// SMI-5359 Wave 4 — FP-narrowing for two over-firing entries (severity policy lives
|
|
30
|
+
// in scanSensitivePaths so the array length / regression-guard baseline is unchanged):
|
|
31
|
+
// MF-1: bare /api[_-]?key/i & /auth[_-]?token/i fired HIGH on ANY substring —
|
|
32
|
+
// benign prose ("set your api_key in the dashboard"), `export API_KEY=$1`, and
|
|
33
|
+
// `apiKey: <YOUR_KEY>` placeholders. They are now VALUE-GATED: HIGH only when the
|
|
34
|
+
// line assigns a real (non-placeholder, sufficiently-entropic) secret. The
|
|
35
|
+
// value-BEARING leak is already caught at PII (PII_PATTERNS[0/2]); the
|
|
36
|
+
// credential-in-an-outbound-curl exfil is caught by DATA_EXFILTRATION_PATTERNS
|
|
37
|
+
// (the `$API_KEY`-in-a-fetched-URL pattern added there). See
|
|
38
|
+
// VALUE_GATED_KEYWORD_PATTERNS.
|
|
39
|
+
// MF-2: lone /\.env/i fired HIGH on every `.env` mention AND on the benign committed
|
|
40
|
+
// family (.envrc, .env.example/.sample/.template/.schema/.dist). ENV_PATH_PATTERN
|
|
41
|
+
// negative-lookaheads exclude that family; scanSensitivePaths downgrades a LONE
|
|
42
|
+
// `.env` to MEDIUM and keeps HIGH when it co-occurs with a read/exfil verb or
|
|
43
|
+
// shell pipe/redirect (`cat .env | curl ...`).
|
|
44
|
+
//
|
|
45
|
+
// SMI-5207 — the remaining 12 entries got the same treatment the two MF-1 keywords
|
|
46
|
+
// and the MF-2 `.env` entry already had: severity is now context-gated rather than
|
|
47
|
+
// unconditionally HIGH. MF-3 covers the 9 path-form entries (action verb or shell
|
|
48
|
+
// operator within +/-1 line), MF-4 the 3 keyword-assignment entries (HIGH unless the
|
|
49
|
+
// assigned value positively reads as prose). Both gates live in
|
|
50
|
+
// SecurityScanner.scanners.ts; this module only supplies the classification.
|
|
51
|
+
// MF-2: `.env` as a real env-file reference. Excludes `.envrc` (direnv config) and the
|
|
52
|
+
// committed placeholder family (.env.example/.sample/.template/.schema/.dist). The
|
|
53
|
+
// `(?![A-Za-z])` guard also drops the `.environment`/`.envision` English-word FP while
|
|
54
|
+
// still matching real variants like `.env`, `.env.local`, `.env.production`.
|
|
55
|
+
export const ENV_PATH_PATTERN = /\.env(?![A-Za-z])(?!\.(?:example|sample|template|schema|dist))/i;
|
|
56
|
+
// MF-1: bare credential keywords — value-gated in scanSensitivePaths, never standalone HIGH.
|
|
57
|
+
const API_KEY_KEYWORD = /api[_-]?key/i;
|
|
58
|
+
const AUTH_TOKEN_KEYWORD = /auth[_-]?token/i;
|
|
59
|
+
// SMI-5207: the 12 non-`.env` entries are hoisted from inline array literals to named
|
|
60
|
+
// consts so scanSensitivePaths can classify each by severity gate BY REFERENCE. The
|
|
61
|
+
// array's contents, order, and length (15) are unchanged — the regression-guard floor
|
|
62
|
+
// (scanner-regression-guard.test.ts) still holds.
|
|
63
|
+
// Contextual credentials: filename or assignment, not bare prose
|
|
64
|
+
const CREDENTIALS_FILE_PATTERN = /credentials\.(?:json|ya?ml|env|toml|txt)/i;
|
|
65
|
+
const CREDENTIALS_ASSIGN_PATTERN = /credentials\s*[:=]/i;
|
|
66
|
+
// Contextual secrets: assignment or path, not bare word
|
|
67
|
+
const SECRETS_ASSIGN_PATTERN = /\bsecrets?\s*[:=]/i;
|
|
68
|
+
const SECRETS_PATH_PATTERN = /\bsecrets?\/[a-z0-9_.-]+/i;
|
|
69
|
+
const PEM_PATTERN = /\.pem$/i;
|
|
70
|
+
const KEY_FILE_PATTERN = /\.key$/i;
|
|
71
|
+
const CRT_PATTERN = /\.crt$/i;
|
|
72
|
+
// Contextual password: assignment or URL (postgres://user:pass@host) only
|
|
73
|
+
const PASSWORD_ASSIGN_PATTERN = /password\s*[:=]/i;
|
|
74
|
+
const SSH_DIR_PATTERN = /~\/\.ssh/i;
|
|
75
|
+
const AWS_DIR_PATTERN = /~\/\.aws/i;
|
|
76
|
+
const CONFIG_DIR_PATTERN = /~\/\.config/i;
|
|
77
|
+
// SMI-4396 Wave 2: explicit system-file paths. Added so that tightening
|
|
78
|
+
// bare /credentials/i and /password/i into assignment-context variants
|
|
79
|
+
// doesn't drop coverage of obvious sensitive references like /etc/passwd.
|
|
80
|
+
const ETC_SYSTEM_FILE_PATTERN = /\/etc\/(?:passwd|shadow|sudoers|hosts)\b/i;
|
|
81
|
+
export const SENSITIVE_PATH_PATTERNS = [
|
|
82
|
+
ENV_PATH_PATTERN,
|
|
83
|
+
CREDENTIALS_FILE_PATTERN,
|
|
84
|
+
CREDENTIALS_ASSIGN_PATTERN,
|
|
85
|
+
SECRETS_ASSIGN_PATTERN,
|
|
86
|
+
SECRETS_PATH_PATTERN,
|
|
87
|
+
PEM_PATTERN,
|
|
88
|
+
KEY_FILE_PATTERN,
|
|
89
|
+
CRT_PATTERN,
|
|
90
|
+
PASSWORD_ASSIGN_PATTERN,
|
|
91
|
+
API_KEY_KEYWORD,
|
|
92
|
+
AUTH_TOKEN_KEYWORD,
|
|
93
|
+
SSH_DIR_PATTERN,
|
|
94
|
+
AWS_DIR_PATTERN,
|
|
95
|
+
CONFIG_DIR_PATTERN,
|
|
96
|
+
ETC_SYSTEM_FILE_PATTERN,
|
|
97
|
+
];
|
|
98
|
+
// MF-1: the two bare-keyword patterns above emit HIGH only when accompanied by a real
|
|
99
|
+
// assigned secret value; scanSensitivePaths suppresses an otherwise-bare match.
|
|
100
|
+
export const VALUE_GATED_KEYWORD_PATTERNS = new Set([
|
|
101
|
+
API_KEY_KEYWORD,
|
|
102
|
+
AUTH_TOKEN_KEYWORD,
|
|
103
|
+
]);
|
|
104
|
+
/**
|
|
105
|
+
* SMI-5207 (MF-3): the 9 path/filename-form entries. HIGH only when an action
|
|
106
|
+
* verb or shell operator appears within +/-1 line of the match; otherwise
|
|
107
|
+
* MEDIUM — a bare path *mention* is the common case, so evidence is required
|
|
108
|
+
* to escalate. See scanSensitivePaths' hasPathActionContext().
|
|
109
|
+
*/
|
|
110
|
+
export const PATH_FORM_PATTERNS = new Set([
|
|
111
|
+
CREDENTIALS_FILE_PATTERN,
|
|
112
|
+
SECRETS_PATH_PATTERN,
|
|
113
|
+
PEM_PATTERN,
|
|
114
|
+
KEY_FILE_PATTERN,
|
|
115
|
+
CRT_PATTERN,
|
|
116
|
+
SSH_DIR_PATTERN,
|
|
117
|
+
AWS_DIR_PATTERN,
|
|
118
|
+
CONFIG_DIR_PATTERN,
|
|
119
|
+
ETC_SYSTEM_FILE_PATTERN,
|
|
120
|
+
]);
|
|
121
|
+
/**
|
|
122
|
+
* SMI-5207 (MF-4): the 3 keyword-assignment entries. HIGH BY DEFAULT —
|
|
123
|
+
* `keyword: value` is a syntactic credential-assignment shape, rare in
|
|
124
|
+
* innocent prose — downgraded to MEDIUM only on positive prose evidence about
|
|
125
|
+
* the assigned value. See scanSensitivePaths' assignmentHasRealValue().
|
|
126
|
+
*
|
|
127
|
+
* Partition check (guarded by a dedicated test): 1 (ENV) + 9 (PATH_FORM) +
|
|
128
|
+
* 3 (ASSIGNMENT) + 2 (VALUE_GATED_KEYWORD) = 15, total and disjoint. An
|
|
129
|
+
* unclassified future pattern falls through to scanSensitivePaths' fail-CLOSED
|
|
130
|
+
* `else` branch and stays HIGH.
|
|
131
|
+
*/
|
|
132
|
+
export const VALUE_GATED_ASSIGNMENT_PATTERNS = new Set([
|
|
133
|
+
CREDENTIALS_ASSIGN_PATTERN,
|
|
134
|
+
SECRETS_ASSIGN_PATTERN,
|
|
135
|
+
PASSWORD_ASSIGN_PATTERN,
|
|
136
|
+
]);
|
|
137
|
+
//# sourceMappingURL=patterns.sensitive-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"patterns.sensitive-path.js","sourceRoot":"","sources":["../../../../src/security/scanner/patterns.sensitive-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,+BA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CAAC,MAAM,uBAAuB,GAAG;IACrC,gBAAgB;IAChB,wBAAwB;IACxB,0BAA0B;IAC1B,sBAAsB;IACtB,oBAAoB;IACpB,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,uBAAuB;IACvB,eAAe;IACf,kBAAkB;IAClB,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,uBAAuB;CACxB,CAAA;AAED,sFAAsF;AACtF,gFAAgF;AAChF,MAAM,CAAC,MAAM,4BAA4B,GAAwB,IAAI,GAAG,CAAC;IACvE,eAAe;IACf,kBAAkB;CACnB,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC;IAC7D,wBAAwB;IACxB,oBAAoB;IACpB,WAAW;IACX,gBAAgB;IAChB,WAAW;IACX,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,uBAAuB;CACxB,CAAC,CAAA;AAEF;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAwB,IAAI,GAAG,CAAC;IAC1E,0BAA0B;IAC1B,sBAAsB;IACtB,uBAAuB;CACxB,CAAC,CAAA"}
|
|
@@ -11,25 +11,39 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export declare const MAX_LINE_LENGTH_FOR_REGEX = 10000;
|
|
13
13
|
/**
|
|
14
|
-
* SMI-
|
|
15
|
-
* UTF-16 code units (JavaScript `string.length` — NOT bytes/code
|
|
16
|
-
* SecurityScanner.ts's content-length finding message).
|
|
14
|
+
* SMI-5879 (design §3.4): Cap for the FULL-CONTENT (multiline "pass 1") regex
|
|
15
|
+
* scan, in UTF-16 code units (JavaScript `string.length` — NOT bytes/code
|
|
16
|
+
* points; see SecurityScanner.ts's content-length finding message).
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
18
|
+
* SMI-5881 set this equal to MAX_LINE_LENGTH_FOR_REGEX (10,000) and declined
|
|
19
|
+
* to raise it, citing a doubling-based extrapolation from smaller inputs that
|
|
20
|
+
* projected "unacceptable latency well before 1,000,000" for
|
|
21
|
+
* AD_CRLF_INJECTION-class patterns. SMI-5879 independently re-measured
|
|
22
|
+
* directly at 1,000,000 (not extrapolated) across the 7 ported multiline
|
|
23
|
+
* patterns (AD_CRLF_INJECTION, AD_ROLE_MARKER_BARE, AD_HTML_COMMENT_VERB/NOUN,
|
|
24
|
+
* AD_DELIMITER_BARE, AD_AN2_ROLE_BODY_NEXT_LINE, JB_JS3A/JS3B) against
|
|
25
|
+
* per-pattern adversarial near-miss shapes (not just the CRLF-pair shape
|
|
26
|
+
* SMI-5881 used) and found linear scaling with a worst case of ~56ms at
|
|
27
|
+
* 1,000,000 chars (AD_HTML_COMMENT_NOUN, "repeated HTML-comment-open"
|
|
28
|
+
* near-miss) — confirmed still linear (not superlinear) up to 4,000,000
|
|
29
|
+
* chars (~145ms), comfortably under the section 7.3 250ms per-case budget.
|
|
30
|
+
* The prior extrapolation does not hold empirically at this exact size; the
|
|
31
|
+
* measured worst case has real headroom, just less than the ~78x this
|
|
32
|
+
* design doc's own (unverified) claim asserted. Raising this cap closes the
|
|
33
|
+
* 10 KB pass-1 truncation blind spot (design §3.4) — the edge's own
|
|
34
|
+
* MAX_SKILL_CONTENT_SIZE is 1,000,000 bytes, so pass 1 previously saw only
|
|
35
|
+
* the first 1% of a large SKILL.md.
|
|
36
|
+
*
|
|
37
|
+
* Still declared separately from MAX_LINE_LENGTH_FOR_REGEX because the two
|
|
38
|
+
* caps protect different scan passes (per-line vs whole-document) and may
|
|
39
|
+
* need to diverge again. See SecurityScanner.ts's `effectiveMultilineLimit`
|
|
40
|
+
* (`Math.min(MAX_CONTENT_LENGTH_FOR_REGEX, maxContentLength)`) for how this
|
|
41
|
+
* interacts with the per-tier content-length ceiling — a trust tier with a
|
|
42
|
+
* SMALLER configured `maxContentLength` still tightens the effective limit
|
|
43
|
+
* below this cap; none currently need MORE than this cap for the multiline
|
|
44
|
+
* pass specifically.
|
|
31
45
|
*/
|
|
32
|
-
export declare const MAX_CONTENT_LENGTH_FOR_REGEX =
|
|
46
|
+
export declare const MAX_CONTENT_LENGTH_FOR_REGEX = 1000000;
|
|
33
47
|
/**
|
|
34
48
|
* SMI-882: Safe regex test with length limit
|
|
35
49
|
* Applies input length limit before regex matching to prevent ReDoS attacks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex-utils.d.ts","sourceRoot":"","sources":["../../../../src/security/scanner/regex-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,QAAQ,CAAA;AAE9C
|
|
1
|
+
{"version":3,"file":"regex-utils.d.ts","sourceRoot":"","sources":["../../../../src/security/scanner/regex-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,QAAQ,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,4BAA4B,UAAY,CAAA;AAErD;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAkC,GAC5C,gBAAgB,GAAG,IAAI,CAIzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAkC,GAC5C,OAAO,CAIT"}
|
|
@@ -11,25 +11,39 @@
|
|
|
11
11
|
*/
|
|
12
12
|
export const MAX_LINE_LENGTH_FOR_REGEX = 10000;
|
|
13
13
|
/**
|
|
14
|
-
* SMI-
|
|
15
|
-
* UTF-16 code units (JavaScript `string.length` — NOT bytes/code
|
|
16
|
-
* SecurityScanner.ts's content-length finding message).
|
|
14
|
+
* SMI-5879 (design §3.4): Cap for the FULL-CONTENT (multiline "pass 1") regex
|
|
15
|
+
* scan, in UTF-16 code units (JavaScript `string.length` — NOT bytes/code
|
|
16
|
+
* points; see SecurityScanner.ts's content-length finding message).
|
|
17
17
|
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* (
|
|
24
|
-
*
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
18
|
+
* SMI-5881 set this equal to MAX_LINE_LENGTH_FOR_REGEX (10,000) and declined
|
|
19
|
+
* to raise it, citing a doubling-based extrapolation from smaller inputs that
|
|
20
|
+
* projected "unacceptable latency well before 1,000,000" for
|
|
21
|
+
* AD_CRLF_INJECTION-class patterns. SMI-5879 independently re-measured
|
|
22
|
+
* directly at 1,000,000 (not extrapolated) across the 7 ported multiline
|
|
23
|
+
* patterns (AD_CRLF_INJECTION, AD_ROLE_MARKER_BARE, AD_HTML_COMMENT_VERB/NOUN,
|
|
24
|
+
* AD_DELIMITER_BARE, AD_AN2_ROLE_BODY_NEXT_LINE, JB_JS3A/JS3B) against
|
|
25
|
+
* per-pattern adversarial near-miss shapes (not just the CRLF-pair shape
|
|
26
|
+
* SMI-5881 used) and found linear scaling with a worst case of ~56ms at
|
|
27
|
+
* 1,000,000 chars (AD_HTML_COMMENT_NOUN, "repeated HTML-comment-open"
|
|
28
|
+
* near-miss) — confirmed still linear (not superlinear) up to 4,000,000
|
|
29
|
+
* chars (~145ms), comfortably under the section 7.3 250ms per-case budget.
|
|
30
|
+
* The prior extrapolation does not hold empirically at this exact size; the
|
|
31
|
+
* measured worst case has real headroom, just less than the ~78x this
|
|
32
|
+
* design doc's own (unverified) claim asserted. Raising this cap closes the
|
|
33
|
+
* 10 KB pass-1 truncation blind spot (design §3.4) — the edge's own
|
|
34
|
+
* MAX_SKILL_CONTENT_SIZE is 1,000,000 bytes, so pass 1 previously saw only
|
|
35
|
+
* the first 1% of a large SKILL.md.
|
|
36
|
+
*
|
|
37
|
+
* Still declared separately from MAX_LINE_LENGTH_FOR_REGEX because the two
|
|
38
|
+
* caps protect different scan passes (per-line vs whole-document) and may
|
|
39
|
+
* need to diverge again. See SecurityScanner.ts's `effectiveMultilineLimit`
|
|
40
|
+
* (`Math.min(MAX_CONTENT_LENGTH_FOR_REGEX, maxContentLength)`) for how this
|
|
41
|
+
* interacts with the per-tier content-length ceiling — a trust tier with a
|
|
42
|
+
* SMALLER configured `maxContentLength` still tightens the effective limit
|
|
43
|
+
* below this cap; none currently need MORE than this cap for the multiline
|
|
44
|
+
* pass specifically.
|
|
31
45
|
*/
|
|
32
|
-
export const MAX_CONTENT_LENGTH_FOR_REGEX =
|
|
46
|
+
export const MAX_CONTENT_LENGTH_FOR_REGEX = 1_000_000;
|
|
33
47
|
/**
|
|
34
48
|
* SMI-882: Safe regex test with length limit
|
|
35
49
|
* Applies input length limit before regex matching to prevent ReDoS attacks.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regex-utils.js","sourceRoot":"","sources":["../../../../src/security/scanner/regex-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAA;AAE9C
|
|
1
|
+
{"version":3,"file":"regex-utils.js","sourceRoot":"","sources":["../../../../src/security/scanner/regex-utils.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,CAAA;AAE9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAG,SAAS,CAAA;AAErD;;;;;;;;GAQG;AACH,MAAM,UAAU,aAAa,CAC3B,OAAe,EACf,KAAa,EACb,YAAoB,yBAAyB;IAE7C,2DAA2D;IAC3D,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC9E,OAAO,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AACjC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,OAAe,EACf,KAAa,EACb,YAAoB,yBAAyB;IAE7C,2DAA2D;IAC3D,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA;IAC9E,OAAO,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAA;AAChC,CAAC"}
|
|
@@ -117,6 +117,15 @@ export interface ScanReport {
|
|
|
117
117
|
riskScore: number;
|
|
118
118
|
/** Breakdown of risk score by category */
|
|
119
119
|
riskBreakdown: RiskScoreBreakdown;
|
|
120
|
+
/**
|
|
121
|
+
* SMI-5879 (design §3.3.6): true when the jailbreak or ai_defence multiline
|
|
122
|
+
* pass hit its per-pattern iteration ceiling before exhausting matches on a
|
|
123
|
+
* pathological same-line-repetition input. NOT provably score-neutral — the
|
|
124
|
+
* write path must treat this scan as authoritative for RAISING a verdict
|
|
125
|
+
* only, never for lowering an existing quarantine. Absent/undefined is
|
|
126
|
+
* equivalent to `false` (not truncated) for gating purposes.
|
|
127
|
+
*/
|
|
128
|
+
multilineTruncated?: boolean;
|
|
120
129
|
}
|
|
121
130
|
/**
|
|
122
131
|
* Verdict returned by comparing two scans of the SAME skill to detect a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/security/scanner/types.ts"],"names":[],"mappings":"A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;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE,MAAM,CAAA;IACjB,iBAAiB,EAAE,MAAM,CAAA;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,gBAAgB,EAAE,MAAM,CAAA;IACxB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,aAAa,EAAE,MAAM,CAAA;IACrB,mBAAmB,EAAE,MAAM,CAAA;IAC3B,SAAS,EAAE,MAAM,CAAA;IACjB,gBAAgB,EAAE,MAAM,CAAA;IACxB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;CAC1B;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAA;IACf,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,eAAe,EAAE,CAAA;IAC3B,SAAS,EAAE,IAAI,CAAA;IACf,cAAc,EAAE,MAAM,CAAA;IACtB,0EAA0E;IAC1E,SAAS,EAAE,MAAM,CAAA;IACjB,0CAA0C;IAC1C,aAAa,EAAE,kBAAkB,CAAA;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/security/scanner/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,KAAK,GACL,gBAAgB,GAChB,WAAW,GACX,oBAAoB,GACpB,oBAAoB,GACpB,gBAAgB,GAChB,mBAAmB,GACnB,sBAAsB,GACtB,YAAY,GACZ,MAAM,GACN,KAAK,GACL,gBAAgB,GAChB,sBAAsB,GACtB,WAAW,GACX,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,4DAA4D;IAC5D,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,sEAAsE;IACtE,wBAAwB,CAAC,EAAE,wBAAwB,CAAA;CACpD"}
|
|
@@ -5,6 +5,7 @@ export { logger, createLogger, silentLogger, type Logger } from './logger.js';
|
|
|
5
5
|
export { withRetry, fetchWithRetry, isTransientError, isRetryableStatus, parseRetryAfter, RetryExhaustedError, DEFAULT_RETRY_CONFIG, type RetryConfig, } from './retry.js';
|
|
6
6
|
export { checkForUpdates, formatUpdateNotification, agentInstallRemediationCommand, checkCursorMcpArtifact, type VersionCheckResult, type CursorMcpArtifactCheck, } from './version-check.js';
|
|
7
7
|
export { parseRepoUrl, isGitHubUrl, type ParsedRepoUrl } from './github-url.js';
|
|
8
|
+
export { VALID_SKILL_NAME_RE, validateSkillName } from './skill-name.js';
|
|
8
9
|
export { safeWriteFile, SymlinkError, HardlinkError } from './safe-fs.js';
|
|
9
10
|
export { isQuietModeEnabled } from './quiet-mode.js';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/E,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAKzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAE,KAAK,MAAM,EAAE,MAAM,aAAa,CAAA;AAC7E,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,KAAK,WAAW,GACjB,MAAM,YAAY,CAAA;AAGnB,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,EACtB,KAAK,kBAAkB,EACvB,KAAK,sBAAsB,GAC5B,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAG/E,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAGxE,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAKzE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/src/utils/index.js
CHANGED
|
@@ -7,6 +7,8 @@ export { withRetry, fetchWithRetry, isTransientError, isRetryableStatus, parseRe
|
|
|
7
7
|
export { checkForUpdates, formatUpdateNotification, agentInstallRemediationCommand, checkCursorMcpArtifact, } from './version-check.js';
|
|
8
8
|
// SMI-2171: GitHub URL parsing utilities
|
|
9
9
|
export { parseRepoUrl, isGitHubUrl } from './github-url.js';
|
|
10
|
+
// Shared skill name validation (relocated from @skillsmith/cli — canonical here now)
|
|
11
|
+
export { VALID_SKILL_NAME_RE, validateSkillName } from './skill-name.js';
|
|
10
12
|
// SMI-2274: Safe filesystem operations (symlink protection)
|
|
11
13
|
export { safeWriteFile, SymlinkError, HardlinkError } from './safe-fs.js';
|
|
12
14
|
// SMI-5897 (C-18/C-19, Wave 4 fix): shared SKILLSMITH_QUIET guard — used by
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAe,MAAM,aAAa,CAAA;AAC7E,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,YAAY,CAAA;AAEnB,wDAAwD;AACxD,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,GAGvB,MAAM,oBAAoB,CAAA;AAE3B,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AAE/E,4DAA4D;AAC5D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEzE,4EAA4E;AAC5E,sEAAsE;AACtE,6EAA6E;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,EAAe,MAAM,aAAa,CAAA;AAC7E,OAAO,EACL,SAAS,EACT,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GAErB,MAAM,YAAY,CAAA;AAEnB,wDAAwD;AACxD,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,sBAAsB,GAGvB,MAAM,oBAAoB,CAAA;AAE3B,yCAAyC;AACzC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAsB,MAAM,iBAAiB,CAAA;AAE/E,qFAAqF;AACrF,OAAO,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAA;AAExE,4DAA4D;AAC5D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAEzE,4EAA4E;AAC5E,sEAAsE;AACtE,6EAA6E;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared skill name validation utilities.
|
|
3
|
+
*
|
|
4
|
+
* Used by both `skillsmith author init` and `skillsmith create` to enforce
|
|
5
|
+
* a consistent, registry-safe naming convention across all scaffolding paths.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Valid skill names: lowercase letters, digits, and hyphens only.
|
|
9
|
+
* Must start with a lowercase letter.
|
|
10
|
+
* Matches the Skillsmith registry slug format.
|
|
11
|
+
*/
|
|
12
|
+
export declare const VALID_SKILL_NAME_RE: RegExp;
|
|
13
|
+
/**
|
|
14
|
+
* Validate a skill name against the canonical Skillsmith naming convention.
|
|
15
|
+
*
|
|
16
|
+
* @returns `true` if valid, or a string error message if invalid.
|
|
17
|
+
*/
|
|
18
|
+
export declare function validateSkillName(name: string): true | string;
|
|
19
|
+
//# sourceMappingURL=skill-name.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skill-name.d.ts","sourceRoot":"","sources":["../../../src/utils/skill-name.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,QAAsB,CAAA;AAEtD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAM7D"}
|