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

Panther CLI Single File Analysis #4

Closed
nhakmiller opened this issue Mar 19, 2020 · 1 comment
Closed

Panther CLI Single File Analysis #4

nhakmiller opened this issue Mar 19, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@nhakmiller
Copy link
Contributor

Migrated from panther-analysis.

Add support for specifying a single file for testing. For example:

$ panther-cli test --policies analysis/policies/cis/aws_test_policy.yml

Would run the tests for just the specified policy. This would make testing easier, as you don't have to setup a wip directory with your working copies, or have to try and filter out the relevant results from all the results if you're working in the main directories.

Currently if you provide the path to a file directly, the tool just exits with no relevant output.

@nhakmiller
Copy link
Contributor Author

This is now possible with the --filter flag. For single file analysis you can do:

% panther_analysis_tool test --path aws_cloudtrail_rules --filter RuleID=AWS.Root.Activity
[INFO]: Testing analysis packs in aws_cloudtrail_rules

AWS.Root.Activity
	[PASS] Root Activity
		[Title] AWS root activity detected from [111.111.111.111] in account [sample-account]
		[Dedup] 111.111.111.111-123456789012
	[PASS] IAMUser Activity

--------------------------
Panther CLI Test Summary
	Path: aws_cloudtrail_rules
	Passed: 1
	Failed: 0
	Invalid: 0

%

cdzombak added a commit that referenced this issue Feb 17, 2023
* Sorted testing (#1)

Add command-line argument sort-test-results to panther_analysis_tool
When set,sort-test-results will bucket test results output by passed/errored status, and will sort test cases by Rule ID

* Minor updates - rename variable, conditional print (#2)

* Print passed tests first, followed by failed

* Sort tests by Rule ID

* Add container

* Add container

* Add container

* Add logic to print organized output when a results container is passed.

* Add container

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* Update version

* rename variable. Only print detection ID in setup_run_tests when not sorting test results

* Conditionally print blank lines (#3)

* Conditionally print blank line

* Conditionally print blank line

* Use implied bool arg (#4)

* Conditionally print blank line

* Conditionally print blank line

* Update arg implementation

* Update arg implementation

* Apply diff from Panther (#5)

* Apply diff from panther

* Lint with black (#6)

* lint with black

---------

Co-authored-by: Chris Dzombak <chris@chrisdzombak.net>
Co-authored-by: Evan Gibler <evan.gibler@panther.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant