-
Notifications
You must be signed in to change notification settings - Fork 9
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
#OBS-I335: hudi spec fix #275
Conversation
|
||
let updatedConfigs = currentConfigs; | ||
if(newConfigs) { | ||
const removeConfigs = _.map(_.filter(newConfigs, {action: "remove"}), "value.field_key") |
Check failure
Code scanning / CodeQL
Loop bound injection High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that newConfigs
is an array before using its .length
property in the loop. This can be done by adding a check to confirm that newConfigs
is an array. If it is not, we can either return an empty array or handle the error appropriately.
-
Copy modified line R138
@@ -137,3 +137,3 @@ | ||
let updatedConfigs = currentConfigs; | ||
if(newConfigs) { | ||
if(Array.isArray(newConfigs)) { | ||
const removeConfigs = _.map(_.filter(newConfigs, {action: "remove"}), "value.field_key") |
let updatedConfigs = currentConfigs; | ||
if(newConfigs) { | ||
const removeConfigs = _.map(_.filter(newConfigs, {action: "remove"}), "value.field_key") | ||
const addConfigs = _.map(_.filter(newConfigs, {action: "upsert"}), "value") |
Check failure
Code scanning / CodeQL
Loop bound injection High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that newConfigs
is an array before using its .length
property in the loop. This can be done by adding a check to confirm that newConfigs
is an instance of an array. If it is not, we should handle the error appropriately, possibly by returning an empty array or throwing an error.
-
Copy modified line R138
@@ -137,3 +137,3 @@ | ||
let updatedConfigs = currentConfigs; | ||
if(newConfigs) { | ||
if(Array.isArray(newConfigs)) { | ||
const removeConfigs = _.map(_.filter(newConfigs, {action: "remove"}), "value.field_key") |
const addConfigs = _.map(_.filter(newConfig.denorm_fields, {action: "upsert"}), "value") | ||
let updatedConfigs = currentConfig.denorm_fields; | ||
if(newConfig) { | ||
const removeConfigs = _.map(_.filter(newConfig.denorm_fields, {action: "remove"}), "value.denorm_out_field") |
Check failure
Code scanning / CodeQL
Loop bound injection High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that newConfig.denorm_fields
is a valid array and has a reasonable length before iterating over it. This can be done by adding a check to confirm that newConfig.denorm_fields
is an array and limiting its length to a safe maximum value.
- Add a check to ensure
newConfig.denorm_fields
is an array. - Limit the length of
newConfig.denorm_fields
to a safe maximum value (e.g., 1000).
-
Copy modified lines R160-R162
@@ -159,2 +159,5 @@ | ||
if(newConfig) { | ||
if (!Array.isArray(newConfig.denorm_fields) || newConfig.denorm_fields.length > 1000) { | ||
throw new Error("Invalid denorm_fields"); | ||
} | ||
const removeConfigs = _.map(_.filter(newConfig.denorm_fields, {action: "remove"}), "value.denorm_out_field") |
let updatedConfigs = currentConfig.denorm_fields; | ||
if(newConfig) { | ||
const removeConfigs = _.map(_.filter(newConfig.denorm_fields, {action: "remove"}), "value.denorm_out_field") | ||
const addConfigs = _.map(_.filter(newConfig.denorm_fields, {action: "upsert"}), "value") |
Check failure
Code scanning / CodeQL
Loop bound injection High
user-provided value
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 month ago
To fix the problem, we need to ensure that newConfig.denorm_fields
is an array before using its .length
property in the loop. This can be done by adding a check to verify that newConfig.denorm_fields
is an array. If it is not, we can either throw an error or handle it gracefully by setting it to an empty array.
-
Copy modified lines R160-R162
@@ -159,2 +159,5 @@ | ||
if(newConfig) { | ||
if (!Array.isArray(newConfig.denorm_fields)) { | ||
throw new Error("Invalid input: denorm_fields should be an array"); | ||
} | ||
const removeConfigs = _.map(_.filter(newConfig.denorm_fields, {action: "remove"}), "value.denorm_out_field") |
No description provided.