skill-security-scanner 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,189 @@
1
+ # skill-security-scanner
2
+
3
+ > Static security scanner and linter for OpenClaw skill directories. Free tier. No config needed.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/skill-security-scanner)](https://www.npmjs.com/package/skill-security-scanner)
6
+
7
+ ## Commands
8
+
9
+ | Command | Description |
10
+ |---|---|
11
+ | `scan <skill>` | Security scan a single skill (default) |
12
+ | `scan-all` | Security scan every skill in the project |
13
+ | `lint <skill>` | Validate SKILL.md frontmatter schema |
14
+ | `lint --all` | Validate every skill in the project |
15
+
16
+ ---
17
+
18
+ ## `scan` — Security Scanner
19
+
20
+ ```bash
21
+ # By skill name — auto-discovered from anywhere in the project
22
+ npx skill-security-scanner frontend-design
23
+ npx skill-security-scanner clean-code
24
+
25
+ # Or a full/relative path
26
+ npx skill-security-scanner .agent/skills/frontend-design
27
+ ```
28
+
29
+ The CLI walks up the directory tree to find `.agent/skills/<name>` automatically.
30
+
31
+ ### What It Scans
32
+
33
+ | Check | Description | Risk |
34
+ |---|---|---|
35
+ | **Permissions** | `file_system:write`, `network:outbound`, `shell:execute` in YAML frontmatter | Med/High |
36
+ | **Dangerous bins** | `curl`, `wget`, `ssh`, `bash`, etc. in `requires.bin` | High |
37
+ | **Sensitive env vars** | Env vars with `key`, `secret`, `token`, `password` in name | Med |
38
+ | **Code patterns** | `eval`, `exec`, `execSync`, network calls in source files | Med/High |
39
+ | **Secret leaks** | OpenAI `sk-`, GitHub `ghp_`, AWS `AKIA`, hardcoded passwords | High |
40
+ | **npm vulns** | `npm audit` for known CVEs (if `package.json` present) | Med/High |
41
+
42
+ ### Risk Scoring
43
+
44
+ | Score | Meaning |
45
+ |---|---|
46
+ | 🟢 LOW | No significant risks detected |
47
+ | 🟡 MED | Some concerns — review recommended |
48
+ | 🔴 HIGH | Critical risks — block before deploy |
49
+
50
+ ### Scan Flags
51
+
52
+ | Flag | Description |
53
+ |---|---|
54
+ | `--badge` | Print a Markdown shield badge (paste into your README) |
55
+ | `--json` | JSON output for CI pipelines |
56
+
57
+ ```bash
58
+ npx skill-security-scanner frontend-design --badge
59
+ npx skill-security-scanner frontend-design --json
60
+ ```
61
+
62
+ ### Scan Output Example
63
+
64
+ ```
65
+ 🔍 Skill Security Scanner — voiceover-bot
66
+ ──────────────────────────────────────────────────
67
+ Risk Score: 🚨 HIGH
68
+
69
+ 🚨 HIGH RISK (2)
70
+ • Requires dangerous binary: curl (network/exfil risk)
71
+ • eval/exec found in scripts/run.ts — remote code execution risk
72
+
73
+ ⚠️ MEDIUM RISK (1)
74
+ • Sensitive env var required: OPENAI_API_KEY
75
+ ```
76
+
77
+ ---
78
+
79
+ ## `scan-all` — Scan Every Skill
80
+
81
+ ```bash
82
+ npx skill-security-scanner scan-all
83
+ npx skill-security-scanner scan-all --json
84
+ npx skill-security-scanner scan-all --fail-on med
85
+ ```
86
+
87
+ ### scan-all Flags
88
+
89
+ | Flag | Description |
90
+ |---|---|
91
+ | `--json` | JSON array output |
92
+ | `--fail-on <level>` | Exit 1 if any skill hits `low`/`med`/`high` (default: `high`) |
93
+ | `--skip-audit` | Skip npm audit (auto-enabled when >5 skills found) |
94
+
95
+ ### scan-all Output Example
96
+
97
+ ```
98
+ 🔍 Skill Security Scanner — Project Scan (37 skills)
99
+ ────────────────────────────────────────────────────────────
100
+ 🚨 HIGH voiceover-bot
101
+ → [HIGH] eval/exec found in scripts/run.ts — remote code execution risk
102
+ → [MED] Sensitive env var required: OPENAI_API_KEY
103
+
104
+ ✅ LOW frontend-design
105
+ ✅ LOW clean-code
106
+ ... (34 more)
107
+ ────────────────────────────────────────────────────────────
108
+ 🚨 1 HIGH ⚠️ 0 MED ✅ 36 LOW
109
+ ```
110
+
111
+ ---
112
+
113
+ ## `lint` — Schema Validator
114
+
115
+ Validates SKILL.md frontmatter against the OpenClaw schema.
116
+
117
+ ```bash
118
+ # Single skill
119
+ npx skill-security-scanner lint frontend-design
120
+
121
+ # All skills in the project
122
+ npx skill-security-scanner lint --all
123
+
124
+ # Fail on warnings too (strict CI mode)
125
+ npx skill-security-scanner lint --all --strict
126
+ ```
127
+
128
+ ### What It Validates
129
+
130
+ | Field | Rule |
131
+ |---|---|
132
+ | `name` | Required, string, ≥3 chars |
133
+ | `description` | Required, string, ≥10 chars recommended |
134
+ | `version` | Required, valid semver (`x.y.z`) |
135
+ | `permissions` | Array of known OpenClaw permission scopes |
136
+ | `requires.env/config/bin` | Must be arrays if present |
137
+ | Body content | Warns if <50 chars |
138
+
139
+ ### Lint Flags
140
+
141
+ | Flag | Description |
142
+ |---|---|
143
+ | `--all` | Lint every skill in the project |
144
+ | `--strict` | Treat warnings as errors (exit 1) |
145
+ | `--json` | JSON output |
146
+
147
+ ### Lint Output Example
148
+
149
+ ```
150
+ � Lint — voiceover-bot
151
+ ──────────────────────────────────────────────────
152
+ Status: ❌ FAIL
153
+
154
+ Errors (2)
155
+ • [description] Missing required field
156
+ • [version] Missing required field
157
+
158
+ Warnings (1)
159
+ • [SKILL.md body] Skill body is very short — consider adding usage examples
160
+ ```
161
+
162
+ ---
163
+
164
+ ## Install Globally
165
+
166
+ ```bash
167
+ npm install -g skill-security-scanner
168
+
169
+ # Then from anywhere in your project:
170
+ skill-security-scanner frontend-design
171
+ skill-security-scanner lint --all
172
+ skill-security-scanner scan-all
173
+ ```
174
+
175
+ ## CI / GitHub Actions
176
+
177
+ ```yaml
178
+ - name: Lint skills
179
+ run: npx skill-security-scanner lint --all
180
+
181
+ - name: Security scan all skills
182
+ run: npx skill-security-scanner scan-all --fail-on high --json
183
+ ```
184
+
185
+ ## Upgrade
186
+
187
+ Free tier covers static analysis + linting. For **dynamic sandboxing**, **GitHub org scans**, and **CI dashboards**:
188
+
189
+ 👉 [skill-security.com](https://skill-security.com) — 7-day free trial
package/TODO.md ADDED
@@ -0,0 +1,57 @@
1
+ # skill-security-scanner — CLI Roadmap
2
+
3
+ > Free tier features only. SaaS (dynamic analysis, GitHub Actions, CI dashboards) tracked separately.
4
+
5
+ ---
6
+
7
+ ## 🗂️ Skill Metadata & Quality
8
+
9
+ - [x] **`lint <skill>`** — Validate SKILL.md frontmatter against OpenClaw schema (required fields: `name`, `description`, `version`). Exit 1 on missing fields.
10
+ - [ ] **`info <skill>`** — Pretty-print parsed frontmatter (permissions, bins, env vars, command-dispatch). Useful for debugging what the scanner actually sees.
11
+ - [ ] **`diff <skill-a> <skill-b>`** — Side-by-side comparison of permissions, requires.bin, and risk scores between two skills or two versions.
12
+ - [ ] **`stats`** — Project-wide health snapshot: most common permissions, most used bins, avg finding count per skill, riskiest skill.
13
+
14
+ ---
15
+
16
+ ## 🔍 Deeper Static Analysis
17
+
18
+ - [ ] **Entropy-based secret detection** — Flag high-entropy strings that look like secrets even without a known prefix (e.g. base64 blobs, random hex). Supplement existing regex checks.
19
+ - [ ] **License check** — Scan `package.json` / `requirements.txt` for non-commercial or copyleft licenses (GPL, AGPL). Flag as MED risk.
20
+ - [ ] **Dead code detection** — Find files in the skill dir never referenced by any other file. Flags bloat and unnecessary attack surface.
21
+ - [ ] **Import graph** — List all external packages a skill actually imports and flag ones not declared in frontmatter `requires`.
22
+ - [ ] **`--depth <n>`** flag — Control how many levels deep the code scanner recurses (default: 3).
23
+
24
+ ---
25
+
26
+ ## 🛠️ Developer UX
27
+
28
+ - [ ] **`fix --dry-run`** — Suggest auto-fixable issues with diffs shown. E.g. overly broad `file_system:*` → suggest `file_system:read`.
29
+ - [ ] **`watch <skill>`** — Re-scan on file save. Live feedback while authoring a skill.
30
+ - [ ] **`init`** — Scaffold a compliant `SKILL.md` with correct frontmatter structure and placeholder values.
31
+ - [ ] **`--ignore <rule-id>`** — Suppress specific finding by ID inline (e.g. `# sss-ignore: exec-pattern` in source).
32
+ - [ ] **`.sss.yaml` config file** — Project-level config: ignored rules, custom dangerous bins list, custom secret regex patterns, default `--fail-on` level.
33
+
34
+ ---
35
+
36
+ ## 📊 Reporting & Output
37
+
38
+ - [ ] **`--output <file>`** — Write full report to disk. Support `.json`, `.md`, and `.sarif` extensions (auto-detected from extension).
39
+ - [ ] **Markdown report** — `scan-all --output report.md` generates a formatted table suitable for pasting into PR descriptions.
40
+ - [ ] **SARIF output** — `--format sarif` for GitHub Code Scanning and VS Code Problems panel integration.
41
+
42
+ ---
43
+
44
+ ## Priority Order
45
+
46
+ | Priority | Feature | Effort |
47
+ |---|---|---|
48
+ | 🔴 1 | `lint` command | Low |
49
+ | 🔴 2 | `--ignore` + `.sss.yaml` config | Medium |
50
+ | 🟡 3 | Entropy-based secret detection | Medium |
51
+ | 🟡 4 | `--output report.md` | Low |
52
+ | 🟢 5 | `diff` command | Medium |
53
+ | 🟢 6 | `stats` command | Low |
54
+ | 🟢 7 | `watch` mode | Medium |
55
+ | ⚪ 8 | Import graph | High |
56
+ | ⚪ 9 | Dead code detection | High |
57
+ | ⚪ 10 | SARIF output | Medium |
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}