Skip to content

Conversation

@amshamah419
Copy link
Contributor

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

  • In Progress
  • Ready
  • In Hold - (Reason for hold)

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:

"Comma-separated list of states. Possible values: New, InProgress, Completed, Waiting, Error, LoopError, Skipped, Blocked. (Leave empty to get all tasks)."

However, when leaving the state argument empty, the automation was excluding tasks that have not been reached in the workplan (tasks with undefined state). 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:

TASK_STATES = {
    "new": "",
    "inprogress": "inprogress",
    "completed": "Completed",
    "waiting": "Waiting",
    "error": "Error",
    "looperror": "LoopError",
    "skipped": "WillNotBeExecuted",
    "willnotbeexecuted": "WillNotBeExecuted",
    "blocked": "Blocked",
    undefined: undefined  // PROBLEM: JavaScript primitive undefined
}

Why This Caused HTTP 400 Errors

  1. JSON Serialization Issue: When JavaScript objects are serialized to JSON for HTTP requests, the undefined primitive value cannot be properly serialized. JSON.stringify() either:

    • Omits the property entirely
    • Converts it to null in some contexts
    • Causes serialization errors in others
  2. HTTP Request Failure: When the GetIncidentTasks script makes API calls using executeCommand('core-api-get', ...), the parameters are serialized to JSON. If the TASK_STATES object (or any derived data) contains undefined values, the HTTP request fails with a 400 Bad Request error.

Must have

  • Tests
  • Documentation

@amshamah419 amshamah419 requested a review from JasBeilin January 6, 2026 07:18
@amshamah419 amshamah419 self-assigned this Jan 6, 2026
@amshamah419 amshamah419 added docs-approved ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. labels Jan 6, 2026
@amshamah419
Copy link
Contributor Author

@content-bot please review

@content-bot content-bot removed the ready-for-ai-review The PR is ready for reviewing the PR with the AI Reviewer. label Jan 6, 2026
@content-bot
Copy link
Collaborator

🤖 Content AI Reviewer: Analysis started. Please wait for results...

@content-bot
Copy link
Collaborator

🤖 Content-bot Review Disclaimer

This 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.

Copy link
Collaborator

@content-bot content-bot left a 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.

@content-bot
Copy link
Collaborator

Validate summary
The following errors were thrown as a part of this pr: .
If the AG100 validation in the pre-commit GitHub Action fails, the pull request cannot be force-merged.

Verdict: PR can be force merged from validate perspective? ✅

@content-bot
Copy link
Collaborator

This PR was automatically updated by a GitHub Action

  • DemistoRESTAPI pack version was bumped to 1.3.91.

To stop automatic version bumps, add the ignore-auto-bump-version label to the github PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-approved ready-for-pipeline-running Whether the pr is ready for running the whole pipeline, including testing on SAAS machines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants