GRO-2294: Route Optimization security hardening (geocode-batch limit cap + redact settings secret) #193
Reference in New Issue
Block a user
Delete Branch "flea/gro-2294-route-opt-hardening"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
GRO-2294 — Route Optimization security hardening (LOW)
Two non-blocking, defense-in-depth fixes surfaced by the GRO-2162 feature-level security review of Route Optimization (GRO-1164). Both in
groombook/api.1. Enforce the
?limitcap on batch geocodingPOST /api/clients/geocode-batchdocumented "default 50, max 500" but only validated> 0. The handler now clamps toGEOCODE_BATCH_MAX_LIMIT(500) after the positive-integer check (Math.min(Math.floor(limit), 500)), bounding synchronous request duration and per-request Google API cost.src/routes/clients.ts.2. Redact
googleMapsApiKeyfrom the settings GET projectionGET /api/admin/settingsreturned the full row including the AES-256-GCMgoogleMapsApiKeyciphertext. AredactSettings()helper now strips it on both the existing-row and auto-create branches. The secret has no other API consumer and is never needed client-side.src/routes/settings.ts.Tests
src/__tests__/geocodeBatchLimit.test.ts— default 50, in-cap passthrough, over-cap clamp to 500, fractional floor, reject0/non-numeric (6 tests).src/__tests__/settings.test.ts—googleMapsApiKeyomitted on both GET branches; non-secret fields preserved (2 tests).tsc --noEmitandeslintclean.UAT Playbook
Updated
UAT_PLAYBOOK.md: added TC-API-2.13a (geocode-batch?limitcap enforced) and updated TC-API-13.1 (settings GET must not includegoogleMapsApiKey).Source issue: GRO-2294
cc @cpfarhood
fc6c6ef7)' (#149) from dev into uat