File tree Expand file tree Collapse file tree 4 files changed +42
-18
lines changed
tests/integration/cases/email_checking_pypi_malware_analyzer Expand file tree Collapse file tree 4 files changed +42
-18
lines changed Original file line number Diff line number Diff line change
1
+ #! /bin/bash
2
+ # Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
3
+ # Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
4
+ if sqlite3 --json output/macaron.db " SELECT detect_malicious_metadata_check.detail_information
5
+ FROM detect_malicious_metadata_check JOIN check_facts on detect_malicious_metadata_check.id = check_facts.id
6
+ JOIN check_result on check_facts.check_result_id = check_result.id JOIN component
7
+ ON component.id = check_result.component_id WHERE check_result.check_id = 'mcn_detect_malicious_metadata_1'
8
+ AND component.name = 'smooth-operator'" | jq -r " .[0].detail_information | fromjson | .invalid_emails | length > 0" ; then
9
+ exit 0
10
+ else
11
+ echo " ERROR: the invalid_emails report for smooth-operator is empty" >&2
12
+ exit 1
13
+ fi
14
+
15
+ if sqlite3 --json output/macaron.db " SELECT detect_malicious_metadata_check.detail_information
16
+ FROM detect_malicious_metadata_check JOIN check_facts on detect_malicious_metadata_check.id = check_facts.id
17
+ JOIN check_result on check_facts.check_result_id = check_result.id JOIN component
18
+ ON component.id = check_result.component_id WHERE check_result.check_id = 'mcn_detect_malicious_metadata_1'
19
+ AND component.name = 'email-validator'" | jq -r " .[0].detail_information | fromjson | .valid_emails | length > 0" ; then
20
+ exit 0
21
+ else
22
+ echo " ERROR: the valid_emails report for email-validator is empty" >&2
23
+ exit 1
24
+ fi
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 3
3
4
4
#include "prelude.dl"
5
5
6
- Policy("check-smooth-operator", component_id, "Check clodd artifacts") :-
6
+ Policy("check-smooth-operator", component_id, "Check smooth-operator artifacts") :-
7
7
check_passed(component_id, "mcn_detect_malicious_metadata_1").
8
8
9
9
apply_policy_to("check-smooth-operator", component_id) :-
10
10
is_component(component_id, purl),
11
11
match("pkg:pypi/smooth-operator", purl).
12
+
13
+ Policy("check-email-validator", component_id, "Check email-validator artifacts") :-
14
+ check_passed(component_id, "mcn_detect_malicious_metadata_1").
15
+
16
+ apply_policy_to("check-email-validator", component_id) :-
17
+ is_component(component_id, purl),
18
+ match("pkg:pypi/email-validator", purl).
Original file line number Diff line number Diff line change 3
3
4
4
description : |
5
5
Analyzing two python packages to check if the email address is deliverable and valid. The package smooth-operator is known
6
- to use an invalid email address with an example.com domain.
6
+ to use an invalid email address with an example.com domain. email-validator is known to have a valid, deliverable, email address.
7
7
8
8
tags :
9
9
- macaron-python-package
@@ -15,11 +15,17 @@ steps:
15
15
command_args :
16
16
- -purl
17
17
- pkg:pypi/smooth-operator
18
- - name : Query the output database to verify the smooth-operator email was invalid.
18
+ - name : Run macaron analyze against email-validator
19
+ kind : analyze
20
+ options :
21
+ command_args :
22
+ - -purl
23
+ - pkg:pypi/email-validator
24
+ - name : Query the output database to verify the emails were detected as invalid and valid respectively.
19
25
kind : shell
20
26
options :
21
- cmd : ./check_smooth_operator_email .sh
22
- - name : Run macaron verify-policy to check the results of the packages
27
+ cmd : ./check_emails .sh
28
+ - name : Run macaron verify-policy to check the results of the packages still passed.
23
29
kind : verify
24
30
options :
25
31
policy : policy.dl
You can’t perform that action at this time.
0 commit comments