Repository navigation
GridForge v1.6.1 — Security Hardening, MapLibre v6 & Performance Optimizations
Comprehensive security hardening, container least-privilege, and end-to-end GIS/web performance optimization release upgrading MapLibre GL JS to v6, isolating web secrets from GIS subprocesses, hardening proxy/origin verification, bounding hosted storage & DoS vectors, and substantially accelerating terrain derivation, PyQGIS styling, exports, and web/Studio responsiveness.
Security & Hardening
- Non-Root Multi-Stage Container & Secret Isolation (
Dockerfile,.dockerignore,src/gridforge/subprocess_env.py,src/gridforge/web/entrypoint.py):- Split
Dockerfileintotestand lean non-rootruntime(USER 10001:10001, zeropytestin production) with.dockerignoreand automatic root-to-10001volume ownership handoff when launched withRAILWAY_RUN_UID=0. - Added allowlisted
build_safe_subprocess_env()stripping web/cloud credentials (GRIDFORGE_SESSION_SECRET, admin/OAuth/Turnstile/origin secrets, AWS/GitHub/Railway tokens) from worker, PyQGIS, supplement, and GDAL/OGR subprocesses, and disabling GDAL/vsicurl/(CPL_VSIL_CURL_ALLOWED_EXTENSIONS=.nonexistent) for untrusted overlay parsing.
- Split
- Origin-Proxy Auth, Private Proxy Trust & Strict CSP (
src/gridforge/web/{access,app,auth,limits}.py,web/src/):- Replaced
FORWARDED_ALLOW_IPS=*defaults with private proxy CIDRs, stopped auto-trustingRAILWAY_PUBLIC_DOMAINwhenGRIDFORGE_ALLOWED_HOSTSis explicitly set, and addedOriginProxyAuthMiddleware(GRIDFORGE_ORIGIN_PROXY_SECRET/X-GridForge-Origin-Secret) with constant-time comparison while permitting Railway's internal/api/healthprobe. - Added strict HTTP security headers (
Content-Security-Policy, HSTS,X-Frame-Options: DENY,X-Content-Type-Options: nosniff,Referrer-Policy,Permissions-Policy), eliminated inline JS/event handlers across the Studio SPA (<script id="gf-brand" type="application/json">), disabled/docs//redoc//openapi.jsonin hosted mode (404, opt-in viaGRIDFORGE_ENABLE_DOCS=true), enforced global request body caps and per-account login throttling, and scrubbed internal paths/tracebacks from hosted errors.
- Replaced
- Upload, Injection, Remote Fetch & Dependency Hardening (
web/package.json,pyproject.toml,src/gridforge/sources/,src/gridforge/render/layout.py):- Upgraded
maplibre-gl(5.24.1→^6.19.0) patching critical XSSGHSA-jrc7-96c5-q579(0productionnpm auditvulnerabilities) and bumpedpypdf>=7.0.1,pillow>=13.0.0,fastapi>=0.115.12,h11>=0.16.0, andpython-multipart>=0.0.31. - Hardened
UserOverlaySource(overlay_user.py) against XXE/billion-laughs XML, KMZ zip bombs, symlink escapes, and/vsicurl/SSRF; added QGIS expression/XML escaping inlayout.pyanddeclination.py; added explicit timeouts, HTTPS/hostname allowlists, disk-to-disk streaming caps, and secret-redacted logging across remote DEM/OSM/overlay fetchers; hardened pack builds with 4° custom span caps, atomic staging, and duplicate-build locking.
- Upgraded
- Hosted Storage Bounds & DoS Prevention (
src/gridforge/web/{projects,worker,db}.py,web/src/main.ts):- Bounded anonymous Guest saved projects with a
64 KBpayload cap, per-guest cap (GRIDFORGE_MAX_PROJECTS_PER_GUEST=5), hourly rate limit (GRIDFORGE_GUEST_PROJECT_HOURLY_LIMIT=20), and global cap (GRIDFORGE_MAX_GUEST_PROJECTS=500) with automatic expired/oldest eviction on insert. - Wired
GRIDFORGE_ADMIN_TTL_HOURS(720default in hosted mode,0disables) intoworker.pyanddb.pyto protect bounded persistent volumes, and stopped auto-firing up to 30 DEM preview requests on?share=/ deep-link load in Studio (explicit user-triggered Compute buttons). - Extended
scripts/release_preflight.pyprivacy scanning tosrc/,tests/, andweb/src/, hardenedscripts/render_release_samples.shtar extraction flags, and documented all new env vars indeploy/hosted-mode.md.
- Bounded anonymous Guest saved projects with a
Performance
- Web API, SQLite & Studio Frontend (
src/gridforge/web/{db,app}.py,src/gridforge/cli.py,web/src/):- Added thread-local SQLite connection pooling, composite job/usage indexes, and single-query
get_admin_usage_report()aggregation; addedGZipMiddleware, immutable1 yrcaching on content-hashed/assets/*, and mtime-fingerprinted pack discovery caching. - Added visibility-aware background polling and lazy-loaded
PacksModal/AdminModalbundles in Studio, plus lazy CLI imports incli.py.
- Added thread-local SQLite connection pooling, composite job/usage indexes, and single-query
- GIS Pipeline, Terrain, PyQGIS & Exports (
src/gridforge/{geo,pipeline,render,export,packs}/):- Cached WGS84↔UTM transformers (
src/gridforge/geo/crs.py), addedPointDeclinationfast path (src/gridforge/geo/declination.py), batched DEM elevation sampling in waypoints/tactical overlays, added OGR transaction batching across vector builders,-spatR-Tree pre-filtering in AU/US overlay fetchers,-gt 65536+ attribute indexes insrc/gridforge/pipeline/normalize.py, and schema-verifiedsetSubsetStringfilters insrc/gridforge/render/styles.py. - Accelerated
src/gridforge/pipeline/terrain.pywith threaded GDAL, skipped redundant UTM warps, eliminated intermediatedem_utm_ft.tif, ran hillshade/contours/slope/viewshed concurrently, and downsampled LiDAR viewsheds to 10 m. - Batched supplement PDF generation into a single subprocess (
src/gridforge/geo/supplements.py), parallelized fetch/normalize/pack stages (src/gridforge/pipeline/runner.py,src/gridforge/packs/builder.py,src/gridforge/packs/basemap_builder.py), sharedEPSG:3857warping and MBTiles reuse across MBTiles/GeoPackage/OsmAnd exports, parallelized Garmin KMZ JPEG encoding, and streamed chunkedQImage→ GeoTIFF writes insrc/gridforge/export/raster.py.
- Cached WGS84↔UTM transformers (
Verification & Container Images
- Multi-Arch Container Image (
linux/amd64+linux/arm64):ghcr.io/jremick/gridforge:v1.6.1(also tagged:v1.6and:latest) - Automated Verification:
553offline pytest +44frontend tests +26live multi-region open-data E2E renders +0productionnpm auditvulnerabilities - Attached Showcase Assets: 5 verified 300–600 DPI vector sample PDFs across US (Boulder 1:10k 600 DPI & Yosemite Alpine), Canada (Banff Night-Red), Australia (Mt Kosciuszko RF Viewshed & 915 MHz Fresnel Link Card), and New Zealand (Tongariro LINZ 1 m LiDAR).