Please report security issues privately to the repository owner via GitHub Security Advisories on https://github.com/machine-made/vscode-pdf-next/security/advisories/new, or by opening a minimal public issue asking for a private contact channel.
Do not include exploit details in public issues.
| Date | Auditor | Scope | Result |
|---|---|---|---|
| 2026-04-30 | Claude Opus 4.7 | src/, lib/*.mjs, tools/, workflows |
0 actionable, 2 hardening |
| 2026-04-29 | Pi security pass | release workflows, packaging, risky API pattern scan | 0 actionable findings |
| 2026-04-27 | Claude Opus 4.7 | src/, CSP, vendored PDF.js, npm advisories |
1 critical, 1 high, 2 medium |
The 2026-04-27 findings are remediated across 1.3.0 and 1.4.0. The
2026-04-30 hardening items landed in the same pass.
Scope. Repository-authored TypeScript and webview JavaScript (src/,
lib/main.mjs, lib/polyfills.mjs, lib/pdf.worker-wrapper.mjs),
tools/scan_vsix.mjs, and .github/workflows/. Vendored PDF.js excluded.
Method. Pattern scan for GitHub Actions injection, shell execution APIs, dynamic code evaluation, browser XSS sinks, plus a manual review of the webview message contract, CSP construction, and PDF link path-traversal handling.
Findings. No actionable findings. Two low-severity hardening items addressed in the same pass:
release.ymlaccepted anyrelease_tagstring fromworkflow_dispatch. Added a^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.-]+)?$regex check at the top ofvalidate_releaseso malformed tags fail beforebun installand before any shell expansion that depends on the tag value.- Documented the trusted-workspace
printCommandboundary below.
Verified clean.
- Webview CSP pins
script-srcto a per-rendercrypto.randomBytes(16)nonce pluscspSource; no'unsafe-inline'or'unsafe-eval'. - Host-side message handler rejects unknown types and unknown keys via the
closed allowlist in
src/webviewContract.ts. resolvePdfLinkTargetrejects URI schemes, absolute paths, and any resolved target whosepath.relativeescapes the resource directory.src/print.tsandtools/scan_vsix.mjsusespawn/execFileSyncwith argument arrays; no shell expansion path.- All dynamic DOM writes in
lib/main.mjsusetextContent. The single first-partyinnerHTMLfinding is inside vendored PDF.js and is out of scope per the boundary defined here.
Trusted-workspace printCommand. When the active workspace is trusted,
pdf-preview.printCommand is read from workspace settings and the resolved
binary is launched via child_process.spawn with an argument array.
spawn(command, args) does not invoke a shell, so a hostile workspace cannot
inject shell metacharacters, but the command itself is operator-controlled.
This is by design: VS Code Workspace Trust is the established boundary. Users
who do not trust a workspace fall back to inspect().globalValue /
defaultValue, so a malicious .vscode/settings.json
in an untrusted workspace cannot override the print command.
Scope. Focused release-readiness review of .github/workflows/,
repository-authored source, VSIX packaging/scanner scripts, and production npm
advisories for the 2.0.0 public release.
Method. Pattern scan for GitHub Actions injection risks, shell execution
APIs (exec, execSync), dynamic code execution (eval, new Function),
browser XSS sinks (innerHTML, document.write, unsafe React HTML), Python
risky APIs, plus npm audit --omit=dev --audit-level=high.
Findings. No actionable findings.
Verified clean.
- GitHub Actions use
github.eventonly in a top-level concurrency expression, not inside shellrun:blocks. - Third-party workflow actions are pinned by full commit SHA.
- Marketplace/Open VSX publish secrets are only exposed in the
marketplace-publishenvironment-gated job. - No repository-authored
exec,execSync,eval,new Function,innerHTML, ordocument.writehits outside vendored PDF.js. npm audit --omit=dev --audit-level=highreports 0 vulnerabilities.tools/scan_vsix.mjsrejects source files, maps, tests, scratch/temp files, and missing PDF.js runtime assets in release packages.
Status. Release automation and packaged-artifact checks are suitable for the
2.0.0 public release, assuming the GitHub marketplace-publish environment is
configured with required reviewers before registry tokens are added.
Scope. Static review of src/extension.ts, src/pdfProvider.ts,
src/pdfPreview.ts, the webview Content-Security-Policy, the vendored
PDF.js version under lib/, npm audit --omit=dev, and the
.github/workflows/ directory.
Method. Pattern scan for shell-execution APIs, dynamic code evaluation, browser XSS sinks (innerHTML assignment, document write, React unsafe HTML props), Python risky APIs (n/a — Node project), GitHub Actions injection (n/a — no workflows), and a manual review of the webview HTML construction and message channel.
Findings.
- Critical — Vendored PDF.js
3.1.81was affected by CVE-2024-4367 (arbitrary JavaScript execution via crafted PDF, fixed in 4.2.67). Remediated in1.4.0by migrating the vendored runtime topdfjs-dist@5.6.205; PDF.js eval support remains disabled. - High — Webview CSP used
script-src 'unsafe-inline', which defeats CSP's protection against script injection in the viewer. Remediated in1.3.0with a per-load script nonce. - Medium —
localResourceRootsneeded tighter bounds. Remediated in1.3.0by limiting roots to the extension directory and the opened PDF's containing directory, which is the directory-style boundary VS Code webviews support for local resources. - Medium — CSP omitted
worker-src; PDF.js spawns a Web Worker. Remediated in1.3.0.
Verified clean.
- No shell-execution or dynamic code evaluation in repository-authored code.
- No unsafe HTML sinks in
src/. npm audit --omit=devreports 0 vulnerabilities.npm audit --audit-level=highreports 0 high or critical vulnerabilities; the remaining dev-only advisories are moderate findings in@vscode/vsce's Azure auth dependency chain.- No secrets, tokens, or API keys in source.
- No GitHub Actions workflows present, so no workflow-injection surface.
Status. Webview hardening and the PDF.js 5 runtime migration landed in v1.4; PDF.js ran with JavaScript evaluation and WASM disabled.
Update (2026-08). The vendored runtime is now pdfjs-dist@6.2.108.
PDF.js 6 removed its eval-based font/PostScript code paths upstream, and the
release compat check (tools/check_pdfjs_runtime_compat.mjs) now asserts that
no eval( or new Function( exists anywhere in the vendored core, worker, or
viewer bundles — a stronger guarantee than the removed isEvalSupported
flag. PDF parsing runs in a real Web Worker (the webview never statically
imports the worker bundle onto the main thread), and the integration tests
assert the real worker spawns via the viewer-ready event's workerType
field. WASM execution remains disabled (useWasm: false with the OpenJPEG
JavaScript fallback). Document bytes now travel from the extension host to
the viewer over the webview message channel, so localResourceRoots is
restricted to the extension directory alone — the webview can no longer load
anything from the opened PDF's directory.
Update (2026-10). The vendored runtime is now pdfjs-dist@6.4.299, and
WebAssembly is enabled for PDF.js's image decoders only. With
useWasm: false, the worker tried to import JavaScript fallback decoders from
the extension folder, and a worker in a VS Code webview cannot load them. JBIG2,
CCITT fax and JPEG 2000 images, which is how most scanned pages are stored,
were left out of the page without an error. The webview CSP now adds
'wasm-unsafe-eval' to script-src. That keyword permits WebAssembly
compilation; it does not permit eval() or new Function(), and the CSP still
has no 'unsafe-eval'. The package ships exactly two modules,
lib/pdfjs/wasm/jbig2.wasm and lib/pdfjs/wasm/openjpeg.wasm, copied from the
integrity-checked pdfjs-dist tarball. tools/scan_vsix.mjs rejects any other
.wasm file and fails a package that is missing either module. The PDF
scripting engine (quickjs-eval.wasm) and the colour-management module
(qcms_bg.wasm) are not shipped.