feat(llm-security): /security ide-scan <url> — Marketplace/OpenVSX/direct VSIX (v6.4.0)
Pre-installation verification of VS Code extensions via URL — fetch a remote VSIX, extract it in a hardened sandbox, and run the existing IDE scanner pipeline against it. No npm dependencies. Sources: - VS Code Marketplace (publisher.gallery.vsassets.io direct download) - OpenVSX (open-vsx.org official API) - Direct .vsix HTTPS URLs Defenses: - HTTPS-only, TLS verified, manual redirect with per-source host whitelist - 30s total timeout via AbortController - 50MB compressed cap, 500MB uncompressed, 100x expansion ratio - Zero-dep ZIP extractor: zip-slip, absolute paths, drive letters, NUL bytes, symlinks (Unix mode 0xA000), depth limits, ZIP64 rejected, encrypted rejected - SHA-256 streamed during fetch, surfaced in meta.source - Temp dir cleanup in all paths (try/finally) Files: - scanners/lib/vsix-fetch.mjs (HTTPS fetcher, host whitelist, streaming SHA-256) - scanners/lib/zip-extract.mjs (zero-dep parser with hardening caps) - knowledge/marketplace-api-notes.md (endpoint reference) - 3 test files (48 tests added: vsix-fetch, zip-extract, ide-extension-url) Tests: 1296 → 1344 (all green). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
6252e55700
commit
fe0193956d
16 changed files with 1543 additions and 22 deletions
|
|
@ -20,13 +20,26 @@ node <this plugin's scanners/ide-extension-scanner.mjs> [target]
|
|||
```
|
||||
|
||||
Arguments (pass through as provided by the user):
|
||||
- `[target]` — omit, `.`, or `all` to discover all installed extensions. Absolute path to an extracted extension directory for single-scan mode.
|
||||
- `[target]` — one of:
|
||||
- omit, `.`, or `all` → discover all installed extensions
|
||||
- absolute path to an extracted extension directory → single-scan mode
|
||||
- `https://marketplace.visualstudio.com/items?itemName=<publisher>.<name>` → fetch from VS Code Marketplace
|
||||
- `https://open-vsx.org/extension/<publisher>/<name>[/<version>]` → fetch from OpenVSX
|
||||
- `https://example.com/path/foo.vsix` → direct VSIX download (HTTPS only)
|
||||
- GitHub repo URLs are NOT supported in v6.4.0 (would require build step)
|
||||
- `--vscode-only` / `--intellij-only` — restrict discovery
|
||||
- `--include-builtin` — include Microsoft builtin extensions (default: excluded)
|
||||
- `--online` — enable Marketplace/OSV.dev lookups (opt-in; default: fully offline)
|
||||
- `--format compact|json` — output format
|
||||
- `--fail-on <severity>` — exit 1 if findings at/above severity
|
||||
|
||||
URL mode notes:
|
||||
- Hardened ZIP extractor with caps: 50MB compressed, 500MB uncompressed, 100x expansion ratio, 10 000 entries, depth 20.
|
||||
- Rejects: zip-slip paths, symlink entries, absolute paths, drive letters, encrypted entries, ZIP64.
|
||||
- TLS verified, HTTPS only, 30s timeout. Cross-host redirects rejected.
|
||||
- Temp directory always cleaned up (success, error, abort).
|
||||
- `meta.source` in the envelope contains `{ type: "url", kind, url, finalUrl, sha256, size, publisher, name, version }`.
|
||||
|
||||
Parse the JSON output. The result contains:
|
||||
- `meta.scanner`, `meta.version`, `meta.target`, `meta.extensions_discovered` (per type), `meta.roots_scanned`, `meta.warnings`
|
||||
- `extensions[]` — per-extension results with `id`, `version`, `type`, `publisher`, `source`, `is_builtin`, `signed`, `scanner_results` (IDE/UNI/ENT/NET/TNT/MEM/SCR), `aggregate` (counts, risk_score, risk_band, verdict), `warnings`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue