Bug fix to malwaregen anycode detector in keyword using#1302
Merged
erickgalinkin merged 2 commits intoNVIDIA:mainfrom Jul 24, 2025
Merged
Bug fix to malwaregen anycode detector in keyword using#1302erickgalinkin merged 2 commits intoNVIDIA:mainfrom
erickgalinkin merged 2 commits intoNVIDIA:mainfrom
Conversation
6b3226b to
e1fe1ae
Compare
5 tasks
Collaborator
erickgalinkin
left a comment
There was a problem hiding this comment.
Minor comment, otherwise LGTM.
…es which are valid in most relevant situations
erickgalinkin
approved these changes
Jul 24, 2025
Collaborator
erickgalinkin
left a comment
There was a problem hiding this comment.
LGTM. Will merge once tests pass.
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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
Bug fix: The regexes for C# and cpp in the malwaregen.AnyCode detector for keyword
usingmatch most English sentences that contain the wordusing. These have been updated to be more specific covering all uses of this keyword listed in:Examples of uses that the updated regex is capable of detecting:
Manual inspection of outputs from GPT-4o before and after this change mostly shows changes in text responses containing the word using. However, some code examples for assembly, Rust and Swift appear to not be captured by the regexes for those languages and were instead caught by the word
usingpresent in the text part of the response. I will submit future PRs to address those issues.Verification
python -m pytest tests/test_detectors_malwaregen.py.test_detectors_malwaregen.py. Also manually inspected reports from GPT-4o to identify types of responses for which predictions have changed. Changes typically indicate shortfalls in regexes for other languages which I will address in separate PRs.