generated from oracle/template-repo
-
Notifications
You must be signed in to change notification settings - Fork 28
fix: fix incorrect skip result evaluation causing false positives in PyPI malware reporting" #1031
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Merged
Conversation
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
8af93d3
to
97bb593
Compare
behnazh-w
reviewed
Mar 27, 2025
src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py
Outdated
Show resolved
Hide resolved
src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py
Outdated
Show resolved
Hide resolved
src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py
Outdated
Show resolved
Hide resolved
362d0b4
to
d46f7ed
Compare
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
…ules triggers increase the confidence Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
… improved. Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
d46f7ed
to
6d50aaa
Compare
… rule ignorant of wheel absence result Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
behnazh-w
previously approved these changes
Apr 9, 2025
tromai
reviewed
Apr 9, 2025
src/macaron/slsa_analyzer/checks/detect_malicious_metadata_check.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
tromai
reviewed
Apr 9, 2025
tests/slsa_analyzer/checks/test_detect_malicious_metadata_check.py
Outdated
Show resolved
Hide resolved
tromai
reviewed
Apr 9, 2025
tromai
reviewed
Apr 9, 2025
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
I ran the unit test on the old ProbLog model to ensure the unit test is solving the problem, and this is confirmed by the old ProbLog model failing the unit test, with a high confidence rule being triggered: |
behnazh-w
approved these changes
Apr 9, 2025
tromai
approved these changes
Apr 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks for the fix.
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
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.
Addressing issue identified in #1027, where skips were being evaluated as false. This PR introduces wrappers
passed()
andfailed()
into the ProbLog model that usetry_call()
statements. Skipped heuristics are no longer defined in the ProbLog model, which is why thistry_call()
statement is used. This means that evaluatingfailed(heuristic)
will be false if the heuristic passed, or if it was not defined (i.e. was skipped). Similarly, for evaluatingpassed()
, this will be false if the heuristic failed, or if it was not defined. This should handle situations where skips should not cause rules they are part of to trigger. This method was the easiest way to keep as much of the ProbLog model in a static string as possible, without having to perform extensive string operations.Rule IDs have also been added for debugging purposes, and a method to extract them, so that it is evident what rule was triggered.