-
Notifications
You must be signed in to change notification settings - Fork 514
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
[FR] Re-factor Build Integrations Manifest #2274
[FR] Re-factor Build Integrations Manifest #2274
Conversation
Outcome from changes below. Note we need to pull in endpoint as well to account for any endpoint security integration based rules. These rules should an integration tag as well, but this will be addressed in another issue/PR.
|
…eference-metadata-tags
…eference-metadata-tags
Unit TestingI adjusted a unit test as well which used the folders to determine if a tag was valid or necessary. Rather this, we can rely on the EPR URL to grab a list of all valid integration names and if the tag value does not exist in this list, it is invalid. Additionally, similar to how we do the Example testing screenshot: |
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.
LGTM.! Great work 🔥
…eference-metadata-tags
Co-authored-by: Justin Ibarra <[email protected]>
Co-authored-by: Justin Ibarra <[email protected]>
…eference-metadata-tags
…eference-metadata-tags
…eference-metadata-tags
…eference-metadata-tags
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.
LGTM
Co-authored-by: Mika Ayenson <[email protected]>
Thanks @w0rk3r ! |
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
* adjusted how integrations list is created * removed unused import and addressed linting errors * adjusted integration_manifest dictionary to only load latest major * adjusted manifests sourcing from GH to EPR CDN * addressed flake errors * added some additional comments and formatting * updaing integration-manifests file * adjusted test_integration testing * addressed flake errors * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * Update detection_rules/integrations.py Co-authored-by: Justin Ibarra <[email protected]> * added folder unit tests * updated unit test to remove network calls * Update tests/test_all_rules.py Co-authored-by: Mika Ayenson <[email protected]> Co-authored-by: Justin Ibarra <[email protected]> Co-authored-by: Mika Ayenson <[email protected]> (cherry picked from commit b31a1b7)
Issues
Overview
We should look to adjust the way we determine which integrations to reference for building the integrations manifest.
Problem
At this time, we reference the
rules/integrations
folder names to determine which integrations we use to build the integrations manifest. This becomes an issue, for instance, if a core OS is using the endpoint security integration or a network rule is using the NPC integration.Solution
We should load all rules and reference the metadata tags to create a set list of integrations so the building process is resilient to the location of a rule. In addition to this we need to account for elastic/kibana#139440 where Kibana would identify a
^
in the field value and know this is the least compatible. Additionally, we need to filter for the latest major for this comparison logic.rule.contents.metadata.integration
integrations_manifests
inintegrations.find_least_compatible_version
to only return latest majorintegrations.find_least_compatible_version
to return version with a^
View Rule Example:
integration_manifests
vslatest_major_integration_manifests
value:Update - September 8, 2022
While we are adjusting the build integrations manifest process, we should look to pro-actively refactor it's current process as well to pull package manifest information from the EPR CDN (JSON format) instead of from the GH repository itself. This is possible due to the searching capability of the package registry.
The following was captured from the console output of running the
dev integrations build-manifests
command:Testing
For testing, I used the
view-rule
command to see what a finalized rule built with the new related integrations field to ensure the value is the same or expected. As seen below, the^
is added to allow Kibana to identify this is the least compatible version and the related integration field is populated.Additionally, the
build-release
command was used to test this on all rules to ensure this does not have any exceptions or errors for all rules:Output:
example integration rule from build package: