Sandboxing Power Fx Execution #2606
Mike Stall (MikeStall)
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Here are some notes on sandboxing Power Fx execution for safely executing arbitrary expressions in a multi-user server.
Assume the host is a server and each incoming request is a executing a power fx expression.
Practically, this means:
An expression can only access the data explicitly provided to it via the host.
An expression can't DOS the host.
This means the host can govern resource execution of the expression and reliably abort the expression at any point. Particularly interesting resources are:
Principles to enable safety
Power Fx has design and implementation principles to ensure safety:
The language design:
The implementation has several design principles:
Hosting APIs
Here's guidance to a host to enforce safe execution, in recommended priority order:
There are some unit tests demonstrating how the host can configure these:
https://github.com/microsoft/Power-Fx/blob/main/src/tests/Microsoft.PowerFx.Interpreter.Tests.Shared/SandboxTests.cs
Hosting design guidance
The host should be careful of what data and custom functions it passes an expression.
By default, Power Fx expressions are very constrained and have no I/O, and then the host enables additional abilities:
For example, if the host provided a custom function that allowed reading arbitrary files, then the expression could use that to read arbitrary files and break out of the sandbox.
All reactions