Skip to content

Fix security, reliability, and quality issues from verification sweep - #6

Merged
Printaga merged 1 commit into
mainfrom
freebuff/verify-and-fix-all-issues-below-update-the-changel-53abe7ce-de0b-4f78-b2a9-aaa9c21986aa
Sep 28, 2026
Merged

Printaga merged 1 commit into
mainfrom
freebuff/verify-and-fix-all-issues-below-update-the-changel-53abe7ce-de0b-4f78-b2a9-aaa9c21986aa

Conversation

@Printaga

Copy link
Copy Markdown
Owner

Summary

Full verification-and-fix pass across the top issues, module hotspots, and quick wins:

Security

  • Command/shell injection: execSync string interpolation replaced with argv-array execFileSync / node:fs in postinstall-patch.mjs, native-addons.ts, and the download/clean-up scripts; Windows shell: true seam in shell.ts hardened.
  • Webview XSS: escapeHtml now escapes quotes, inline onclick attributes removed, CSP tightened (no unsafe-inline, explicit connect-src), remote Google Fonts @import removed.
  • Cross-window message handling: all four webview listeners validate event.data via a shared guard (webview/messages.ts) before trusting payloads; message-serializer parses defensively.
  • Path traversal: @mention resolution constrained to the workspace root; MOCHA_TEST_FILE and loader.cjs sub-path imports refuse root escape.

Reliability / correctness

  • Fail-open CI fixed: signal-terminated and spawn-failed runs reported distinctly (verify.mjs, fallow-audit.mjs, run-node-tests.mjs, runTest.ts, test scaffold); watchdog/no-result paths exit non-zero.
  • pi-binary.ts bare-name resolution works again (was spawning a shell builtin with shell: false).
  • loader.cjs: package-name typo fixed, doc URLs extracted, timeouts on which/where, no duplicate process-wide Module._resolveFilename hook, bare imports resolved via the package exports map.
  • Host-side: per-item settle on multi-session delete, voice temp-file/listener cleanup, Mermaid cache cap + stale-render race fix, PiPackagesPanel batched registry lookups with stale-response discard, App.svelte clears stale tool state on errors/new session.
  • Hardcoded values removed: machine-specific home path, Linux distro paths, fixed tmpdir singletons, pinned VS Code version → env/config.

Quality

  • Mocks no longer mask SDK drift (overrideable Proxy, disposeCalls tracking, no double listener fire, no dup handler registration).
  • Deduplicated PiAgentConfig/ThinkingLevel/SessionNode and the per-component sendMessage clones; consolidated ABI-scan logic.
  • a11y wiring (aria-describedby, Space handling, focusable dialogs), prefers-reduced-motion guards, timer/cache/log caps.
  • Config hygiene: invalid pnpm-workspace.yaml keys removed, tsconfig redundancy trimmed, .vscodeignore no longer ships nested env/secret files.

Verification

  • pnpm run verify: all 6 stages green (check, lint, format, 661 unit tests, webview tests, fallow audit — 0 introduced findings).

Changelog

Updated CHANGELOG.md under [Unreleased] with a line per fix.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff noreply@codebuff.com

Addresses injection (argv arrays instead of shell strings), webview XSS
(quote escaping, no inline handlers, tightened CSP), cross-window message
validation, path traversal in @mentions, fail-open CI tooling, hardcoded
machine paths/versions, mock drift, and duplicate definitions.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
Comment thread src/pi-binary.ts
Comment on lines +240 to +247
const result = piBinaryInternals.spawnSync(
"/bin/sh",
["-c", 'command -v "$1"', "sh", binary],
{
shell: false,
timeout: 1000,
},
);
@Printaga
Printaga merged commit be3a688 into main Sep 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants