Error and Skip Handling in Heuristic Malware Analysis
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 210
- Forks
- 36
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 2
Description
The use of the SKIP result for heuristics is not clear. It is used in some places for when errors occur, and for some places where the heuristic does not apply. Separating the SKIP result from error handling will make results clearer.
Proposed definition of a SKIP result: a heuristic should return HeuristicResult.SKIP when this heuristic analysis is not applicable to the package. An example would be when the SUSPICIOUS_SETUP heuristic is run on a package with no setup.py file. In this case, SKIP is an appropriate result as this heuristic is not applicable to the package, but the package information is not malformed.
Identified appropriate and inappropriate uses of the SKIP result currently in the codebase are listed below:
Appropriate uses:
anomalous_version.py: returns aSKIPif the version cannot be interpreted as per PEP 440. This is fine as the package is not malformed, the heuristic does not apply here.suspicious_setup.py: returns aSKIPif there is no setup.py, which is appropriate as the heuristic does not apply in this case. This does need to be refactored to error when setup.py is found, but there is a problem trying to analyse it.
Inappropriate uses:
closer_release_join_date.py:SKIPis returned if there are no maintainers or no latest release information. This would be a result of a malformed metadata file, or a problem in parsing the HTML page, and is such an error. Release and maintainer information must exist.high_release_frequency.py:SKIPis returned if there are no releases or if there is only one release. If there are no releases, then this is malformed metadata. If there is 1 release, then this heuristic should not have been run. These both constitute errors.one_release.py:SKIPis returned if there are no releases. If there are no releases, then this is malformed metadata, implying an error has occurred.unchanged_release.py:SKIPis returned if there are no digests. This would occur if there are no releases, or if there are no digest fields in the releases. In both cases, this would be malformed metadata, so an error has occurred.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read anomalous_version.py and suspicious_setup.py to confirm the intended uses of HeuristicResult.SKIP, then inspect closer_release_join_date.py, high_release_frequency.py, one_release.py, and unchanged_release.py. Separate non-applicable cases from malformed metadata or analysis failures so SKIP is used only when the heuristic does not apply and errors are reported otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- security
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100