-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix for undefined state API issue in the GetIncidentTasks automation #42557
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
base: master
Are you sure you want to change the base?
Conversation
|
@content-bot please review |
|
🤖 Content AI Reviewer: Analysis started. Please wait for results... |
🤖 Content-bot Review DisclaimerThis review was generated by an AI-powered tool and may contain inaccuracies. Please be advised, and we extend our sincere apologies for any inconvenience this may cause. |
content-bot
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the update to the DemistoRESTAPI pack. I noticed a potential logic flaw in GetIncidentTasks where mapping undefined to an empty string might cause the comparison to fail for tasks with missing state properties. Please also verify the release note explanation regarding the API error, as it doesn't seem to align with the current code implementation.
@JasBeilin please review and approve the results generated by the AI Reviewer by responding 👍 on this comment.
|
Validate summary Verdict: PR can be force merged from validate perspective? ✅ |
This PR was automatically updated by a GitHub Action
To stop automatic version bumps, add the |
Contributing to Cortex XSOAR Content
Make sure to register your contribution by filling the contribution registration form
The Pull Request will be reviewed only after the contribution registration form is filled.
Status
Related Issues
fixes: https://jira-dc.paloaltonetworks.com/browse/XSUP-60890
Description
Original Contribution (v1.3.88)
Contributor's Intent:
The contributor correctly identified that the automation's description states:
However, when leaving the state argument empty, the automation was excluding tasks that have not been reached in the workplan (tasks with
undefinedstate). This was a valid observation and the intent to include these tasks was correct.The Problem with the Implementation
The original implementation added support for undefined states like this:
Why This Caused HTTP 400 Errors
JSON Serialization Issue: When JavaScript objects are serialized to JSON for HTTP requests, the
undefinedprimitive value cannot be properly serialized. JSON.stringify() either:nullin some contextsHTTP Request Failure: When the
GetIncidentTasksscript makes API calls usingexecuteCommand('core-api-get', ...), the parameters are serialized to JSON. If the TASK_STATES object (or any derived data) containsundefinedvalues, the HTTP request fails with a 400 Bad Request error.Must have