-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Code Quality]: Implementing custom writer, bug fixes, new integratio…
…n test framework, and adding initial tests for all commands (#325) * Origin/custom writer (#319) * Added build targets to release workflow * Added build targets to release workflow * Moved TARGETS env variable * Removed JSON variable * Added OS-specific runs * Removed external dependency * Added braces to target in path * Reverting to OS-specific runs * Fixed indent * temp commit with temp fix for DI on execute method * small fix + implementing poc for a test * Added initial tests for verbose output validation * Refactoring to add Writer across all commands * Minor refactoring, removed unused imports * rename from_utf8 to into_string due to clippy warning * fixed bug from renaming from_utf8 Co-authored-by: Akshay Rane <raneaks@amazon.com> Co-authored-by: Josh Fried <joshfri@amazon.com> * Set all field in rules file to serialize with recursive singleton map (#320) * testing rust-fmt action with incorectly formatted file * reverting previous commit * testing rust-fmt action with incorectly formatted file * reverting previous commit * fixed serialization issues for enums * cleanup * Refactored resources and tests directory (#321) Co-authored-by: Akshay Rane <raneaks@amazon.com> * [Code Quality]: Improve test coverage (#322) * testing rust-fmt action with incorectly formatted file * reverting previous commit * testing rust-fmt action with incorectly formatted file * reverting previous commit * create test runners for validate, parse-tree, and test. refactored tests in validate to use rstest + added new test cases. added parse-tree test cases * removed unneeded cargo_test2 fn * removing unused cargo_test fn * rust fmt * more parse-tree tests * fixes as per comments * rustfmt * Custom writer (#323) * Adding license info for indoc * Added tests for migrate and rulegen, added constants for status codes, incorporated writer into test command * Formatting changes * Corrected typos in resource file paths * Added license info for strip-ansi-escapes library --------- Co-authored-by: Akshay Rane <raneaks@amazon.com> * [Code Quality]: Unit tests for yaml loader (#324) * testing rust-fmt action with incorectly formatted file * reverting previous commit * testing rust-fmt action with incorectly formatted file * reverting previous commit * more parse-tree tests * fixes as per comments * added tests for laoder and fixed some bugs found while writing tests * removed unneeded use --------- Co-authored-by: Akshay Rane <aks.rane@gmail.com> Co-authored-by: Akshay Rane <raneaks@amazon.com>
- Loading branch information
1 parent
df540fc
commit 1aca900
Showing
65 changed files
with
2,284 additions
and
1,001 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
let encryption_flag = true | ||
let aws_ec2_volume = Resources.*[ Type == "AWS::EC2::Volume" ] | ||
rule aws_ec2_volume_checks WHEN %aws_ec2_volume NOT EMPTY { | ||
%aws_ec2_volume { | ||
Properties.Encrypted == %encryption_flag | ||
Properties.Size <= 100 | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
let encryption_flag = true | ||
|
||
AWS::EC2::Volume Encrypted == %encryption_flag | ||
AWS::EC2::Volume Size <= 100 |
145 changes: 145 additions & 0 deletions
145
guard/resources/parse-tree/output-dir/test_rule_iterate_through_json_list_without_key.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
assignments: | ||
- var: aws_serverless_functions | ||
value: | ||
AccessClause: | ||
query: | ||
- Key: Resources | ||
- AllValues: null | ||
- Filter: | ||
- null | ||
- - - Clause: | ||
access_clause: | ||
query: | ||
query: | ||
- Key: Type | ||
match_all: true | ||
comparator: | ||
- Eq | ||
- false | ||
compare_with: | ||
Value: | ||
path: '' | ||
value: AWS::Serverless::Function | ||
custom_message: null | ||
location: | ||
line: 1 | ||
column: 45 | ||
negation: false | ||
match_all: true | ||
guard_rules: | ||
- rule_name: KEY_COMPLIANCE_CHECK | ||
conditions: | ||
- - Clause: | ||
access_clause: | ||
query: | ||
query: | ||
- Key: '%aws_serverless_functions' | ||
match_all: true | ||
comparator: | ||
- Empty | ||
- true | ||
compare_with: null | ||
custom_message: null | ||
location: | ||
line: 3 | ||
column: 32 | ||
negation: false | ||
block: | ||
assignments: | ||
- var: key | ||
value: | ||
AccessClause: | ||
query: | ||
- Key: '%aws_serverless_functions' | ||
- AllIndices: null | ||
- Key: Properties | ||
- Key: Tags | ||
- MapKeyFilter: | ||
- null | ||
- comparator: | ||
- Eq | ||
- false | ||
compare_with: | ||
Value: | ||
path: '' | ||
value: /^(?i)first([-|_])?name$/ | ||
match_all: true | ||
conjunctions: | ||
- - Clause: | ||
Clause: | ||
access_clause: | ||
query: | ||
query: | ||
- Key: '%aws_serverless_functions' | ||
- AllIndices: null | ||
- Key: Properties | ||
- Key: Tags | ||
match_all: true | ||
comparator: | ||
- IsMap | ||
- false | ||
compare_with: null | ||
custom_message: null | ||
location: | ||
line: 4 | ||
column: 3 | ||
negation: false | ||
- - Clause: | ||
Clause: | ||
access_clause: | ||
query: | ||
query: | ||
- Key: '%aws_serverless_functions' | ||
- AllIndices: null | ||
- Key: Properties | ||
- Key: Tags | ||
match_all: true | ||
comparator: | ||
- Empty | ||
- true | ||
compare_with: null | ||
custom_message: null | ||
location: | ||
line: 5 | ||
column: 3 | ||
negation: false | ||
- - Clause: | ||
Clause: | ||
access_clause: | ||
query: | ||
query: | ||
- Key: '%aws_serverless_functions' | ||
- AllIndices: null | ||
- Key: Properties | ||
- Key: Tags | ||
- AllValues: null | ||
match_all: false | ||
comparator: | ||
- Eq | ||
- false | ||
compare_with: | ||
Value: | ||
path: '' | ||
value: /^(?i)prod$/ | ||
custom_message: null | ||
location: | ||
line: 11 | ||
column: 3 | ||
negation: false | ||
- - Clause: | ||
Clause: | ||
access_clause: | ||
query: | ||
query: | ||
- Key: '%key' | ||
match_all: true | ||
comparator: | ||
- Empty | ||
- true | ||
compare_with: null | ||
custom_message: null | ||
location: | ||
line: 13 | ||
column: 3 | ||
negation: false | ||
parameterized_rules: [] |
Oops, something went wrong.