chainguard-dev / malcontent

#supply #chain #attack #detection
Apache License 2.0
446 stars 31 forks source link

Add --file-risk-change and --file-risk-increase flags #514

Closed egibs closed 1 month ago

egibs commented 1 month ago

Closes: #500

This PR adds two new flags for diffs -- --file-risk-change and --file-risk-increase.

While the former is essentially what diff does right now, it has the distinct difference of filtering out diff reports for modified source and destination files with equal risk scores.

The latter will filter out diff reports for modified source and destination files where the source file risk score is equal to or greater than the destination file risk score.

The filtering occurs before any d.Modified.Set calls and after the d.Added.Set or d.Removed.Set calls in order to preserve unrelated file changes.

I also added four different test cases for each flag --