generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 29
feat: add exclude and include check in ini config #254
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
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
bb3178f
feat: allow include exclude checks from defaults.ini
tromai 0500c88
feat: display the run checks to HTML reports and logging
tromai e0cc4b2
test: add integration tests
tromai 7dde1a1
chore: use correct exception type in test_registry.py
tromai 0be70cb
chore: make the graph traversal logic generic by removing validation …
tromai 2a423fb
chore: add an unit test for exclude include patterns that results in …
tromai 63b2883
chore: address grammar errors and typos
tromai 73962d8
chore: add __init__.py to the macaron.graph package and update API Do…
tromai 49d3394
test: add an integration test for scorecard
tromai 09eb2fe
chore: use the decoded content of VSA in the expected vsa_payload.jso…
tromai 0c9cff1
test: replace the target of the policy engine test case from slsa-ver…
tromai 35907f6
chore: assign a new CheckTree instance to Registry.check_tree within …
tromai b6a63e0
chore: add defaults.ini to exclude provenance level three check for s…
tromai 7c94792
chore: address typos and grammar errors
tromai 5efae2c
chore: add examples to exclude/include option in defaults.ini
tromai cb847c0
chore: move get_transitive_closure function into the Registry module
tromai 9347251
chore: rename get_transitive_closure to get_reachable_nodes
tromai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -577,6 +577,17 @@ fi | |
rm -rf "$SOURCE_REPO" | ||
rm -rf "$TARGET_REPO" | ||
|
||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "Running the analysis with all checks excluded. This test should return an error code." | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
$RUN_MACARON -dp tests/e2e/defaults/exclude_all_checks.ini analyze -rp https://github.com/apache/maven --skip-deps | ||
|
||
if [ $? -eq 0 ]; | ||
then | ||
echo -e "Expect non-zero status code but got $?." | ||
log_fail | ||
fi | ||
|
||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "apache/maven: test analyzing without the environment variable GITHUB_TOKEN being set." | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
|
@@ -626,12 +637,24 @@ fi | |
|
||
# Testing the CUE provenance expectation verifier. | ||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "Test verifying CUE provenance expectation." | ||
echo "Test verifying CUE provenance expectation for ossf/scorecard" | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
JSON_EXPECTED=$WORKSPACE/tests/e2e/expected_results/scorecard/scorecard.json | ||
JSON_RESULT=$WORKSPACE/output/reports/github/ossf/scorecard/scorecard.json | ||
DEFAULTS_FILE=$WORKSPACE/tests/e2e/defaults/scorecard.ini | ||
EXPECTATION_FILE=$WORKSPACE/tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/scorecard_PASS.cue | ||
$RUN_MACARON -dp $DEFAULTS_FILE analyze -pe $EXPECTATION_FILE -purl pkg:github/ossf/[email protected] --skip-deps || log_fail | ||
|
||
check_or_update_expected_output $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail | ||
|
||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "Test verifying CUE provenance expectation for slsa-verifier" | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
JSON_EXPECTED=$WORKSPACE/tests/e2e/expected_results/slsa-verifier/slsa-verifier_cue_PASS.json | ||
JSON_RESULT=$WORKSPACE/output/reports/github.com/slsa-framework/slsa-verifier/slsa-verifier.json | ||
EXPECTATION_FILE=$WORKSPACE/tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/slsa_verifier_PASS.cue | ||
$RUN_MACARON analyze -pe $EXPECTATION_FILE -rp https://github.com/slsa-framework/slsa-verifier -b main -d fc50b662fcfeeeb0e97243554b47d9b20b14efac --skip-deps || log_fail | ||
DEFAULTS_FILE=$WORKSPACE/tests/e2e/defaults/slsa_verifier.ini | ||
$RUN_MACARON -dp $DEFAULTS_FILE analyze -pe $EXPECTATION_FILE -rp https://github.com/slsa-framework/slsa-verifier -b main -d fc50b662fcfeeeb0e97243554b47d9b20b14efac --skip-deps || log_fail | ||
|
||
check_or_update_expected_output $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail | ||
|
||
|
@@ -648,16 +671,15 @@ check_or_update_expected_output $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || | |
|
||
# Testing the Souffle policy engine. | ||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "Run policy CLI with slsa-verifier results." | ||
echo "Run policy CLI with scorecard results." | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
RUN_POLICY="macaron verify-policy" | ||
POLICY_FILE=$WORKSPACE/tests/policy_engine/resources/policies/valid/slsa-verifier.dl | ||
POLICY_FILE=$WORKSPACE/tests/policy_engine/resources/policies/scorecard/scorecard.dl | ||
POLICY_RESULT=$WORKSPACE/output/policy_report.json | ||
POLICY_EXPECTED=$WORKSPACE/tests/policy_engine/expected_results/policy_report.json | ||
POLICY_EXPECTED=$WORKSPACE/tests/policy_engine/expected_results/scorecard/scorecard_policy_report.json | ||
VSA_RESULT=$WORKSPACE/output/vsa.intoto.jsonl | ||
VSA_PAYLOAD_EXPECTED=$WORKSPACE/tests/vsa/integration/github_slsa-framework_slsa-verifier/vsa_payload.json | ||
VSA_PAYLOAD_EXPECTED=$WORKSPACE/tests/vsa/integration/github_slsa-framework_scorecard/vsa_payload.json | ||
|
||
# Run policy engine on the database and compare results. | ||
$RUN_POLICY -f $POLICY_FILE -d "$WORKSPACE/output/macaron.db" || log_fail | ||
check_or_update_expected_output $COMPARE_POLICIES $POLICY_RESULT $POLICY_EXPECTED || log_fail | ||
check_or_update_expected_output "$COMPARE_VSA" "$VSA_RESULT" "$VSA_PAYLOAD_EXPECTED" || log_fail | ||
|
This file contains hidden or 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 |
---|---|---|
|
@@ -124,27 +124,38 @@ $RUN_MACARON_SCRIPT analyze -pe $EXPECTATION_DIR -rp https://github.com/urllib3/ | |
|
||
python $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail | ||
|
||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "Test verifying CUE provenance expectation for ossf/scorecard" | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
JSON_EXPECTED=$WORKSPACE/tests/e2e/expected_results/scorecard/scorecard.json | ||
JSON_RESULT=$WORKSPACE/output/reports/github/ossf/scorecard/scorecard.json | ||
DEFAULTS_FILE=$WORKSPACE/tests/e2e/defaults/scorecard.ini | ||
EXPECTATION_FILE=$WORKSPACE/tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/scorecard_PASS.cue | ||
$RUN_MACARON_SCRIPT -dp $DEFAULTS_FILE analyze -pe $EXPECTATION_FILE -purl pkg:github/ossf/[email protected] --skip-deps || log_fail | ||
|
||
python $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail | ||
|
||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "slsa-framework/slsa-verifier: Analyzing the repo path when automatic dependency resolution is skipped" | ||
echo "and CUE file is provided as expectation." | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
JSON_EXPECTED=$WORKSPACE/tests/e2e/expected_results/slsa-verifier/slsa-verifier_cue_PASS.json | ||
JSON_RESULT=$WORKSPACE/output/reports/github.com/slsa-framework/slsa-verifier/slsa-verifier.json | ||
EXPECTATION_FILE=$WORKSPACE/tests/slsa_analyzer/provenance/expectations/cue/resources/valid_expectations/slsa_verifier_PASS.cue | ||
$RUN_MACARON_SCRIPT analyze -pe $EXPECTATION_FILE -rp https://github.com/slsa-framework/slsa-verifier -b main -d fc50b662fcfeeeb0e97243554b47d9b20b14efac --skip-deps || log_fail | ||
DEFAULTS_FILE=$WORKSPACE/tests/e2e/defaults/slsa_verifier.ini | ||
$RUN_MACARON_SCRIPT -dp $DEFAULTS_FILE analyze -pe $EXPECTATION_FILE -rp https://github.com/slsa-framework/slsa-verifier -b main -d fc50b662fcfeeeb0e97243554b47d9b20b14efac --skip-deps || log_fail | ||
|
||
python $COMPARE_JSON_OUT $JSON_RESULT $JSON_EXPECTED || log_fail | ||
|
||
echo -e "\n----------------------------------------------------------------------------------" | ||
echo "Run policy CLI with slsa-verifier results." | ||
echo "Run policy CLI with scorecard results." | ||
echo -e "----------------------------------------------------------------------------------\n" | ||
POLICY_FILE=$WORKSPACE/tests/policy_engine/resources/policies/valid/slsa-verifier.dl | ||
POLICY_FILE=$WORKSPACE/tests/policy_engine/resources/policies/scorecard/scorecard.dl | ||
POLICY_RESULT=$WORKSPACE/output/policy_report.json | ||
POLICY_EXPECTED=$WORKSPACE/tests/policy_engine/expected_results/policy_report.json | ||
POLICY_EXPECTED=$WORKSPACE/tests/policy_engine/expected_results/scorecard/scorecard_policy_report.json | ||
VSA_RESULT=$WORKSPACE/output/vsa.intoto.jsonl | ||
VSA_PAYLOAD_EXPECTED=$WORKSPACE/tests/vsa/integration/github_slsa-framework_slsa-verifier/vsa_payload.json | ||
VSA_PAYLOAD_EXPECTED=$WORKSPACE/tests/vsa/integration/github_slsa-framework_scorecard/vsa_payload.json | ||
|
||
# Run policy engine on the database and compare results. | ||
$RUN_MACARON_SCRIPT verify-policy -f $POLICY_FILE -d "$WORKSPACE/output/macaron.db" || log_fail | ||
python $COMPARE_POLICIES $POLICY_RESULT $POLICY_EXPECTED || log_fail | ||
python "$COMPARE_VSA" "$VSA_RESULT" "$VSA_PAYLOAD_EXPECTED" || log_fail | ||
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.