From f2afe9c2144c7c2f7dfe5e9b5fc1460aa108917d Mon Sep 17 00:00:00 2001 From: Matthew Dolan Date: Fri, 3 Jan 2025 14:34:39 +0000 Subject: [PATCH] Ensure multiple suppressions work as expected Fixes issue #104 --- mobsfscan/mobsfscan.py | 2 +- tests/assets/src/dot_mobsf/scan_but_ignore2.kt | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tests/assets/src/dot_mobsf/scan_but_ignore2.kt diff --git a/mobsfscan/mobsfscan.py b/mobsfscan/mobsfscan.py index 45d821d..f12e0e6 100644 --- a/mobsfscan/mobsfscan.py +++ b/mobsfscan/mobsfscan.py @@ -273,7 +273,7 @@ def post_ignore_files(self): # any matches in the file for the rule if self.suppress_pm_comments(file, rule_id): # remove all matches of the file for the rule - tmp_files = self.remove_matches(file, files) + tmp_files = self.remove_matches(file, tmp_files) if len(tmp_files) == 0: del_keys.add(rule_id) details['files'] = tmp_files diff --git a/tests/assets/src/dot_mobsf/scan_but_ignore2.kt b/tests/assets/src/dot_mobsf/scan_but_ignore2.kt new file mode 100644 index 0000000..a849c7e --- /dev/null +++ b/tests/assets/src/dot_mobsf/scan_but_ignore2.kt @@ -0,0 +1,12 @@ + private fun showN(show: Boolean) { + + xyz.visibility = if (show) View.GONE else View.VISIBLE + xyz.animate() + +} + +Log.e("foo", foo.toString()) + + + +android.secret_key="supersecret key" // mobsf-ignore: android_kotlin_hardcoded \ No newline at end of file