content icon indicating copy to clipboard operation
content copied to clipboard

Update Cortex Xpanse asm-list-external-websites command to include pa…

Open zdrouse opened this issue 7 months ago • 2 comments

…gination support.

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
  • [x] Ready
  • [ ] In Hold - (Reason for hold)

Related Issues

Currently, asm-list-external-websites can only ever retrieve the first 500 websites and organizations have way more than that.

Description

Update asm-list-external-websites command to allow for pagination of requests.

API Reference: https://docs-cortex.paloaltonetworks.com/r/Cortex-Xpanse-REST-API/Get-All-Websites

Must have

  • [ ] Tests
  • [ ] Documentation

zdrouse avatar May 29 '25 19:05 zdrouse

Thank you for your contribution. Your generosity and caring are unrivaled! Make sure to register your contribution by filling the Contribution Registration form, so our content wizard @itssapir will know the proposed changes are ready to be reviewed. For your convenience, here is a link to the contributions SLAs document.

content-bot avatar May 29 '25 19:05 content-bot

Hi @zdrouse, thanks for contributing to the XSOAR marketplace. To receive credit for your generous contribution please follow this link.

content-bot avatar May 29 '25 19:05 content-bot

@zdrouse , thank you for the submission. What were your thoughts on using this? With raw-response=true only?

johnnywilkes avatar Jun 05 '25 20:06 johnnywilkes

@zdrouse , thank you for the submission. What were your thoughts on using this? With raw-response=true only?

@johnnywilkes you are asking my thoughts on giving this command support for paging? We need to retrieve all of the external websites in Xpanse from XSOAR. Without paging support, we cannot do this. From there, a subplaybook or automation can be built to repeatedly call the command using the next_page_token until the last page is reached.

zdrouse avatar Jun 05 '25 21:06 zdrouse

@zdrouse , I understand why you want paging support. However, I am not sure with your change how it is usable. The command doesn't seem to expose next_page_token to context. Can you explain how you are using the command as-is?

If not, please look into changes to add next_page_token to context

johnnywilkes avatar Jun 06 '25 12:06 johnnywilkes

@johnnywilkes I see. Yes, usually when I am using commands on playbook tasks I typically utilize extend-context with the raw response in order to see all the data or pick and choose what I want from the raw response. I find often that I cannot rely on the implemented outputs of the command results because it is either missing data or doesn't provide it in the format I need which I suppose is the point you are making. I've adjusted the output in the integration for this command to provide another node in context for this information. I had to adjust the outputs_prefix in order to preserve the existing context expected from the command.

cah-zachary-rouse avatar Jun 06 '25 17:06 cah-zachary-rouse

Screenshot 2025-06-06 at 12 57 38 PM

Adding a screenshot of context adjustments for reference.

cah-zachary-rouse avatar Jun 06 '25 17:06 cah-zachary-rouse

Looks like we want to fit these standards: https://xsoar.pan.dev/docs/integrations/code-conventions#pagination-in-integration-commands

johnnywilkes avatar Jun 06 '25 21:06 johnnywilkes

@zdrouse , reaching out on DFIR slack

johnnywilkes avatar Jun 09 '25 20:06 johnnywilkes

Tests failing because context output change, reaching out on DFIR

johnnywilkes avatar Jun 18 '25 13:06 johnnywilkes

@johnnywilkes updated to include an additional CommandResults object for ASM.ExternalWebsiteReply which is also using replace_existing=True per recommendations from CommandResults.

https://github.com/demisto/content/blob/5178b4c864b6417aa9ba110e7e2bf89fe0f137e9/Packs/Base/Scripts/CommonServerPython/CommonServerPython.py#L7229

zdrouse avatar Jun 18 '25 18:06 zdrouse

@zdrouse , seeing an issue, will message on slack

johnnywilkes avatar Jun 27 '25 17:06 johnnywilkes

seems to be underlying API issue that first response returns one less form limit: testing commands and screenshots: !asm-list-external-websites limit=2 use_page_token=true !asm-list-external-websites next_page_token= !asm-list-external-websites next_page_token=

image image image Token changes everytime

johnnywilkes avatar Jun 27 '25 19:06 johnnywilkes

@zdrouse Any updates on this? I see its been a while since there was anything new here.

itssapir avatar Jul 08 '25 08:07 itssapir

@itssapir , why is there no new build triggered?

johnnywilkes avatar Jul 08 '25 17:07 johnnywilkes

@johnnywilkes I'm not sure, try resolving the conflicts and merging from master, this usually helps.

itssapir avatar Jul 09 '25 07:07 itssapir

@zdrouse , i think you should fix this: image

johnnywilkes avatar Jul 09 '25 13:07 johnnywilkes

@zdrouse , i think you should fix this: image

if I'm understanding correctly, it looks like the conflict was with the release note md version, there was an update deployed since I first opened this PR. I changed the version.

zdrouse avatar Jul 09 '25 14:07 zdrouse

@itssapir, this is approved, please merge when possible

johnnywilkes avatar Jul 09 '25 15:07 johnnywilkes

For the Reviewer: Trigger build request has been accepted for this contribution PR.

content-bot avatar Jul 13 '25 08:07 content-bot

For the Reviewer: Successfully created a pipeline in GitLab with url: https://gitlab.xdr.pan.local/xdr/cortex-content/content/-/pipelines/4147675

content-bot avatar Jul 13 '25 08:07 content-bot

@zdrouse Any updates on this?

itssapir avatar Jul 23 '25 12:07 itssapir

@zdrouse Any updates on this?

Feel free to make the verbiage changes. We've been waiting for me on that?

zdrouse avatar Jul 23 '25 12:07 zdrouse

For the Reviewer: Trigger build request has been accepted for this contribution PR.

content-bot avatar Jul 23 '25 12:07 content-bot

For the Reviewer: Successfully created a pipeline in GitLab with url: https://gitlab.xdr.pan.local/xdr/cortex-content/content/-/pipelines/4269787

content-bot avatar Jul 23 '25 12:07 content-bot

Thank you for your contribution. Your external PR has been merged and the changes are now included in an internal PR for further review. The internal PR will be merged to the master branch within 3 business days.

github-actions[bot] avatar Jul 23 '25 13:07 github-actions[bot]