summaryrefslogtreecommitdiff
path: root/plugins/security-guidance/tests/test_bootstrap_spawn_cwd.py
AgeCommit message (Collapse)Author
2026-11-03security-guidance: keep pip's downloads out of the system temp dirMohamed Hegazy
pip keeps each wheel it downloads in a pip-unpack-* folder under the temp dir and removes it only on a normal exit. The SDK bootstrap kills pip at its 120s timeout, so on a slow connection every attempt left its download in the system temp dir, and attempts repeat while the SDK is missing. Both pip installs (venv and --target fallback) now run with a temp folder of their own under the plugin's state dir. It is removed when the attempt ends, however it ends. A folder left by a bootstrap that was itself killed is removed by a later bootstrap run. Refs #6979
2026-10-19security-guidance: run SDK bootstrap subprocesses from the state dirmhegazy/sg-bootstrap-spawn-cwdMohamed Hegazy
`python -c` and `python -m` put the working directory first on the import path, and hooks run in the user's repository. A repository file named claude_agent_sdk.py, venv.py or pip.py was imported in place of the real module by the SessionStart check and the venv build. Run those subprocesses from the plugin's state dir, and make state_dir() return an absolute path as its docstring says, so a relative override isn't resolved twice.