Skip to content

Prismacloud_aws_detection_enhancement - #847

Merged
Ian Hellen (ianhelle) merged 3 commits into
microsoft:mainfrom
raj-axe:add_support_queries_prisma
Aug 14, 2025
Merged

Prismacloud_aws_detection_enhancement#847
Ian Hellen (ianhelle) merged 3 commits into
microsoft:mainfrom
raj-axe:add_support_queries_prisma

Conversation

@raj-axe

@raj-axe Rajamani R (raj-axe) commented May 13, 2025

Copy link
Copy Markdown
Contributor
  • various additional detections enhancement in the support queries
  • changes to limits in config query to pull more data

@raj-axe
Rajamani R (raj-axe) marked this pull request as draft May 13, 2025 06:44
@raj-axe
Rajamani R (raj-axe) marked this pull request as ready for review June 4, 2025 08:36
@ianhelle

Ian Hellen (ianhelle) commented Jun 6, 2025

Copy link
Copy Markdown
Contributor

Hmm. it occurred to me that the yaml format you are using might cause some issues. There seem to be 2 tests that are failing in Py3.9 and Py3.11 pipelines.
I'm kind of OK to get rid of or loosen the json_schema check.
You should check the tests/data/queries/test_query_files.py failure though.
If it is not trivial to fix, I suggest that we just bypass the prismacloud queries in the package tests.

In tests/common/test_pkg_config.py, something like adding an exception for prismacloud in the for loop:

    if "prismacloud" in str(query_file):
        continue

like this

def test_load_default():
    """Test load default settings."""
    settings = pkg_config._settings
    check.is_in("QueryDefinitions", settings)
    check.is_in("Default", settings["QueryDefinitions"])
    check.equal(1, len(settings["QueryDefinitions"]["Default"]))
    for path in settings["QueryDefinitions"]["Default"]:
        check.is_true(type(path), str)
        path = (
            Path(pkg_config.__file__).resolve().parent.parent.joinpath(f"data/{path}")
        )
        check.is_true(path.is_dir())
        for query_file in path.rglob("*.yaml"):
            if "prismacloud" in str(query_file):
                continue
            validate_queries_file_structure(query_file)

@raj-axe

Copy link
Copy Markdown
Contributor Author

Hmm. it occurred to me that the yaml format you are using might cause some issues. There seem to be 2 tests that are failing in Py3.9 and Py3.11 pipelines. I'm kind of OK to get rid of or loosen the json_schema check. You should check the tests/data/queries/test_query_files.py failure though. If it is not trivial to fix, I suggest that we just bypass the prismacloud queries in the package tests.

In tests/common/test_pkg_config.py, something like adding an exception for prismacloud in the for loop:

    if "prismacloud" in str(query_file):
        continue

like this

def test_load_default():
    """Test load default settings."""
    settings = pkg_config._settings
    check.is_in("QueryDefinitions", settings)
    check.is_in("Default", settings["QueryDefinitions"])
    check.equal(1, len(settings["QueryDefinitions"]["Default"]))
    for path in settings["QueryDefinitions"]["Default"]:
        check.is_true(type(path), str)
        path = (
            Path(pkg_config.__file__).resolve().parent.parent.joinpath(f"data/{path}")
        )
        check.is_true(path.is_dir())
        for query_file in path.rglob("*.yaml"):
            if "prismacloud" in str(query_file):
                continue
            validate_queries_file_structure(query_file)

apologies for the long silence Ian, I finally had a block of time to address this.

What I’ve done

  • Prisma Cloud YAMLs fixed
    Added explicit metadata: {} blocks (or real metadata) and removed empty literal-blocks that were resolving to null.
  • Tests pass without skips locally

Let me know if you’d like any additional tweaks. thank you

@review-notebook-app

Copy link
Copy Markdown

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@raj-axe
Rajamani R (raj-axe) force-pushed the add_support_queries_prisma branch from e134f75 to fd533ac Compare August 11, 2025 12:38
@raj-axe

Copy link
Copy Markdown
Contributor Author

Hmm. it occurred to me that the yaml format you are using might cause some issues. There seem to be 2 tests that are failing in Py3.9 and Py3.11 pipelines. I'm kind of OK to get rid of or loosen the json_schema check. You should check the tests/data/queries/test_query_files.py failure though. If it is not trivial to fix, I suggest that we just bypass the prismacloud queries in the package tests.

In tests/common/test_pkg_config.py, something like adding an exception for prismacloud in the for loop:

    if "prismacloud" in str(query_file):
        continue

like this

def test_load_default():
    """Test load default settings."""
    settings = pkg_config._settings
    check.is_in("QueryDefinitions", settings)
    check.is_in("Default", settings["QueryDefinitions"])
    check.equal(1, len(settings["QueryDefinitions"]["Default"]))
    for path in settings["QueryDefinitions"]["Default"]:
        check.is_true(type(path), str)
        path = (
            Path(pkg_config.__file__).resolve().parent.parent.joinpath(f"data/{path}")
        )
        check.is_true(path.is_dir())
        for query_file in path.rglob("*.yaml"):
            if "prismacloud" in str(query_file):
                continue
            validate_queries_file_structure(query_file)

The initial mypy failures occurred because this branch was not up to date with main, so it still reflected pre-existing type errors in unrelated modules (auth/keyvault_client.py and context/azure/azure_data.py). These were not introduced by the Prisma Cloud changes in this PR. The branch has now been rebuilt on the latest main to ensure the diff only contains the intended changes.

can we rerun the pipeline

@ianhelle
Ian Hellen (ianhelle) merged commit 3093f14 into microsoft:main Aug 14, 2025
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants