-
-
Notifications
You must be signed in to change notification settings - Fork 213
Closed
Labels
Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server and the Parse Flutter SDK.
Issue Description
Lines 14-17 and 18-21 validate latitude against longitude bounds instead of validating longitude. This means:
- Longitude is never validated, allowing invalid coordinates like
(0.0, 200.0)to pass. - Valid latitudes in the range [90, 180) would incorrectly fail the assertion.
Apply this diff to fix the validation:
assert(
- latitude < 180,
+ longitude < 180,
'Longitude must be within the range (-180.0, 180.0).',
),
assert(
- latitude > -180,
+ longitude > -180,
'Longitude must be within the range (-180.0, 180.0).',
);📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
assert(
longitude < 180,
'Longitude must be within the range (-180.0, 180.0).',
),
assert(
longitude > -180,
'Longitude must be within the range (-180.0, 180.0).',
);
🤖 Prompt for AI Agents
In packages/dart/lib/src/objects/parse_geo_point.dart around lines 14 to 21, the
two assertion checks are incorrectly validating the variable latitude against
longitude bounds; change both assertions to validate longitude instead (i.e.,
assert(longitude < 180, 'Longitude must be within the range (-180.0, 180.0).')
and assert(longitude > -180, 'Longitude must be within the range (-180.0,
180.0).')), leaving the messages intact so longitude is actually validated and
latitude assertions remain correct elsewhere.
coderabbitai and Copilot