fix(selfhost): isolate subscription cli environments#1392
Open
JSONbored wants to merge 1 commit into
Open
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
process.env, exposing runtime secrets to prompt-injectable reviewer subprocesses.Description
SUBSCRIPTION_CLI_ENV_ALLOWLISTandsubscriptionCliEnv()to build a minimal env for subscription CLIs instead of spreadingprocess.envinto subprocesses.isolatedCliCwd()and threadcwdthrough the sharedSpawnFn/defaultSpawn()so each CLI runs from an isolated temporary directory.createClaudeCodeAi()andcreateCodexAi()to usesubscriptionCliEnv()and launch subprocesses with the isolatedcwdand the allowlisted env only.test/unit/selfhost-ai.test.tsto assert the subprocess env is allowlisted, that Codex flags/args remain correct, and that the subprocesscwdis isolated.Testing
npx vitest run test/unit/selfhost-ai.test.ts --reporter=dot, which passed (45tests passed).npm run typecheck, which completed successfully.npm run test:coverage, but coverage remapping failed due to a toolchain error (ast-v8-to-istanbulTypeError: jsTokens is not a function), so coverage reporting could not be produced in this environment.Codex Task