Skip to content

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
merged 10 commits into from
Apr 9, 2025

Conversation

art1f1c3R
Copy link
Member

Addressing issue identified in #1027, where skips were being evaluated as false. This PR introduces wrappers passed() and failed() into the ProbLog model that use try_call() statements. Skipped heuristics are no longer defined in the ProbLog model, which is why this try_call() statement is used. This means that evaluating failed(heuristic) will be false if the heuristic passed, or if it was not defined (i.e. was skipped). Similarly, for evaluating passed(), 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.

@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Mar 27, 2025
@art1f1c3R art1f1c3R closed this Mar 27, 2025
@art1f1c3R art1f1c3R reopened this Mar 27, 2025
@art1f1c3R art1f1c3R force-pushed the art1f1c3R/malware-bug-1027 branch from 8af93d3 to 97bb593 Compare March 27, 2025 05:33
@art1f1c3R art1f1c3R marked this pull request as ready for review March 27, 2025 05:41
@art1f1c3R art1f1c3R force-pushed the art1f1c3R/malware-bug-1027 branch 3 times, most recently from 362d0b4 to d46f7ed Compare April 3, 2025 06:13
@behnazh-w behnazh-w changed the title fix: pypi malware reporting false positives due to incorrect skip result evaluation fix: fix incorrect skip result evaluation causing false positives in PyPI malware reporting" Apr 3, 2025
@art1f1c3R art1f1c3R changed the base branch from staging to main April 8, 2025 23:41
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>
@art1f1c3R art1f1c3R force-pushed the art1f1c3R/malware-bug-1027 branch from d46f7ed to 6d50aaa Compare April 8, 2025 23:45
… rule ignorant of wheel absence result

Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
behnazh-w
behnazh-w previously approved these changes Apr 9, 2025
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
Signed-off-by: Carl Flottmann <carl.flottmann@oracle.com>
@art1f1c3R
Copy link
Member Author

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: AssertionError: assert 1.0 == 0.

Copy link
Member

@tromai tromai left a 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.

@art1f1c3R art1f1c3R merged commit 199809e into main Apr 9, 2025
10 checks passed
@art1f1c3R art1f1c3R deleted the art1f1c3R/malware-bug-1027 branch April 9, 2025 06:27
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pypi malware reporting false positives due to incorrect skip result evaluation
3 participants