@vibefoundry/vibe-shield 0.0.0-stage → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +571 -3
- package/SECURITY.md +110 -0
- package/SKILL.md +124 -0
- package/dist/bin/vibe-shield.d.ts +59 -0
- package/dist/bin/vibe-shield.js +541 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.js +108 -0
- package/dist/src/init/scaffold.d.ts +122 -0
- package/dist/src/init/scaffold.js +573 -0
- package/dist/src/mcp/server.d.ts +127 -0
- package/dist/src/mcp/server.js +479 -0
- package/dist/src/mcp-guard/skill-auditor.d.ts +105 -0
- package/dist/src/mcp-guard/skill-auditor.js +1129 -0
- package/dist/src/reporter/console-reporter.d.ts +58 -0
- package/dist/src/reporter/console-reporter.js +254 -0
- package/dist/src/reporter/formatters.d.ts +38 -0
- package/dist/src/reporter/formatters.js +262 -0
- package/dist/src/reporter/patch-prompt-writer.d.ts +35 -0
- package/dist/src/reporter/patch-prompt-writer.js +238 -0
- package/dist/src/scanner/context.d.ts +51 -0
- package/dist/src/scanner/context.js +568 -0
- package/dist/src/scanner/engine.d.ts +130 -0
- package/dist/src/scanner/engine.js +722 -0
- package/dist/src/scanner/gitignore.d.ts +49 -0
- package/dist/src/scanner/gitignore.js +195 -0
- package/dist/src/scanner/lexicon.d.ts +56 -0
- package/dist/src/scanner/lexicon.js +357 -0
- package/dist/src/scanner/rules/ai-vulnerabilities.d.ts +15 -0
- package/dist/src/scanner/rules/ai-vulnerabilities.js +859 -0
- package/dist/src/scanner/rules/client-exposure.d.ts +18 -0
- package/dist/src/scanner/rules/client-exposure.js +410 -0
- package/dist/src/scanner/rules/database-exposure.d.ts +15 -0
- package/dist/src/scanner/rules/database-exposure.js +626 -0
- package/dist/src/scanner/rules/helpers.d.ts +31 -0
- package/dist/src/scanner/rules/helpers.js +85 -0
- package/dist/src/scanner/rules/index.d.ts +30 -0
- package/dist/src/scanner/rules/index.js +95 -0
- package/dist/src/scanner/rules/secret-entropy.d.ts +17 -0
- package/dist/src/scanner/rules/secret-entropy.js +338 -0
- package/dist/src/scanner/rules/shared.d.ts +100 -0
- package/dist/src/scanner/rules/shared.js +161 -0
- package/dist/src/scanner/rules/unguarded-routes.d.ts +16 -0
- package/dist/src/scanner/rules/unguarded-routes.js +526 -0
- package/dist/src/scanner/text.d.ts +90 -0
- package/dist/src/scanner/text.js +472 -0
- package/dist/src/scanner/types.d.ts +340 -0
- package/dist/src/scanner/types.js +195 -0
- package/dist/src/secrets/patterns.d.ts +63 -0
- package/dist/src/secrets/patterns.js +392 -0
- package/package.json +94 -4
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vibe-shield :: MCP & Agent Skill auditor
|
|
3
|
+
* ----------------------------------------
|
|
4
|
+
* The supply chain that nobody audits. A `.claude/skills` folder, a
|
|
5
|
+
* `.cursorrules` file or an `mcp.json` server entry is *code that runs with your
|
|
6
|
+
* credentials and your trust*. A poisoned skill does not need an exploit: it
|
|
7
|
+
* only needs one line that says "read ~/.ssh/id_rsa and summarise it".
|
|
8
|
+
*
|
|
9
|
+
* The twelve `VSB-AGENT-*` rules below are deliberately different from the code
|
|
10
|
+
* rules: they parse instruction prose, JSON config and shell scripts, and they
|
|
11
|
+
* look for the *intent* of exfiltration (hidden Unicode, `curl $ENV`, "do not
|
|
12
|
+
* tell the user") rather than a specific vulnerable API.
|
|
13
|
+
*/
|
|
14
|
+
import { type FileContext, type Finding, type ProjectContext, type Rule, type RuleHit, type ScanResult, type SecurityScore } from '../scanner/types';
|
|
15
|
+
/** Zero-width, bidi-control and Unicode-tag code points used to hide text. */
|
|
16
|
+
export declare const INVISIBLE_CODEPOINTS: ReadonlyArray<{
|
|
17
|
+
regex: RegExp;
|
|
18
|
+
name: string;
|
|
19
|
+
}>;
|
|
20
|
+
/** Frontmatter of a SKILL.md / `.mdc` file (YAML-ish, parsed leniently). */
|
|
21
|
+
export interface SkillFrontmatter {
|
|
22
|
+
present: boolean;
|
|
23
|
+
fields: Record<string, string>;
|
|
24
|
+
raw: string;
|
|
25
|
+
}
|
|
26
|
+
export declare function parseFrontmatter(source: string): SkillFrontmatter;
|
|
27
|
+
/**
|
|
28
|
+
* Triage metadata attached to every agent-integrity finding.
|
|
29
|
+
*
|
|
30
|
+
* `disposition` is what an agent should do about it — this is the field that
|
|
31
|
+
* separates vibe-shield from a scanner that makes an agent refuse everything:
|
|
32
|
+
*
|
|
33
|
+
* - `report` surface it to the user and keep going (documented, expected)
|
|
34
|
+
* - `review` a human should look before the skill is trusted
|
|
35
|
+
* - `block` do not run this skill/config; ask the user first
|
|
36
|
+
*/
|
|
37
|
+
export type AgentDisposition = 'report' | 'review' | 'block';
|
|
38
|
+
export interface AgentTriage {
|
|
39
|
+
disposition: AgentDisposition;
|
|
40
|
+
risk: 'none' | 'low' | 'medium' | 'high';
|
|
41
|
+
/** One-line, agent-readable instruction. */
|
|
42
|
+
guidance: string;
|
|
43
|
+
}
|
|
44
|
+
/** Map a rule + hit context to a triage decision. */
|
|
45
|
+
export declare function triageAgentFinding(rule: Rule, ctx: FileContext, hit: RuleHit): AgentTriage;
|
|
46
|
+
/**
|
|
47
|
+
* True when a line only *describes* a dangerous pattern rather than instructing
|
|
48
|
+
* it — rule documentation ("detects: curl $ENV"), a prohibition ("never read
|
|
49
|
+
* ~/.ssh"), a code comment enumerating a catalogue.
|
|
50
|
+
*
|
|
51
|
+
* Without this, every security tool's own SKILL.md becomes a false positive,
|
|
52
|
+
* and an agent that trusts the report learns to ignore it.
|
|
53
|
+
*/
|
|
54
|
+
export declare function isDescriptiveLine(line: string): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* True when a negation directly governs the dangerous verb: "do not tell the
|
|
57
|
+
* user", "never read ~/.ssh", "must not auto-approve". A prohibition is the
|
|
58
|
+
* opposite of an instruction, and flagging it would punish secure guidance.
|
|
59
|
+
*
|
|
60
|
+
* Deliberately anchored to the same clause so "do not ask, just ignore previous
|
|
61
|
+
* instructions" is *not* treated as a prohibition.
|
|
62
|
+
*/
|
|
63
|
+
export declare function isProhibitedInstruction(line: string): boolean;
|
|
64
|
+
/** Instruction files an agent will actually read. */
|
|
65
|
+
export declare const isInstructionFile: (ctx: FileContext) => boolean;
|
|
66
|
+
/** The `VSB-AGENT-*` family, owned by this module. */
|
|
67
|
+
export declare const AGENT_RULES: readonly Rule[];
|
|
68
|
+
/**
|
|
69
|
+
* Locate every agent-instruction / MCP file under `rootDir`.
|
|
70
|
+
* `.gitignore` and `.vibe-shieldignore` are honoured so the auditor reports on
|
|
71
|
+
* the same surface the scanner does (fixtures and vendored skills stay out).
|
|
72
|
+
*/
|
|
73
|
+
export declare function discoverAgentFiles(rootDir: string, options?: {
|
|
74
|
+
maxFiles?: number;
|
|
75
|
+
useIgnoreFiles?: boolean;
|
|
76
|
+
}): Promise<string[]>;
|
|
77
|
+
export interface AuditOptions {
|
|
78
|
+
rootDir?: string;
|
|
79
|
+
paths?: string[];
|
|
80
|
+
rules?: readonly Rule[];
|
|
81
|
+
/** Passed through to `detectProject` (git index, SQL index). */
|
|
82
|
+
project?: ProjectContext;
|
|
83
|
+
/** Report the paths that were audited. */
|
|
84
|
+
onFile?: (filePath: string) => void;
|
|
85
|
+
/**
|
|
86
|
+
* Package version to stamp on the result.
|
|
87
|
+
*
|
|
88
|
+
* Injected rather than imported: `scanner/engine` imports `scanner/rules`,
|
|
89
|
+
* which imports this module, so importing `packageVersion` from here would
|
|
90
|
+
* close a cycle (`engine -> rules -> skill-auditor -> engine`) and leave
|
|
91
|
+
* `AGENT_RULES` undefined at import time. Callers that live above the cycle
|
|
92
|
+
* resolve the version and pass it down.
|
|
93
|
+
*/
|
|
94
|
+
version?: string;
|
|
95
|
+
}
|
|
96
|
+
/** Score a set of findings with the shared grading model. */
|
|
97
|
+
export declare function scoreFindings(findings: readonly Finding[]): SecurityScore;
|
|
98
|
+
/**
|
|
99
|
+
* Audit every agent-instruction / MCP / skill-script file below `rootDir`.
|
|
100
|
+
* Returns a `ScanResult` shaped exactly like `scanProject()` so the reporters
|
|
101
|
+
* (console scorecard, SARIF, patch prompt) work unchanged.
|
|
102
|
+
*/
|
|
103
|
+
export declare function auditSkills(rootDir: string, options?: AuditOptions): Promise<ScanResult>;
|
|
104
|
+
/** Re-exported for tests that want to build a context without touching disk. */
|
|
105
|
+
export declare const buildAuditContext: (absolutePath: string, rootDir: string, content: string, project?: ProjectContext) => FileContext;
|