@hungpg/skill-audit 0.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/README.md ADDED
@@ -0,0 +1,124 @@
1
+ # skill-audit
2
+
3
+ Security auditing CLI for AI agent skills.
4
+
5
+ ## Features
6
+
7
+ - **Static Analysis**: Detect prompt injection, dangerous scripts, hardcoded secrets
8
+ - **Dependency Scanning**: Uses Trivy to scan for known vulnerabilities in dependencies
9
+ - **Risk Scoring**: 0-10 score mapped to OWASP Agentic Top 10 (ASI01-ASI10)
10
+ - **Multi-Agent Support**: Groups results by agent (Claude Code, Qwen Code, Gemini CLI, etc.)
11
+ - **CI/CD Ready**: JSON output, threshold-based pass/fail
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ cd skill-audit
17
+ npm install
18
+ npm run build
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ```bash
24
+ # Audit global skills
25
+ npx skill-audit -g
26
+
27
+ # Audit with verbose output
28
+ npx skill-audit -v
29
+
30
+ # JSON output for CI
31
+ npx skill-audit --json > audit-results.json
32
+
33
+ # Fail if risk score exceeds threshold
34
+ npx skill-audit --threshold 5.0
35
+
36
+ # Skip dependency scanning (faster)
37
+ npx skill-audit --no-deps
38
+
39
+ # Filter by agent
40
+ npx skill-audit -a "Claude Code" "Qwen Code"
41
+
42
+ # Project-level skills only
43
+ npx skill-audit --project
44
+
45
+ # Lint mode (spec validation only)
46
+ npx skill-audit --mode lint
47
+ ```
48
+
49
+ ## Options
50
+
51
+ | Flag | Description | Default |
52
+ |------|-------------|---------|
53
+ | `-g, --global` | Audit global skills | ✓ |
54
+ | `-p, --project` | Audit project-level skills | |
55
+ | `--mode <lint|audit>` | Lint (spec) or full audit | audit |
56
+ | `-t, --threshold <score>` | Fail if risk > threshold | 7.0 |
57
+ | `-j, --json` | JSON output | |
58
+ | `-o, --output <file>` | Save to file | |
59
+ | `--no-deps` | Skip dependency scan | |
60
+ | `-v, --verbose` | Verbose output | |
61
+
62
+ ## Exit Codes
63
+
64
+ | Code | Meaning |
65
+ |------|---------|
66
+ | 0 | Success (no blocking issues) |
67
+ | 1 | Threshold exceeded or errors |
68
+
69
+ ## Risk Levels
70
+
71
+ | Level | Score | Icon |
72
+ |-------|-------|------|
73
+ | Safe | 0-3.0 | ✅ |
74
+ | Risky | 3.1-5.0 | ⚠️ |
75
+ | Dangerous | 5.1-7.0 | 🔴 |
76
+ | Malicious | 7.1+ | ☠️ |
77
+
78
+ ## OWASP Agentic Top 10 Mapping
79
+
80
+ - **ASI01** - Goal Hijack (prompt injection)
81
+ - **ASI02** - Tool Misuse and Exploitation
82
+ - **ASI04** - Supply Chain Vulnerabilities (secrets, deps)
83
+ - **ASI05** - Unexpected Code Execution (dangerous scripts)
84
+
85
+ ## Vulnerability Intelligence
86
+
87
+ Feeds are cached locally with automatic freshness checks:
88
+
89
+ | Source | Update Frequency | Cache Lifetime |
90
+ |--------|------------------|----------------|
91
+ | CISA KEV | Daily | 7 days |
92
+ | FIRST EPSS | Daily | 7 days |
93
+ | OSV.dev | On-query | 7 days |
94
+
95
+ **Automatic updates:**
96
+ - Runs on `npm install` via `postinstall` hook
97
+ - Daily GitHub Actions workflow (public repos)
98
+ - Manual: `npx skill-audit --update-db`
99
+
100
+ **Stale cache warning:** Audit output warns if feeds are >3 days old.
101
+
102
+ ## Trust Sources
103
+
104
+ 1. Static pattern matching for known attack vectors
105
+ 2. Trivy for dependency vulnerability scanning
106
+ 3. Heuristic rules for common security issues
107
+
108
+ ## Requirements
109
+
110
+ - Node.js 18+
111
+ - npx (for skills CLI)
112
+ - trivy (optional, for dependency scanning)
113
+
114
+ ## Troubleshooting
115
+
116
+ **False positives**: Review finding at file:line, add inline comment explaining legitimate use
117
+
118
+ **Stale DB warning**: Run `npx skill-audit --update-db` to refresh KEV/EPSS/OSV feeds
119
+
120
+ **Skill not found**: Verify `SKILL.md` exists in root or `skills/` directory
121
+
122
+ **postinstall update fails**: The `--quiet || true` flags ensure install continues even if update fails. Run manually later.
123
+
124
+ **Offline mode**: Cached feeds work offline. Re-run audit with existing cache.
package/SKILL.md ADDED
@@ -0,0 +1,227 @@
1
+ ---
2
+ name: skill-audit
3
+ description: This skill should be used when the user asks to "audit AI agent skills for security vulnerabilities", "evaluate third-party skills before installing", "check for prompt injection or secrets leakage", "scan skills for code execution risks", "validate skills against Agent Skills specification", or "assess skill security posture with CVE/GHSA/KEV/EPSS intelligence".
4
+ license: MIT
5
+ compatibility: Node.js 18+ with npm or yarn
6
+ metadata:
7
+ repo: https://github.com/vercel/skill-audit
8
+ version: 0.2.0
9
+ allowed-tools:
10
+ - skill:exec
11
+ - skill:read
12
+ - skill:write
13
+ ---
14
+
15
+ # skill-audit
16
+
17
+ Security auditing CLI for AI agent skills in the Vercel ecosystem.
18
+
19
+ ## When to Use
20
+
21
+ Activate this skill when:
22
+
23
+ - **Evaluating third-party skills** before installing from untrusted sources
24
+ - **Security concerns arise** about prompt injection, secrets leakage, code execution, or data exfiltration
25
+ - **Compliance verification** needed against Agent Skills specification
26
+ - **Pre-deployment audit** before publishing your own skill
27
+ - **Investigating suspicious behavior** from an installed skill
28
+
29
+ ### When NOT to Use
30
+
31
+ - Auditing general npm/Python packages (use `npm audit`, `safety`, or dependency scanners directly)
32
+ - Reviewing non-skill code (use `security-reviewer` agent instead)
33
+ - Checking only spec format without security concerns (use `--mode lint` for fast validation)
34
+
35
+ ## Quick Start
36
+
37
+ ```bash
38
+ # Fast spec validation (no security scan)
39
+ npx skill-audit --mode lint
40
+
41
+ # Full security audit
42
+ npx skill-audit --mode audit
43
+
44
+ # Fail if risk score exceeds threshold
45
+ npx skill-audit -t 3.0
46
+
47
+ # Export JSON report
48
+ npx skill-audit -j -o ./audit-report.json
49
+ ```
50
+
51
+ ## Commands
52
+
53
+ ### `lint`
54
+
55
+ Validates skills against Agent Skills specification:
56
+ - SKILL.md exists with valid frontmatter
57
+ - name matches directory (lowercase, 1-64 chars, no consecutive hyphens)
58
+ - description present (1-1024 chars)
59
+ - allowed-tools structure valid
60
+ - Progressive disclosure (warns if SKILL.md > 500 lines)
61
+
62
+ ### `audit`
63
+
64
+ Full security audit including:
65
+ - Prompt injection patterns (ASI01)
66
+ - Credential leaks / secrets (ASI04)
67
+ - Code execution risks (ASI05)
68
+ - Exfiltration patterns (ASI02)
69
+ - Behavioral manipulation (ASI09)
70
+ - Provenance checks (trusted domains, pinned refs)
71
+ - Dependency vulnerability scanning
72
+
73
+ ### `update-db`
74
+
75
+ Pulls latest vulnerability intelligence:
76
+ - CISA KEV (Known Exploited Vulnerabilities)
77
+ - FIRST EPSS (Exploit Prediction Scoring) - via api.first.org/data/v1
78
+ - OSV.dev vulnerabilities
79
+
80
+ Caches to `.cache/skill-audit/feeds/` for offline use.
81
+
82
+ ## After Running Audit
83
+
84
+ ### Decision Matrix
85
+
86
+ | Risk Level | Score | Action |
87
+ |------------|-------|--------|
88
+ | ✅ Safe | 0 | Deploy or install without concerns |
89
+ | ⚠️ Risky | 0.1-3.0 | Review findings; acceptable for low-risk use cases |
90
+ | 🔴 Dangerous | 3.1-7.0 | Fix issues before deployment; significant risks present |
91
+ | ☠️ Malicious | 7.1-10.0 | DO NOT USE; contains critical vulnerabilities or malicious patterns |
92
+
93
+ ### Common Findings Interpretation
94
+
95
+ | Finding ID | Category | Meaning |
96
+ |------------|----------|---------|
97
+ | SPEC-01 | Specification | SKILL.md missing or malformed frontmatter |
98
+ | ASI01-01 | Prompt Injection | Contains patterns that could override system instructions |
99
+ | ASI04-01 | Secrets | Hardcoded API keys, tokens, or credentials detected |
100
+ | ASI05-01 | Code Execution | Dynamic code execution without proper sandboxing |
101
+ | ASI02-01 | Exfiltration | Potential data leakage to untrusted endpoints |
102
+ | VULN-* | Dependency | Known vulnerability in skill's dependencies (see CVE ID) |
103
+
104
+ ## Options
105
+
106
+ | Flag | Description |
107
+ |------|-------------|
108
+ | `-g, --global` | Audit global skills (default) |
109
+ | `-p, --project` | Audit project-level skills |
110
+ | `-a, --agent <agents>` | Filter by specific agents |
111
+ | `-j, --json` | Output as JSON |
112
+ | `-o, --output <file>` | Save report to file (JSON format) |
113
+ | `-v, --verbose` | Show detailed findings |
114
+ | `-t, --threshold <score>` | Fail if risk score exceeds threshold |
115
+ | `--no-deps` | Skip dependency scanning |
116
+ | `--mode <mode>` | `lint` or `audit` (default: audit) |
117
+ | `--update-db` | Update vulnerability intelligence feeds |
118
+ | `--strict` | Fail if feed update errors occur |
119
+ | `--quiet` | Suppress non-error output |
120
+
121
+ ## Risk Scoring
122
+
123
+ | Level | Score | Description |
124
+ |-------|-------|-------------|
125
+ | ✅ Safe | 0 | No issues found |
126
+ | ⚠️ Risky | 0.1-3.0 | Minor issues, review recommended |
127
+ | 🔴 Dangerous | 3.1-7.0 | Significant risks, fix before use |
128
+ | ☠️ Malicious | 7.1-10.0 | Critical issues, do not use |
129
+
130
+ ## Exit Codes
131
+
132
+ - `0`: Success (no blocking issues)
133
+ - `1`: Threshold exceeded or blocking findings
134
+
135
+ ## Examples
136
+
137
+ ```bash
138
+ # Quick spec check
139
+ npx skill-audit -g --mode lint -v
140
+
141
+ # Full audit with JSON output
142
+ npx skill-audit -g --mode audit -j > audit-results.json
143
+
144
+ # Export report to file
145
+ npx skill-audit -g -o ./audit-report.json
146
+
147
+ # Fail on dangerous skills (score > 3.0)
148
+ npx skill-audit -g -t 3.0
149
+
150
+ # Update intelligence feeds
151
+ npx skill-audit --update-db --source kev epss
152
+
153
+ # Audit project-level skills only
154
+ npx skill-audit -p --mode audit -v
155
+ ```
156
+
157
+ ### Sample Output Interpretation
158
+
159
+ ```
160
+ 🔍 Auditing skills (full security + intelligence)...
161
+ Found 3 skills
162
+
163
+ 📊 Summary (audit mode):
164
+ Safe: 1 | Risky: 1 | Dangerous: 1 | Malicious: 0
165
+ Skills with spec issues: 1 | Security issues: 2
166
+
167
+ ⚠️ Vulnerability DB is stale (4.2 days for KEV, 5.1 days for EPSS)
168
+ Run: npx skill-audit --update-db
169
+
170
+ ❌ 1 skills exceed threshold 3.0
171
+ - suspicious-skill: 5.8
172
+ ```
173
+
174
+ **Actions:**
175
+ 1. Run `--update-db` if vulnerability feeds are stale
176
+ 2. Review verbose output (`-v`) for skills exceeding threshold
177
+ 3. Block deployment for skills scoring > 3.0 without remediation
178
+
179
+ ## How It Works
180
+
181
+ Three-layer validation approach:
182
+
183
+ 1. **Spec Validator**
184
+ - Validates Agent Skills format
185
+ - Blocks on spec errors before security scan
186
+
187
+ 2. **Security Auditor**
188
+ - Pattern-based detection for vulnerabilities
189
+ - Maps to OWASP Agentic Top 10
190
+
191
+ 3. **Intelligence Service**
192
+ - Caches CVE/GHSA/KEV/EPSS data
193
+ - Native HTTP/fetch (no shell dependencies)
194
+
195
+ ## Related Skills
196
+
197
+ | Skill | When to Use |
198
+ |-------|-------------|
199
+ | `security-review` | Manual security checklist for code implementation |
200
+ | `tdd-workflow` | Test-driven development for skill development |
201
+ | `writing-skills` | Creating new skills with TDD methodology |
202
+
203
+ ## Troubleshooting
204
+
205
+ | Issue | Solution |
206
+ |-------|----------|
207
+ | "Vulnerability DB is stale" warning | Run `npx skill-audit --update-db` |
208
+ | False positive on prompt injection | Review context - sample JSON output may trigger detections |
209
+ | Dependency scan fails | Ensure lockfile exists; run `npm install` or equivalent |
210
+ | Skill path not found | Verify symlink resolution; check case sensitivity |
211
+
212
+ ## References
213
+
214
+ ### External Resources
215
+
216
+ - **[OWASP AI Security Top 10](https://owasp.org/www-project-top-ten.html)** - ASI01-ASI10 threat categories
217
+ - **[CISA KEV Catalog](https://www.cisa.gov/known-exploited-vulnerabilities-catalog)** - Actively exploited vulnerabilities
218
+ - **[FIRST EPSS](https://www.first.org/epss/)** - Exploit Prediction Scoring System
219
+ - **[OSV.dev](https://osv.dev/)** - Open Source Vulnerability database
220
+
221
+ ### Intelligence Cache
222
+
223
+ | Source | Update Frequency | Max Cache Age | Warning Threshold |
224
+ |--------|-----------------|---------------|-------------------|
225
+ | CISA KEV | Daily | 1 day | 3 days |
226
+ | FIRST EPSS | 3-day cycle | 3 days | 3 days |
227
+ | OSV.dev | On-query | 7 days | 3 days |