✨ feat(mq-lang,mq-run): add --allow-env sandbox flag - #2091
Merged
Conversation
$VAR/${$VAR} interpolation and debugger logpoints previously read any
host environment variable regardless of --allow-read/write/net/run,
letting an untrusted query exfiltrate secrets into its output. Gate
env_var behind SandboxedIo the same way, fail-safe deny by default,
with --allow-env / --allow-env=NAME,... to opt in (mirrors --allow-read/
--allow-write's PathAccess shape via a new EnvAccess type).
Distinguishes "not permitted" from "not found" via a new
SyntaxError::EnvNotAllowed for parse-time $VAR, and the existing
generic RuntimeError::Runtime for the interpolation/logpoint paths.
…bmodules PathAccess and EnvAccess were both defined inline in sandboxed.rs alongside SandboxedIo itself. Move each into its own file under io/sandboxed/ (path_access.rs, env_access.rs) so the module mirrors the type it groups, keeping sandboxed.rs focused on SandboxedIo.
README.md and docs/books/src/reference/cli.md's CLI option listing is regenerated from the released mq binary's --help output via scripts/update_doc.sh, not the in-development one. Adding these two flags' entries by hand ahead of release would just get reverted (and diverge from) the next real docs sync, and can fail CI in the meantime. They'll appear automatically once mq itself is released with --allow-run/--allow-env.
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
Type of Change
Checklist
cargo fmtandcargo clippyand addressed any warningsjust test-alland all tests pass/docs, crateREADME.md) if neededAdditional Context