Skip to content
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

[ASM] EXPANDR-4374 #30601

Conversation

johnnywilkes
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

https://jira-dc.paloaltonetworks.com/browse/EXPANDR-4374

Description

Update the dev check automation to reference the GCP Folder hierarchy

Must have

  • Tests
  • Documentation

@johnnywilkes johnnywilkes marked this pull request as draft November 1, 2023 12:55
@content-bot content-bot added Community Contribution Form Filled Whether contribution form filled or not. labels Nov 1, 2023
@content-bot content-bot added Contribution Thank you! Contributions are always welcome! External PR Xsoar Support Level Indicates that the contribution is for XSOAR supported pack labels Nov 1, 2023
@content-bot content-bot changed the base branch from master to contrib/PaloAltoNetworks_ASM-EXPANDR-4374 November 1, 2023 12:57
@content-bot
Copy link
Collaborator

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 @sapirshuker will know the proposed changes are ready to be reviewed.
For your convenience, here is a link to the contributions SLAs document.

@content-bot
Copy link
Collaborator

Hi @johnnywilkes, thanks for contributing to a Cortex XSOAR supported pack. To receive credit for your generous contribution please follow this link.

Copy link
Contributor

@kball-pa kball-pa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall lgtm! some minor comments about organization and docs, and one erroneous test case i think

isArray: true
name: active_classifications
- description: infrastructure hierarchy information to include CSPs.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm not sure i understand what this means, can you elaborate slightly?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (("env" in key) or (key in ("stage", "function", "lifecycle", "usage", "tier"))) and \
is_indicator_match(value):
indicators.append(list_entry)
elif comparison_type == "string":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i might pull this logic out into a separate function to handle list[str] inputs, while preserving this one for list[dict] inputs, but that just be a matter of preference since functionally they're equivalent

@@ -217,13 +236,19 @@ def main():
args = demisto.args()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add the new hierarchy and provider args to the docstring for the main function? The reference to parameter observed_key_value_pairs might also need updating

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also this might be the more appropriate place to elaborate on what hierarchy_info is (as opposed to where i commented on the yml)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# Dev Hierachy only
assert final_decision(sample_no_match, sample_no_match, sample_no_match, sample_dev_hierarchy, sample_no_match, "")["result"]
# Both Dev Tags and Hierarchy
assert final_decision(sample_no_match, sample_no_match, sample_no_match, sample_dev_hierarchy, sample_no_match, "")["result"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think this was intended to have sample_dev_tag as the second arg

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed in PR feedback

@johnnywilkes
Copy link
Contributor Author

@ShirleyDenkberg , can you please take a look?

@johnnywilkes
Copy link
Contributor Author

@capanw / @BigEasyJ , please review

@ShirleyDenkberg
Copy link
Contributor

@sapirshuker @kball-pa Doc review completed.

johnnywilkes and others added 3 commits November 8, 2023 08:45
Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com>
Copy link
Contributor

@kball-pa kball-pa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

demisto.info(f"Ignoring item because it lacks the keys 'key' and/or 'value': {sorted(kv_pair.keys())}")
for list_entry in observed_list:
if comparison_type == "dictionary":
if not isinstance(list_entry, Mapping):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if not isinstance(list_entry, Mapping):
if not isinstance(list_entry, dict):

Does this work instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from what I have seen, it works exactly the same. I didn't write that line, but can change if you want.

@@ -72,7 +73,7 @@ def test_get_indicators_from_external_classification(classifications, matches):
def test_determine_reason(external, internal, reason):
from InferWhetherServiceIsDev import determine_reason

assert determine_reason(external, internal) == reason
assert determine_reason(external, internal, [], "") == reason
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want another test for if provider: in determine_reason or is provider not functionally relevant?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not doing full testing on determine_reason(). i can, but next person will have to maintain 93%+ unit test coverage

@johnnywilkes johnnywilkes marked this pull request as ready for review November 8, 2023 23:32
@johnnywilkes
Copy link
Contributor Author

@sapirshuker , please merge when possible

@sapirshuker sapirshuker added the ready-for-instance-test In contribution PRs, this label will cause a trigger of a build with a modified pack from the PR. label Nov 9, 2023
@content-bot
Copy link
Collaborator

For the Reviewer: Successfully created a pipeline in Gitlab with url: https://code.pan.run/xsoar/content/-/pipelines/6839323

@sapirshuker
Copy link
Contributor

pipeline in Gitlab failed due to a known issue CIAC-6419.

@sapirshuker sapirshuker merged commit 1a12874 into demisto:contrib/PaloAltoNetworks_ASM-EXPANDR-4374 Nov 9, 2023
23 of 24 checks passed
@content-bot content-bot mentioned this pull request Nov 9, 2023
5 tasks
sapirshuker pushed a commit that referenced this pull request Nov 9, 2023
* init

* lint/format updates

* update unit tests

* PR feedback

* test cov

* done for now

* docker try1

* Apply suggestions from code review



* bump ver

---------

Co-authored-by: johnnywilkes <32227961+johnnywilkes@users.noreply.github.com>
Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com>
sapirshuker pushed a commit that referenced this pull request Dec 21, 2023
* init

* lint/format updates

* update unit tests

* PR feedback

* test cov

* done for now

* docker try1

* Apply suggestions from code review



* bump ver

---------

Co-authored-by: johnnywilkes <32227961+johnnywilkes@users.noreply.github.com>
Co-authored-by: ShirleyDenkberg <62508050+ShirleyDenkberg@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community Contribution Form Filled Whether contribution form filled or not. Contribution Thank you! Contributions are always welcome! docs-approved External PR ready-for-instance-test In contribution PRs, this label will cause a trigger of a build with a modified pack from the PR. Xsoar Support Level Indicates that the contribution is for XSOAR supported pack
Projects
None yet
6 participants