Skip to content

fix(src/logic-engine): prevent global prototype pollution in agent sandbox#496

Closed
MatrixNeoKozak wants to merge 1 commit into
the-open-engine:mainfrom
MatrixNeoKozak:fix/improvement-1781461380864
Closed

fix(src/logic-engine): prevent global prototype pollution in agent sandbox#496
MatrixNeoKozak wants to merge 1 commit into
the-open-engine:mainfrom
MatrixNeoKozak:fix/improvement-1781461380864

Conversation

@MatrixNeoKozak

Copy link
Copy Markdown

The logic engine sandbox was incorrectly attempting to prevent prototype pollution by manually freezing global constructor prototypes from the outer scope, which actually caused the reverse effect and introduced a vulnerability by modifying global behavior. This change removes the unsafe manual prototype freezing and reliance on outer-scope constructors, instead relying on vm.createContext to provide a genuinely isolated environment with its own standard globals. This also simplifies the sandbox execution logic and improves security.

@tomdps

tomdps commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator

Thanks for catching this.

I’m going to take this over and push an adjusted version, mainly because the current patch changes how logic scripts are evaluated. Existing Zeroshot trigger scripts are written as function bodies and rely on return, so we need to preserve that contract while fixing the sandbox boundary.

I’ll keep the intent of your change, add regression coverage, and make sure you’re credited for spotting the issue.

@MatrixNeoKozak

Copy link
Copy Markdown
Author

Hi @tomdps! Glad to help with finding this issue. Looking forward to your updated version in PR #521! Thanks!

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