fix(security): remove unsafe in-process transform executor fallback#5
Open
BentWorks wants to merge 1 commit intorookiestar28:mainfrom
Open
fix(security): remove unsafe in-process transform executor fallback#5BentWorks wants to merge 1 commit intorookiestar28:mainfrom
BentWorks wants to merge 1 commit intorookiestar28:mainfrom
Conversation
The `get_transform_executor()` function fell back to the in-process `TransformExecutor` when `TransformProcessRunner` was unavailable. The in-process executor uses `threading.Thread` with `join(timeout=…)`, but Python threads cannot be forcefully terminated — a malicious or runaway transform could escape the timeout constraint and continue executing indefinitely in the host process with full access to its address space. This patch: - Changes `get_transform_executor()` to raise `RuntimeError` instead of silently falling back to the unsafe thread-based executor, following the codebase's fail-closed security posture. - Adds deprecation documentation to `TransformExecutor` class explaining why it is unsafe and that `TransformProcessRunner` (S35) should always be used. - Adds regression tests verifying the fail-closed behavior when the subprocess runner is unavailable and the normal case when it is. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Owner
|
Thanks for the security hardening direction. I agree with removing the unsafe in-process fallback, but this PR is not merge-ready yet due to an error-handling contract gap. Why this should not be merged yet
Required changes before merge
|
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.
Summary
get_transform_executor()silently fell back to the in-processTransformExecutorwhenTransformProcessRunner(S35) was unavailable. The in-process executor usesthreading.Threadwithjoin(timeout=…), but Python threads cannot be forcefully terminated. A malicious transform module could ignore the timeout and continue executing indefinitely in the host process with full access to its address space, network, and filesystem.get_transform_executor()to raiseRuntimeErrorwhenTransformProcessRunneris unavailable, following the codebase's established fail-closed security posture. TheTransformProcessRunnerusessubprocess.run(timeout=…)which kills the child process on timeout, and the worker subprocess denies network access via socket monkeypatching.TestGetTransformExecutorFailClosedclass verifying both the fail-closed behavior and the normal subprocess runner path.Files Changed
services/constrained_transforms.py— Replaced silent fallback withRuntimeError; added deprecation docs toTransformExecutortests/test_s35_transform_isolation.py— AddedTestGetTransformExecutorFailClosedtest classTest plan
TestS35TransformIsolationtests continue to pass (3/3)TestGetTransformExecutorFailClosedtests pass (2/2)TransformProcessRunneris availableDisclosure
This vulnerability was identified during an AI-assisted security audit using Claude Code. The patch was also authored with AI assistance.
🤖 Generated with Claude Code