Fix: arcgis allowed hosts#75
Draft
cstirry wants to merge 3 commits into
Draft
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.
Problem
The ArcGIS plugin validates Feature Service URLs against an allowlist. Only URLs hosted on
*.arcgis.comor the configuredportal_urldomain are trusted. This may work for portals where the Hub API and Feature Services share the same domain, but breaks for cities where they don't.For example, on DC's open data portal (
opendata.dc.gov), most of the actual Feature Services are hosted on a separate domain (maps2.dcgis.dc.gov). This causesquery_datato fail with:This has been observed in two ArcGIS deployments and without a fix the ArcGIS plugin is not production-ready:
maps2.dcgis.dc.govopendata.baltimorecity.govFix
Adds an optional
allowed_hostsfield toArcGISPluginConfig. Any hostnames listed there are trusted in addition to*.arcgis.comand the portal domain. Theopencontext configurewizard prompts for this value during ArcGIS setup, soconfig.yamlis written correctly without manual editing.A more robust long-term solution may be to auto-detect additional domains from Feature Service URLs at configure time, but that requires more experimentation.
Current Files changed
plugins/arcgis/config_schema.py — adds allowed_hosts: List[str] field
plugins/arcgis/plugin.py — passes allowed_hosts to _validate_feature_url; updates method to check the list
cli/commands/configure.py — adds a prompt for extra trusted hosts in the ArcGIS wizard step
To configure for DC:
When running
opencontext configure, entermaps2.dcgis.dc.govat the new prompt. Assuming this is unique for all cities, or if not may want to automatically add this instead?Screenshot Before

Screenshot After