Skip to content

[CALCITE-7860] Add controls for remote fetches on file adapter - #5334

Open
rubenada wants to merge 3 commits into
apache:mainfrom
rubenada:CALCITE-7860
Open

rubenada wants to merge 3 commits into
apache:mainfrom
rubenada:CALCITE-7860

Conversation

@rubenada

@rubenada rubenada commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Jira Link

CALCITE-7860

Changes Proposed

Disable remote fetches by default to comply with threat model. Add new opt-in property to enable this feature.

@zabetak zabetak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding two new properties for filtering URLs based on protocols and hosts why not simply going for a single property defining a list of allowed URL prefixes (e.g., calcite.file.urls.allowed). This would simplify documentation, implementation, and usage.

@rubenada

Copy link
Copy Markdown
Contributor Author

@zabetak what about proposing something like calcite.file.urls.allowed=https:,http://data.example.com/datasets/ , where:

  • An entry that is only a scheme (for example https:) allows any URL with that scheme, whatever its host, port and path.
  • Otherwise, in case of a "full" url (for example http://data.example.com/datasets/), it must be a match: the scheme must be equal (case-insensitive), the host must be equal (case-insensitive, exact, so that example.com does not admit my-example.com nor example.com.other.org), the port must be equal (an entry or URL without a port stands for the scheme's default port), if the entry has a path other than /, it must be equal to it or lie beneath it (e.g. http://data.example.com/datasets/t.csv would admitted in our example, but not http://data.example.com/datasets-abc)

@zabetak

zabetak commented Oct 26, 2026

Copy link
Copy Markdown
Member

calcite.file.urls.allowed=https:,http://data.example.com/datasets/ is inline with the simpe check I had in mind:

for(String prefix: allowedPrefixes) {
  if(url.startWith(prefix) {
    return true;
  }
}
return false;

As a conf separator the pipe char | is probably safer than comma ,.

@rubenada

Copy link
Copy Markdown
Contributor Author

startsWith check might be a bit problematic (https://data.example.com would let in https://data.example.com.bad.com/). I have pushed a refactoring with a bit more thorough validation based on url parts.

@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants