fix: restrict Substrait physical local file imports#23172
Open
ametel01 wants to merge 2 commits into
Open
Conversation
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.
Which issue does this PR close?
Rationale for this change
Imported Substrait physical plans currently turn
ReadRel.LocalFilesentries into a local filesystem-backed ParquetDataSourceExecwithout requiring the embedding host to approve the referenced local paths. In hosts that accept physical Substrait plans from lower-trust callers, that can let serialized plan input select process-local Parquet files outside intended dataset roots.This change makes local file access during physical plan import explicit instead of ambient.
What changes are included in this PR?
PhysicalPlanConsumerOptionsfor Substrait physical plan import.from_substrait_relas a default-deny wrapper for local file imports.from_substrait_rel_with_optionsso callers can opt in with allowed local file roots.Are these changes tested?
Yes.
cargo fmt --all --checkcargo test -p datafusion-substraitcargo clippy -p datafusion-substrait --all-targets --all-features -- -D warningscargo clippy --all-targets --all-features -- -D warningsAre there any user-facing changes?
Yes. Substrait physical plan consumers that import
ReadRel.LocalFilesnow need to callfrom_substrait_rel_with_optionsand explicitly configure allowed local file roots. The existingfrom_substrait_relAPI no longer imports local files by default.This is an intentional security hardening change. It may require the
api changelabel because it changes behavior for the existing public API and adds a new opt-in API.