Bounty proposal: validate static-map coordinates before quantization
Would you fund US$10, payable privately via PayPal after acceptance and merge, for rejecting out-of-range static-map pins before quantization, with focused regression coverage?
At Omi commit c0c7deec0688b72fcf5d1fa469bac902a32ecf50, source blob e52902ab2a41900b68bf5ab11b0a9b2c3f3c807b, backend/utils/static_map.py::parse_pins rounds latitude and longitude to four decimals before enforcing the ±90/±180 bounds. Inputs such as 90.00004,0 and 0,180.00004 therefore round onto the legal boundary and are accepted even though the submitted coordinates are outside it. The same applies on the negative boundaries.
The minimal candidate parses the raw floats, validates their bounds, and only then applies the existing four-decimal quantization used for de-duplication and cache sharing. Valid interior points, exact boundary points, the 50-pin cap, sorting, and de-duplication behavior remain unchanged.
Focused exact-function validation across seven cases: current behavior 3 pass / 4 fail; candidate 7 pass / 0 fail. Cases cover ordinary quantization, both exact boundary pairs, and small excursions beyond north, south, east, and west bounds. I have not run the full backend suite, FastAPI route tests, Redis cache behavior, or a live Google Static Maps request.
Open/closed issue and all-PR searches for parse_pins, static-map bounds, coordinate validation, and the concrete boundary values found no matching report or implementation. No reward or assignment is assumed. Please confirm scope and reward before repository integration.
Prepared with OpenAI Codex assistance for @PlayerBC; AI assistance and actual checks will remain disclosed.
I have implemented the fix for coordinate bounds validation before quantization and submitted PR #13262.
Summary of Changes
- Updated
backend/utils/static_map.py::parse_pinsto parse raw float coordinates and enforce-90 <= raw_lat <= 90and-180 <= raw_lng <= 180before applyinground(..., _PIN_PRECISION). - Added regression tests in
backend/tests/routers/test_static_map.pyverifying that boundary excursions (e.g.90.00004,0,-90.00004,0,0,180.00004,0,-180.00004) raiseMalformedPinsErrorand return HTTP 400, while legal interior and exact boundary coordinates (90.0, 180.0) remain supported and quantized. - Credited @PlayerBC via
Co-authored-by.
Verification
pytest tests/routers/test_static_map.py: 22/22 tests passed.- Pinned code formatter:
scripts/backend-python-format --write. - Repository preflight: all 26 manifest checks passed.
Hi @josancamon19 and @kodjima33,
Now that PR #13262 has been merged into main, could you please confirm if the proposed bounty for this contribution is approved?
Once approved, I will submit my claim details to [email protected] as per the contribution guidelines. Thank you!