The analysis of the provided patches and vulnerability description indicates a prototype pollution vulnerability in @nyariv/sandboxjs. The root cause is the improper handling of property access for __proto__ within the sandbox's executor logic.
The primary vulnerable function is an anonymous function registered to handle property access (LispType.Prop) within the addOps function in src/executor.ts. The patch in commit d9aa71ae4d1804bc57e5803dae3501432bfa1bff introduces a check for b === '__proto__', ensuring that any attempt to access or modify the prototype chain is properly validated against the configured whitelist. Before this patch, there was no explicit check, allowing malicious code to pollute Object.prototype.
The Sandbox.compile function is also identified as a relevant function, although with medium confidence. It is the main entry point for user-supplied code to enter the sandbox. While the flaw is not in the compile function itself, it is the function that a developer would use to execute untrusted code, which in turn would trigger the vulnerability during its execution by the flawed property access handler. Therefore, a runtime profile of an exploit would likely show Sandbox.compile in the call stack leading to the vulnerable code in the executor.