red-widow 0.1.0__tar.gz

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.
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Red Widow contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
@@ -0,0 +1,377 @@
1
+ Metadata-Version: 2.4
2
+ Name: red-widow
3
+ Version: 0.1.0
4
+ Summary: VSIX, IDE extension, and AI developer workflow security scanner.
5
+ Author: Red Widow contributors
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/duriantaco/red-widow
8
+ Project-URL: Repository, https://github.com/duriantaco/red-widow
9
+ Project-URL: Issues, https://github.com/duriantaco/red-widow/issues
10
+ Keywords: ai-security,developer-security,ide-security,supply-chain-security,vscode,vsix
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Information Technology
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3 :: Only
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Topic :: Security
22
+ Classifier: Topic :: Software Development :: Quality Assurance
23
+ Classifier: Topic :: Utilities
24
+ Requires-Python: >=3.10
25
+ Description-Content-Type: text/markdown
26
+ License-File: LICENSE
27
+ Dynamic: license-file
28
+
29
+ <p align="center">
30
+ <img src="assets/red-widow.png" alt="Red Widow logo - VSIX and IDE extension security scanner" width="900">
31
+ </p>
32
+
33
+ <h1 align="center">Red Widow</h1>
34
+
35
+ <p align="center">
36
+ <strong>VSIX, IDE extension, and AI developer workflow security scanner.</strong>
37
+ </p>
38
+
39
+ <p align="center">
40
+ <a href="https://www.python.org/downloads/"><img alt="Python 3.10+" src="https://img.shields.io/badge/python-3.10%2B-3776AB?logo=python&logoColor=white"></a>
41
+ <a href="#license"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-black"></a>
42
+ <a href="#what-it-checks"><img alt="VSIX scanner" src="https://img.shields.io/badge/VSIX-scanner-red"></a>
43
+ <a href="#policy-format"><img alt="Policy as code" src="https://img.shields.io/badge/policy-as--code-blue"></a>
44
+ <a href="#what-it-checks"><img alt="SARIF supported" src="https://img.shields.io/badge/SARIF-supported-brightgreen"></a>
45
+ <a href="#contributing"><img alt="Contributions welcome" src="https://img.shields.io/badge/contributions-welcome-orange"></a>
46
+ </p>
47
+
48
+ `red-widow` is an open-source security scanner for VS Code-compatible IDE
49
+ extensions, VSIX packages, and developer workflow attack surfaces. It can inspect
50
+ `.vsix` packages, unpacked extension directories, locally installed extensions,
51
+ extension update diffs, lockfiles, policy files, inventory reports, and SARIF
52
+ output for CI.
53
+
54
+ Use Red Widow to find risky IDE extension behavior before it reaches developer
55
+ machines: bundled secrets, broad activation events, native binaries,
56
+ `child_process` usage, VS Code webview and terminal API abuse, environment
57
+ variable sweeping, executable download chains, sensitive local path access,
58
+ suspicious network domains, and dynamic canary exfiltration attempts.
59
+
60
+ The static scanner is intentionally dependency-free at runtime. Dynamic sandbox
61
+ runs require Node.js because Red Widow executes extension activation code through
62
+ an instrumented Node harness.
63
+
64
+ ## Usage
65
+
66
+ For day-to-day repo checks, use the gate. It scans the current workspace's
67
+ `.vscode/extensions.json`, resolves recommended extensions from the VS Code
68
+ Marketplace or OpenVSX, caches downloaded VSIX packages under `.red-widow/`, and
69
+ scans any checked-in `.vsix` files it finds:
70
+
71
+ ```bash
72
+ red-widow gate
73
+ red-widow approve
74
+ red-widow approve --reviewed-by security@example.com
75
+ red-widow gate --policy examples/policy.example.json
76
+ red-widow gate --json
77
+ ```
78
+
79
+ The same gate also auto-detects VS Code-compatible AI-IDE workflow config in the
80
+ workspace, including `.vscode/mcp.json`, VS Code tasks/debug/settings,
81
+ Cursor/Windsurf MCP config, agent rules, `AGENTS.md`, Windsurf hooks, and
82
+ Windsurf ignore config. Harmless config discovery is reported as inventory;
83
+ concrete executable paths such as shell hooks, shell-wrapped MCP servers,
84
+ non-HTTPS remote MCP URLs, curl-to-shell tasks, or broad env-file exposure can
85
+ block.
86
+
87
+ Before push or in CI, make review items blocking:
88
+
89
+ ```bash
90
+ red-widow gate --policy examples/policy.example.json --fail-on-review
91
+ ```
92
+
93
+ Use the first-party GitHub Action in CI:
94
+
95
+ ```yaml
96
+ - uses: red-widow/red-widow@v1
97
+ with:
98
+ workspace: .
99
+ policy: examples/policy.example.json
100
+ offline: "true"
101
+ fail-on-review: "true"
102
+ upload-sarif: "true"
103
+ ```
104
+
105
+ Stay local-only when you do not want network access:
106
+
107
+ ```bash
108
+ red-widow gate --offline
109
+ ```
110
+
111
+ `red-widow approve` writes `red-widow.lock.json` for the resolved packages from
112
+ the current gate run. Future `red-widow gate` runs use that lockfile
113
+ automatically and flag version or package-hash drift.
114
+
115
+ Scan a specific VSIX or unpacked extension:
116
+
117
+ ```bash
118
+ red-widow ./extension.vsix
119
+ red-widow ./unpacked-extension-directory
120
+ ```
121
+
122
+ Compare an extension update:
123
+
124
+ ```bash
125
+ red-widow --diff ./old.vsix ./new.vsix
126
+ ```
127
+
128
+ Audit installed extensions:
129
+
130
+ ```bash
131
+ red-widow --installed
132
+ red-widow --installed --format inventory
133
+ ```
134
+
135
+ Audit the local machine's installed extensions plus global Cursor/Windsurf MCP
136
+ config:
137
+
138
+ ```bash
139
+ red-widow gate --installed
140
+ red-widow inventory --format json
141
+ ```
142
+
143
+ Export approved extensions into VS Code enterprise `extensions.allowed` policy:
144
+
145
+ ```bash
146
+ red-widow export vscode-allowed --lockfile red-widow.lock.json --format settings-json
147
+ ```
148
+
149
+ Run Red Widow inside VS Code with the editor extension in
150
+ [`vscode-extension/`](vscode-extension/). The extension runs the local CLI,
151
+ shows the gate decision in the status bar, and adds Problems diagnostics for
152
+ blocking and review findings. See [`docs/vscode-extension.md`](docs/vscode-extension.md).
153
+
154
+ Run a VSIX in a canary sandbox:
155
+
156
+ ```bash
157
+ red-widow run ./extension.vsix --sandbox
158
+ ```
159
+
160
+ Seed and check an AI coding-agent canary run:
161
+
162
+ ```bash
163
+ red-widow agent seed /private/tmp/red-widow-agent-probe
164
+ red-widow agent show /private/tmp/red-widow-agent-probe
165
+ red-widow agent check ./agent-transcript.txt --workspace /private/tmp/red-widow-agent-probe
166
+ ```
167
+
168
+ `agent seed` and `agent show` redact the canary marker by default so CI logs do
169
+ not accidentally expose it. Use `--reveal-marker` only for local manual probes.
170
+
171
+ Recommended extension IDs that cannot be resolved from an installed/local copy,
172
+ the lockfile, VS Code Marketplace, or OpenVSX produce `REVIEW` by default. Use
173
+ `--fail-on-review` when CI should block unresolved recommendations.
174
+
175
+ Useful advanced commands:
176
+
177
+ ```bash
178
+ red-widow ./extension.vsix --format json
179
+ red-widow ./extension.vsix --fail-on high
180
+ red-widow ./extension.vsix --write-lockfile extensions.lock.json
181
+ red-widow ./extension.vsix --lockfile extensions.lock.json
182
+ red-widow approve --json
183
+ red-widow approve --lockfile red-widow.lock.json
184
+ red-widow inventory --format markdown
185
+ red-widow export vscode-allowed --format json
186
+ red-widow gate --workspace .
187
+ red-widow gate --offline
188
+ red-widow gate --installed --policy examples/policy.example.json
189
+ red-widow gate --installed --extension-root ./extensions
190
+ red-widow gate --recommendations .vscode/extensions.json
191
+ red-widow --installed --policy examples/policy.example.json
192
+ red-widow --installed --policy examples/policy.example.json --format sarif
193
+ red-widow --installed --format markdown
194
+ red-widow run ./extension.vsix --sandbox --keep-run
195
+ red-widow run ./extension.vsix --sandbox --format json
196
+ red-widow agent seed /private/tmp/red-widow-agent-probe --format json
197
+ red-widow agent show /private/tmp/red-widow-agent-probe --reveal-marker
198
+ red-widow agent check ./agent-transcript.txt --workspace /private/tmp/red-widow-agent-probe --format json
199
+ ```
200
+
201
+ Create and use a baseline so CI reports only new risk:
202
+
203
+ ```bash
204
+ red-widow --installed --policy examples/policy.example.json --write-baseline extensions.baseline.json
205
+ red-widow --installed --policy examples/policy.example.json --baseline extensions.baseline.json
206
+ ```
207
+
208
+ When running from a checkout instead of an installed package, replace
209
+ `red-widow` with:
210
+
211
+ ```bash
212
+ python3 -m red_widow
213
+ ```
214
+
215
+ Release instructions live in [`docs/release.md`](docs/release.md). Red Widow is
216
+ intended to publish through PyPI Trusted Publishing from GitHub Releases, not
217
+ through long-lived local PyPI tokens.
218
+
219
+ The dynamic sandbox creates a fake workspace with canary secrets, loads the
220
+ extension activation entry point through an instrumented Node harness, blocks
221
+ process and network calls, and reports proof when an extension reads canary
222
+ files, spawns a process, sends terminal commands, touches canary environment
223
+ values, creates unsafe webviews, or attempts to send canary material outbound.
224
+
225
+ Safety note: the dynamic runner is an instrumented canary harness, not an
226
+ operating-system or VM sandbox. Run unknown hostile packages inside an isolated
227
+ CI worker, container, or virtual machine.
228
+
229
+ For explicit target lists, use `--continue-on-error` to keep scanning after a
230
+ malformed package. Installed-extension scans continue by default and return
231
+ status 1 if any target could not be parsed.
232
+
233
+ Exit codes are stable for CI:
234
+
235
+ - `0`: scan passed, or findings are report-only under the selected options.
236
+ - `1`: scan/runtime error, malformed target, or dynamic harness error.
237
+ - `2`: policy violation, lockfile violation, `--fail-on` threshold, gate block, `--fail-on-review`, or dynamic block.
238
+
239
+ ## Demo a Faulty VSIX
240
+
241
+ Build a deterministic intentionally faulty fixture:
242
+
243
+ ```bash
244
+ python3 examples/build_faulty_vsix.py /private/tmp/red-widow-faulty.vsix
245
+ ```
246
+
247
+ Run static and dynamic proof:
248
+
249
+ ```bash
250
+ python3 -m red_widow /private/tmp/red-widow-faulty.vsix
251
+ python3 -m red_widow run /private/tmp/red-widow-faulty.vsix --sandbox
252
+ ```
253
+
254
+ The generated fixture includes bundled secrets, a lifecycle script, a native
255
+ binary, child process usage, terminal command injection, env sweeping, webview
256
+ script/message behavior, a download-write-execute path, and canary exfiltration
257
+ code. It is meant for local demos and tests, not for publishing.
258
+
259
+ ## What It Checks
260
+
261
+ | Area | What Red Widow Looks For |
262
+ | --- | --- |
263
+ | Manifest behavior | Activation events, broad `*` activation, workspace extension host usage, and package lifecycle scripts. |
264
+ | Secrets | Private keys, GitHub/OpenAI/AWS/Slack/npm tokens, and generic secret assignments. |
265
+ | Bundled credential files | Files such as `.env`, `.npmrc`, `.netrc`, `.git-credentials`, SSH keys, and cloud credential files. |
266
+ | Process execution | Node process execution APIs such as `child_process`, `exec`, `spawn`, `fork`, and sync variants. |
267
+ | Terminal APIs | `createTerminal().sendText(...)` paths that can inject commands into an integrated terminal. |
268
+ | Webviews | Script-enabled webviews, missing strict CSP, and `onDidReceiveMessage` handlers that need validation. |
269
+ | Environment access | Broad `process.env` enumeration or dynamic indexing that can sweep developer secrets. |
270
+ | Executable download chains | Runtime source files that combine network access, filesystem writes, and process execution. |
271
+ | Workspace trust | Risky runtime behavior without an apparent `vscode.workspace.isTrusted` gate, missing `capabilities.untrustedWorkspaces`, and unrestricted execution-sensitive settings. |
272
+ | VS Code MCP | `.vscode/mcp.json` local MCP stdio commands, remote MCP URLs, secret-like env usage, env files, and shell-wrapper command paths. |
273
+ | VS Code repo execution config | `.vscode/tasks.json`, `.vscode/launch.json`, and `.vscode/settings.json` commands, shell chains, env files, and sensitive file references. |
274
+ | Language model tools | VSIX `contributes.languageModelTools`, broad tool descriptions, and tool implementations that combine local data reads with network/process/terminal output. |
275
+ | Cursor/Windsurf MCP | Local MCP stdio commands, remote MCP URLs, secret-like env usage, env files, and shell-wrapper command paths. |
276
+ | AI agent rules | Risky instructions in `.cursor/rules`, `.cursorrules`, `AGENTS.md`, and Windsurf rules or workflows. |
277
+ | Windsurf hooks | Shell commands configured in `.windsurf/hooks.json`. |
278
+ | Windsurf ignore config | `.codeiumignore` patterns that re-include sensitive-looking files. |
279
+ | Local credential access | References to sensitive paths and variables such as `.ssh`, `.git-credentials`, `id_rsa`, cloud tokens, and credential environment variables. |
280
+ | Network endpoints | Runtime HTTP/HTTPS domains embedded in extension source files. |
281
+ | Native and script content | Native binaries such as `.node`, `.so`, `.dll`, `.dylib`, `.exe`, plus bundled shell scripts. |
282
+ | Obfuscation | Large minified JavaScript lines, `eval`, `atob`, `new Function`, `String.fromCharCode`, and large base64-like blobs. |
283
+ | Update diffs | Newly added findings, domains, native binaries, and activation-event changes between extension versions. |
284
+ | Dynamic sandbox proof | Canary file/env reads, terminal sendText calls, unsafe webview behavior, process-spawn attempts, outbound network access, and outbound canary exfiltration attempts. |
285
+ | AI coding-agent proof | Canary workspaces with untrusted prompt-injection content plus transcript/tool-trace checks for canary disclosure, sensitive file reads, unsafe commands, and outbound exfil paths. |
286
+ | Gate checks | Local VSIX packages, installed extensions, marketplace-resolved recommendations, and unresolved VS Code extension recommendations before they land in a repo or CI workflow. |
287
+
288
+ ## Policy Format
289
+
290
+ Policy files are JSON and can allow or block extension IDs, publishers, domains,
291
+ and specific scanner rules.
292
+
293
+ ```json
294
+ {
295
+ "maxSeverity": "medium",
296
+ "maxRiskScore": 9,
297
+ "allowExtensions": ["esbenp.prettier-vscode", "github.*"],
298
+ "blockExtensions": ["unknown.*"],
299
+ "allowPublishers": ["GitHub", "ms-python"],
300
+ "blockPublishers": ["suspicious-publisher"],
301
+ "allowDomains": ["*.microsoft.com", "*.github.com"],
302
+ "blockDomains": ["*.example"],
303
+ "allowActivationStar": false,
304
+ "allowNativeBinaries": false,
305
+ "denyFindings": ["child-process-use", "private-key", "github-token"],
306
+ "exceptions": [
307
+ {
308
+ "extension": "ms-python.*",
309
+ "version": "2026.*",
310
+ "ruleId": "native-binary",
311
+ "scope": "dependency",
312
+ "reason": "Approved bundled helper binaries."
313
+ },
314
+ {
315
+ "extension": "github.*",
316
+ "ruleId": "domain-blocked",
317
+ "domain": "*.github.com",
318
+ "reason": "Approved service domain."
319
+ }
320
+ ]
321
+ }
322
+ ```
323
+
324
+ If a policy is passed and violations are found, `red-widow` exits with status 2.
325
+
326
+ Findings include metadata for triage:
327
+
328
+ - `confidence`: how reliable the signal is.
329
+ - `blocking`: whether the rule is strong enough to block by default.
330
+ - `scope`: `source`, `dependency`, `documentation`, `test`, `example`, `generated`, `manifest`, `config`, or `asset`.
331
+ - `remediation`: suggested review or cleanup action.
332
+
333
+ ## Lockfile Format
334
+
335
+ ```json
336
+ {
337
+ "lockfileVersion": 2,
338
+ "allowedExtensions": {
339
+ "publisher.extension-name": {
340
+ "version": "1.0.0",
341
+ "sha256": "package-or-directory-digest",
342
+ "source": "marketplace",
343
+ "marketplaceSource": "openvsx",
344
+ "sourceUrl": "https://open-vsx.org/api/publisher/extension-name/file/publisher.extension-name.vsix",
345
+ "publisher": "publisher",
346
+ "name": "extension-name",
347
+ "approvedBy": "security@example.com",
348
+ "reviewedBy": "security@example.com",
349
+ "reviewedAt": "2026-05-06T00:00:00Z"
350
+ }
351
+ }
352
+ }
353
+ ```
354
+
355
+ For directories, the digest is deterministic over relative file paths and file
356
+ contents. For `.vsix` files, the digest is the package SHA-256. Older lockfiles
357
+ with only `allowedExtensions` remain valid; Red Widow validates extension ID,
358
+ version, and package digest.
359
+
360
+ ## Contributing
361
+
362
+ Contributions are welcome. Start with [CONTRIBUTING.md](CONTRIBUTING.md) for the
363
+ development workflow, test commands, and the current contribution priorities.
364
+
365
+ What Red Widow needs most right now:
366
+
367
+ | Need | Examples |
368
+ | --- | --- |
369
+ | Scanner fixtures | Safe intentionally risky VSIX samples for secrets, lifecycle scripts, native binaries, obfuscation, and network endpoints. |
370
+ | Detection coverage | More VSIX, extension manifest, MCP, CI workflow, and devcontainer risk checks. |
371
+ | False-positive reduction | Better scoping for generated files, dependencies, docs, tests, and examples. |
372
+ | Packaging and CI | Wheel/sdist smoke tests, GitHub Action examples, SARIF upload examples, and release automation. |
373
+ | Documentation | Real-world usage examples for policy, lockfiles, baselines, inventory, and update diffs. |
374
+
375
+ ## License
376
+
377
+ MIT. See [LICENSE](LICENSE).