After looking into the code, I think the workaround (removing some Flags from ALL_VERIFY_FLAGS) is not a workaround, but a valid and needed change, in order to keep the existing functionality.
Still, I consider that a deep research into the code is needed, in order to refactor all the uses of these Flags. Since these Flags affect the way the script is executed, the different invocations to the script engine should be aware of what flags are being used (as a parameter, for example). At this moment, these Flags are hardcoded, and that should not be the case (unless there is a clear consensus about that).
The current commit runs OK and the legacy tests also run OK. But we should make it clear that ALL_VERIFY_FLAGS doen NOT measn ALL of them, just the ones that allow a "safe" script execution.