Skip to content

Harden local backend security boundaries - #2

Merged
FernandoAbishai merged 13 commits into
mainfrom
security/harden-local-boundaries
Jul 30, 2026
Merged

Harden local backend security boundaries#2
FernandoAbishai merged 13 commits into
mainfrom
security/harden-local-boundaries

Conversation

@FernandoAbishai

Copy link
Copy Markdown
Owner

Summary

This PR implements the highest-priority findings from the ScriptCut security audit:

  • uses one authenticated backend origin (127.0.0.1) in packaged and Electron development runs
  • lets Electron own backend startup during npm run dev, avoiding an unauthenticated duplicate backend
  • enables Electron sandbox/web security and validates IPC senders
  • removes plaintext credential-storage fallback when OS encryption is unavailable
  • narrows CORS to the local Vite origins
  • adds configurable upload size limits, restrictive temp-file permissions, and validated HTTP byte ranges
  • validates custom AI provider destinations to block cleartext remote targets and private-network SSRF
  • replaces unbounded thread creation with a bounded executor and queue backpressure (429)
  • removes duplicate backend packaging from the ASAR payload
  • adds focused security smoke tests

Security invariants

  • privileged local API calls require the per-launch token when launched by Electron
  • remote provider endpoints must use HTTPS and may not resolve to private/link-local/reserved networks
  • loopback HTTP remains supported for Ollama and 9Router
  • background work is limited to a small worker pool and bounded queue
  • existing open/save/project dialog APIs remain unchanged

Validation

The branch includes backend/scripts/smoke_security.py, and npm run smoke:backend now discovers all smoke_*.py tests. CI should run lint, frontend build, existing smoke tests, new security regressions, and Python compilation.

Remaining follow-up

This PR intentionally does not yet redesign local file streaming around capability tokens, pin the full Python dependency graph, or migrate the transcription cache. Those are separate changes to avoid mixing architecture and dependency work into the boundary fix.

@FernandoAbishai
FernandoAbishai marked this pull request as ready for review July 30, 2026 00:33
Copilot AI review requested due to automatic review settings July 30, 2026 00:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@FernandoAbishai
FernandoAbishai merged commit 45c7d44 into main Jul 30, 2026
2 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