skillscout 0.1.0 → 0.1.1
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 +12 -0
- package/dist/fetchSkill.js +1 -1
- package/dist/sanitize.js +1 -1
- package/dist/scan/llm.js +3 -0
- package/dist/scan/rules.js +1 -1
- package/dist/verdict.js +40 -0
- package/dist/vetMcp.js +9 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -51,6 +51,18 @@ It scans `./.claude/skills` by default; pass directories to scan others (for exa
|
|
|
51
51
|
- **review**: a high or medium rating from the model review or partner audits, or code that hasn't had a model review. Plugins with hooks always need review.
|
|
52
52
|
- **allow**: anything else. "Allow" means nothing raised a flag. It is not proof of safety.
|
|
53
53
|
|
|
54
|
+
**One exception, for MCP package code only.** A clean model review can lower a static **block** to **review**, never to allow. Security tools, skillscout included, contain the very patterns the rules look for, and a model can tell a detection signature from a payload. All of these must hold:
|
|
55
|
+
- the review rated the package `safe` or `low`
|
|
56
|
+
- the review found that the behavior matches the description, and raised no high finding of its own
|
|
57
|
+
- every blocking finding is in a code file the reviewer actually read
|
|
58
|
+
|
|
59
|
+
The exception never applies to:
|
|
60
|
+
- skills or plugins
|
|
61
|
+
- findings in markdown or remote tool descriptions
|
|
62
|
+
- known malware (OSV), hidden Unicode, or bundled binaries
|
|
63
|
+
|
|
64
|
+
The verdict says when this happened.
|
|
65
|
+
|
|
54
66
|
Rules grade each hit in context. For example, `curl https://vendor… | bash` in a skill's setup docs is medium. The same pattern is critical from a raw IP, over plain http, from a paste site, or inside a script. Findings in files the agent never loads are capped at low/medium: package READMEs, and a plugin's tests and docs. A skill's own markdown is not capped, because it *is* the agent's instructions.
|
|
55
67
|
|
|
56
68
|
## How accurate is it?
|
package/dist/fetchSkill.js
CHANGED
|
@@ -97,7 +97,7 @@ async function locateSkillDir(ref, sha, tree) {
|
|
|
97
97
|
throw new Error(`Could not find a skill named "${ref.skill}" in ${ref.owner}/${ref.repo}`);
|
|
98
98
|
}
|
|
99
99
|
export function parseFrontmatter(text) {
|
|
100
|
-
const m = text.match(
|
|
100
|
+
const m = text.match(/^\uFEFF?---\r?\n([\s\S]*?)\r?\n---/);
|
|
101
101
|
if (!m)
|
|
102
102
|
return {};
|
|
103
103
|
try {
|
package/dist/sanitize.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
const CONTROL = /[\u0000-\u0008\u000B-\u001F\u007F-\u009F]/g;
|
|
11
11
|
const ANSI = /\u001B\[[0-?]*[ -/]*[@-~]|\u001B\][^\u0007]*(\u0007|\u001B\\)/g;
|
|
12
12
|
// Zero-width, bidi controls, BOM, word joiner etc.
|
|
13
|
-
export const INVISIBLE = /[
|
|
13
|
+
export const INVISIBLE = /[\u200B-\u200F\u202A-\u202E\u2060-\u2064\u2066-\u2069\uFEFF\u00AD\u180E]|\uDB40[\uDC00-\uDC7F]/g;
|
|
14
14
|
export function sanitize(text, maxLen = 300) {
|
|
15
15
|
if (text === null || text === undefined)
|
|
16
16
|
return "";
|
package/dist/scan/llm.js
CHANGED
|
@@ -80,6 +80,7 @@ export async function llmReview(input) {
|
|
|
80
80
|
const close = `</untrusted_file_${nonce}>`;
|
|
81
81
|
let body = "";
|
|
82
82
|
let truncated = false;
|
|
83
|
+
const reviewedFiles = [];
|
|
83
84
|
for (const f of input.files) {
|
|
84
85
|
if (f.content.subarray(0, 8000).includes(0))
|
|
85
86
|
continue; // binaries are covered by static rules
|
|
@@ -90,6 +91,7 @@ export async function llmReview(input) {
|
|
|
90
91
|
break;
|
|
91
92
|
}
|
|
92
93
|
body += chunk;
|
|
94
|
+
reviewedFiles.push(f.path);
|
|
93
95
|
}
|
|
94
96
|
const user = `Extension kind: ${input.kind}
|
|
95
97
|
Stated name: ${sanitize(input.name, 100)}
|
|
@@ -128,6 +130,7 @@ Review the extension above according to your rules and return the JSON verdict.`
|
|
|
128
130
|
matchesDescription: out.matches_description,
|
|
129
131
|
findings,
|
|
130
132
|
reason: truncated ? "Some files were omitted for length." : undefined,
|
|
133
|
+
reviewedFiles,
|
|
131
134
|
};
|
|
132
135
|
}
|
|
133
136
|
catch (e) {
|
package/dist/scan/rules.js
CHANGED
|
@@ -117,7 +117,7 @@ export function scanFiles(files) {
|
|
|
117
117
|
const text = f.content.toString("utf8");
|
|
118
118
|
const isMd = MARKDOWN.test(f.path);
|
|
119
119
|
// Hidden characters: the classic way to smuggle instructions past a human reviewer.
|
|
120
|
-
const invisible = describeInvisible(text.replace(
|
|
120
|
+
const invisible = describeInvisible(text.replace(/^\uFEFF/, ""));
|
|
121
121
|
if (invisible.length) {
|
|
122
122
|
const sev = invisible.some((c) => /^U\+(202[A-E]|206[6-9]|E00)/.test(c)) ? "high" : "medium";
|
|
123
123
|
findings.push({ rule: "hidden-unicode", severity: sev, file: f.path, message: "Contains invisible/bidi control characters", excerpt: invisible.slice(0, 8).join(" ") });
|
package/dist/verdict.js
CHANGED
|
@@ -18,6 +18,34 @@ export function normalizePartnerRisk(a) {
|
|
|
18
18
|
return "high";
|
|
19
19
|
return "unknown";
|
|
20
20
|
}
|
|
21
|
+
/** Signals a model review never overrules. */
|
|
22
|
+
const NEVER_DOWNGRADE = new Set(["known-malicious-package", "hidden-unicode", "bundled-binary"]);
|
|
23
|
+
const DOC_FILE = /\.(md|mdx|markdown|txt)$/i;
|
|
24
|
+
/** Why a static block may not be downgraded, or undefined if it may. */
|
|
25
|
+
export function downgradeBlocker(input) {
|
|
26
|
+
const llm = input.llm;
|
|
27
|
+
if (!input.reviewMayDowngradeStatic)
|
|
28
|
+
return "not packaged code";
|
|
29
|
+
if (llm.status !== "ok")
|
|
30
|
+
return "no model review";
|
|
31
|
+
if (llm.risk !== "safe" && llm.risk !== "low")
|
|
32
|
+
return `model review rated it ${llm.risk}`;
|
|
33
|
+
if (llm.matchesDescription === false)
|
|
34
|
+
return "behavior does not match the description";
|
|
35
|
+
if ((llm.findings ?? []).some((f) => f.severity === "high" || f.severity === "critical"))
|
|
36
|
+
return "model review raised its own high finding";
|
|
37
|
+
const blocking = input.staticFindings.filter((f) => f.severity === "critical" || f.severity === "high");
|
|
38
|
+
const seen = new Set(llm.reviewedFiles ?? []);
|
|
39
|
+
for (const f of blocking) {
|
|
40
|
+
if (NEVER_DOWNGRADE.has(f.rule))
|
|
41
|
+
return `${f.rule} is never overruled`;
|
|
42
|
+
if (DOC_FILE.test(f.file))
|
|
43
|
+
return `finding in ${f.file}, which is documentation or a tool description`;
|
|
44
|
+
if (!seen.has(f.file))
|
|
45
|
+
return `${f.file} was not part of the model review`;
|
|
46
|
+
}
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
21
49
|
/**
|
|
22
50
|
* Policy:
|
|
23
51
|
* - any critical signal, or a high static finding -> block
|
|
@@ -96,6 +124,18 @@ export function decide(input) {
|
|
|
96
124
|
review = true;
|
|
97
125
|
reasons.push(r);
|
|
98
126
|
}
|
|
127
|
+
if (block) {
|
|
128
|
+
const blockedByStaticOnly = !(llm.status === "ok" && llm.risk === "critical") &&
|
|
129
|
+
!input.partnerAudits.some((a) => normalizePartnerRisk(a) === "critical") &&
|
|
130
|
+
input.staticFindings.some((f) => f.severity === "critical" || f.severity === "high");
|
|
131
|
+
if (blockedByStaticOnly && downgradeBlocker(input) === undefined) {
|
|
132
|
+
block = false;
|
|
133
|
+
review = true;
|
|
134
|
+
risk = "medium";
|
|
135
|
+
reasons.push(`Lowered from block to review: the static rules matched in package code, but the separate model review read those files and rated the package ${llm.risk}. ` +
|
|
136
|
+
"This is common for security tools, whose detection patterns contain the strings they look for. Check the static findings before installing.");
|
|
137
|
+
}
|
|
138
|
+
}
|
|
99
139
|
const verdict = block ? "block" : review ? "review" : "allow";
|
|
100
140
|
if (verdict === "allow")
|
|
101
141
|
reasons.push("No checks raised a flag. This is not proof of safety.");
|
package/dist/vetMcp.js
CHANGED
|
@@ -134,7 +134,15 @@ export async function vetMcp(name, opts = {}) {
|
|
|
134
134
|
const llm = files.length
|
|
135
135
|
? await llmReview({ kind: "mcp", name: entry.name, description: entry.description ?? "", files: reviewFiles })
|
|
136
136
|
: { status: "skipped", reason: "No source or tool descriptions available to review." };
|
|
137
|
-
const { verdict, risk, reasons } = decide({
|
|
137
|
+
const { verdict, risk, reasons } = decide({
|
|
138
|
+
staticFindings: findings,
|
|
139
|
+
llm,
|
|
140
|
+
partnerAudits: [],
|
|
141
|
+
hasCode,
|
|
142
|
+
reviewReasons,
|
|
143
|
+
// Package source only. Remote servers have tool descriptions (markdown), which never downgrade anyway.
|
|
144
|
+
reviewMayDowngradeStatic: true,
|
|
145
|
+
});
|
|
138
146
|
const result = {
|
|
139
147
|
kind: "mcp",
|
|
140
148
|
id: entry.name,
|