Repository navigation
GridForge v1.7.1 — Security Hardening, Scoped PATs, Bounded Sources & Studio Isolation
Comprehensive security hardening release enforcing explicit hosted API key scopes across HTTP and MCP, confining atlas worker paths and provider/terrain resource budgets, isolating hosted Studio workspaces across account and guest transitions, keeping private map parameters out of browser URLs, and locking down release workflow supply-chain integrity.
Security & Hardening
- Hosted API Key Scope Enforcement, Geocoding Budgets & Body Caps (
src/gridforge/web/{app,auth,db,limits,schemas}.py,src/gridforge/mcp/{http,server}.py,docs/ai-agents.md,deploy/hosted-mode.md):- Enforced explicit per-operation PAT scopes (
planning,jobs:read,jobs:write,projects:read,projects:write,shares:read,shares:write, and standaloneall) across all/api/*routes and/mcptools, keeping account management, API key CRUD, site administration, offline pack management, and cross-tenant share moderation behind browser-session authentication. - Failed closed with
401on legacy keys carrying empty or unrecognized stored scopes, enforcedprojects:readwhen sharing saved projects byproject_id, and forwarded callerrequest.clientinto in-process MCPASGITransportrequests so non-Cloudflare/mcpcallers retain distinct per-IP rate-limit buckets. - Bounded outbound Nominatim geocoding with a single-flight provider slot (
503+Retry-After), per-IP (GRIDFORGE_GEOCODE_HOURLY_LIMIT=30) and shared database-wide (GRIDFORGE_GEOCODE_GLOBAL_HOURLY_LIMIT=300,0disables misses) hourly miss caps in both hosted and local modes, removed raw search queries from logs/usage details, fixed chunked/streamed body overflow handling to return413cleanly, and switched hosted job thumbnails and page previews toCache-Control: private, no-store.
- Enforced explicit per-operation PAT scopes (
- Atlas Worker Confinement, Terrain Preview Budgets & Bounded Open-Data Reads (
src/gridforge/sources/{_cog_ranges,_http,dem_ca_hrdem,osm_overpass,overlays_au_states,overlays_au_states_west}.py,src/gridforge/web/{viewshed,worker,schemas}.py,docker-compose*.yml,docs/DATA_SOURCES.md):- Derived atlas worker scratch workspaces, temporary DEM copies, and sheet PDFs strictly from server-owned sheet ordinals (
sheet_01, ...) under resolvedtmp_work_dirand stripped ASCII control characters fromStripSheetInput.sheet_id. - Bounded terrain previews before source selection (
<= 100 kmRF links,<= 125 kmper side and<= 8,000 km²DEM footprints, antimeridian crossing rejection) and routed live previews through regional non-LiDAR tiers while preserving geodesic-only ruler fallback for wide paths. - Added a loopback single-range COG proxy (
_cog_ranges.py) for NRCan Canadian DEM reads strictly allowlisting NRCan's two AWS Canada Central S3 buckets with redirect refusal, byte/request/time budgets, and clean timeout shutdown. - Bounded Australian/NZ WFS GeoJSON and SA overlay downloads with streaming byte/feature/geometry/time limits, strict redirect validation (HTTPS-only, private/loopback IP rejection, same-host default with explicit
waterconnect.sa.gov.ausubdomain allowlist for SA trails), and direct raw-deflate + local-header/CRC validation of the SA trails ZIP archive to eliminate Pythonzipfilevs GDAL/vsizip/forged-file_sizeZIP-bomb differentials. - Defaulted Overpass to the configured primary endpoint (
OVERPASS_URL) with no third-party fallback mirrors unless operators explicitly opt in viaOVERPASS_FALLBACK_URLS, and declined HTTP redirects on Overpass POST queries.
- Derived atlas worker scratch workspaces, temporary DEM copies, and sheet PDFs strictly from server-owned sheet ordinals (
- Hosted Studio Workspace Isolation & URL Privacy (
web/src/,src/gridforge/web/{auth,schemas}.py):- Reset map camera/layers, uploaded overlay files, form drafts, jobs/projects drawers, Turnstile generation, toasts, and open modals on hosted identity changes, aborting all in-flight requests so prior-account responses cannot populate the next workspace.
- Added an opaque HMAC-derived
workspace_scopetoGET /api/auth/sessionso evenGuest → Guestcookie expiry/resets trigger full workspace resets, deferred 401 Sign-In modal opening until session refresh completes, guardedwindowkeydownshortcuts whilechangeSession()runs, added cross-tabBroadcastChannelsync (including after Google OAuth sign-in), and gaveAdminModal/PacksModalself-containedAbortControllerdisposal. - Consumed incoming legacy deep-link query parameters once on load and removed private map details from
window.locationwhile keeping deliberate?share=snapshots and explicit sharing intact.
- Release Pipeline & Supply-Chain Integrity (
.github/workflows/release.yml,examples/render-examples.sh,docs/RELEASE_CHECKLIST.md,.agents/skills/gridforge-release/SKILL.md):- Hardened
.github/workflows/release.ymlto verify SemVer release tags point to commits on the default branch, pin all GitHub Actions by full commit SHA, scopepackages: writestrictly tobuild-and-push, check out immutable commit SHAs, recordorg.opencontainers.image.revision, pull sample-render images by exact published OCI digest, reserve:vX.Yand:latestfor stable tags, and pinexamples/render-examples.shto a verified multi-arch GHCR digest.
- Hardened
Added & Fixed
- Cloud Dev Workflow & Community Governance (
deploy/cloud-dev.md,.devcontainer/,SECURITY.md,CODE_OF_CONDUCT.md):- Added
SECURITY.mdvulnerability disclosure & hardening architecture documentation,CODE_OF_CONDUCT.md, and cloud VM / Dev Container / CI offloading documentation and bootstrap scripts. - Narrowed base64 error handling and logged caught errors cleanly in the Studio frontend and interactive MCP App (
web/src/,web/mcp-app/).
- Added
Verification
- Automated Suites (
610offline pytest +54frontend tests + live multi-region E2E):- Added
tests/unit/test_preview_work_budgets.py,tests/unit/test_source_work_budgets.py, and expandedtest_agent_api.py,test_shares_api.py,test_web_api.py,test_auth_and_limits.py,web/tests/deeplink.test.mjs,web/tests/modal-dom.test.mjs, andweb/tests/turnstile.test.mjs. - Verified
610offline PyQGIS pytest tests (--network none),54frontend tests + production Studio/MCP App builds (0npm audit --omit=devvulnerabilities), and live multi-region renders including NRCan HRDEM COG range-proxy reads, SA Trails ZIP redirect/validation, and VIC/NT WFS overlays.
- Added
Full Changelog: v1.7.0...v1.7.1