Skip to content

Commit 83963cb

Browse files
committed
test: adding integration test for email analyzer, included her invalid email check on smooth-operator
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
1 parent 8c2e7e4 commit 83963cb

File tree

3 files changed

+49
-0
lines changed

3 files changed

+49
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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 = 'clodd'" | 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
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved. */
2+
/* Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/. */
3+
4+
#include "prelude.dl"
5+
6+
Policy("check-smooth-operator", component_id, "Check clodd artifacts") :-
7+
check_passed(component_id, "mcn_detect_malicious_metadata_1").
8+
9+
apply_policy_to("check-smooth-operator", component_id) :-
10+
is_component(component_id, purl),
11+
match("pkg:pypi/smooth-operator", purl).
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (c) 2024 - 2025, Oracle and/or its affiliates. All rights reserved.
2+
# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/.
3+
4+
description: |
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.
7+
8+
tags:
9+
- macaron-python-package
10+
11+
steps:
12+
- name: Run macaron analyze against smooth-operator
13+
kind: analyze
14+
options:
15+
command_args:
16+
- -purl
17+
- pkg:pypi/smooth-operator
18+
- name: Query the output database to verify the smooth-operator email was invalid.
19+
kind: shell
20+
options:
21+
cmd: ./check_smooth_operator_email.sh
22+
- name: Run macaron verify-policy to check the results of the packages
23+
kind: verify
24+
options:
25+
policy: policy.dl

0 commit comments

Comments
 (0)