-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FLAG-1263: Data mart api client #4966
base: develop
Are you sure you want to change the base?
Conversation
return; | ||
} | ||
|
||
if (slugs.length === 1) { |
Check failure
Code scanning / CodeQL
Type confusion through parameter tampering Critical
this HTTP request parameter
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI 6 days ago
To fix the problem, we need to ensure that the slugs
parameter is always treated as an array of strings. We can do this by checking the type of slugs
and converting it to an array if it is not already one. This will prevent type confusion attacks and ensure that the code behaves as expected.
We will modify the fetchDataByDatasetAndGeostore
and postData
functions to include type checks and conversions for the slugs
parameter. Specifically, we will:
- Check if
slugs
is an array. If not, convert it to an array containing the single value. - Proceed with the existing logic, which assumes
slugs
is an array.
-
Copy modified lines R41-R42 -
Copy modified lines R80-R81
@@ -40,3 +40,4 @@ | ||
// TODO: add more parameters to the query like, global, adm9, adm1, etc etc etc | ||
const { slug: slugs, geostore_id, canopy_cover } = query; | ||
const { slug: slugsParam, geostore_id, canopy_cover } = query; | ||
const slugs = Array.isArray(slugsParam) ? slugsParam : [slugsParam]; | ||
|
||
@@ -78,3 +79,4 @@ | ||
// TODO: add more parameters to the query like, global, adm9, adm1, etc etc etc | ||
const { slug: slugs, geostore_id, canopy_cover } = query; | ||
const { slug: slugsParam, geostore_id, canopy_cover } = query; | ||
const slugs = Array.isArray(slugsParam) ? slugsParam : [slugsParam]; | ||
|
Overview
Brief description of what this PR does, and why it is needed.
Demo
If applicable: screenshots, gifs, etc.
Notes
If applicable: ancilary topics, caveats, alternative strategies that didn't work out, etc.
Testing