Skip to content

Commit

Permalink
Add detection of CodeMeter obfuscation
Browse files Browse the repository at this point in the history
  • Loading branch information
antfie committed Apr 19, 2024
1 parent c90aef6 commit 17502df
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions checks/unwanted_files.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func detectUnwantedFiles(r *report.Report) {
processUnwantedFiles(r, []string{"*.pyd"}, "Python-compiled DLL", []string{"Do not upload Python-compiled DLLs (.pyd files)."})
processUnwantedFiles(r, []string{"*.pyc"}, "compiled Python file", []string{"Veracode requires Python source code for analysis. Do not upload compiled Python files."})
processUnwantedFiles(r, []string{"*.deploy"}, "ClickOnce \".deploy\" files", []string{"Veracode does not support ClickOnce deployments."})
processUnwantedFiles(r, []string{"WibuCmNET.dll"}, "CodeMeter obfuscation file", []string{"Do not use code obfuscation tools other than Dotfuscator Community Edition. Using other code obfuscation tools may prevent the static binary scan from succeeding."})
}

func processUnwantedFiles(r *report.Report, filePatterns []string, fileType string, recommendations []string) {
Expand Down
17 changes: 17 additions & 0 deletions checks/unwanted_files_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,21 @@ func TestUnwantedFiles(t *testing.T) {
assert.Contains(t, testReport.Issues[1].Description, "A compiled Python file was uploaded: \"test.pyc\"")
assert.Equal(t, 3, len(testReport.Recommendations))
})

t.Run("Scan contains WibuCmNET.dll which is an indicator of CodeMeter obfuscation", func(t *testing.T) {
t.Parallel()
testReport := report.Report{
UploadedFiles: []report.UploadedFile{
{Id: 222222, Name: "WibucmNeT.dll", MD5: "hash2", IsIgnored: false, IsThirdParty: false},
{Id: 222222, Name: "app.dll", MD5: "hash2", IsIgnored: false, IsThirdParty: false},
},
Issues: []report.Issue{},
}

detectUnwantedFiles(&testReport)

assert.Equal(t, 1, len(testReport.Issues))
assert.Contains(t, testReport.Issues[0].Description, "CodeMeter obfuscation file")
assert.Equal(t, 2, len(testReport.Recommendations))
})
}

0 comments on commit 17502df

Please sign in to comment.