Skip to content

feat(core): implement security sandbox for template execution - #159

Merged
JacksonFergusonDev merged 5 commits into
mainfrom
feature/security-sandbox
Aug 14, 2026
Merged

feat(core): implement security sandbox for template execution#159
JacksonFergusonDev merged 5 commits into
mainfrom
feature/security-sandbox

Conversation

@JacksonFergusonDev

Copy link
Copy Markdown
Owner

Overview

As Protostar transitions to allowing remote template execution (protostar init --from <url>), it is critical to ensure that external templates cannot write files outside the project directory or invoke arbitrary shells. This PR implements a comprehensive security sandbox within the SystemExecutor.

Changes

  • Zip Slip Protection: Added safe_extract_zip to fs.py to prevent path traversal when extracting .zip archives.
  • Path Jail Guardrail: Introduced _enforce_path_jail to ensure all file injections and scaffolding directives are strictly confined to the workspace.
  • Binary Safelist Guardrail: Introduced _enforce_binary_safelist to prevent execution of arbitrary shells and limit system tasks to a curated whitelist of safe binaries (uv, git, npm, yarn, pnpm, pre-commit, direnv).
  • Domain Errors: Added SecurityViolationError for explicit vulnerability handling.
  • Comprehensive Test Suite: Added 100% test coverage for bypass scenarios including directory traversal, symlink spoofing, and binary evasion.

@JacksonFergusonDev
JacksonFergusonDev merged commit 5ed42fd into main Aug 14, 2026
10 checks passed
@JacksonFergusonDev
JacksonFergusonDev deleted the feature/security-sandbox branch August 14, 2026 23:57
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.

1 participant