fix(rules): match the literal mode argument in getSharedPreferences (#2638)

The world readable/writable patterns matched any argument list ending with 1 or 2, so decompiled identifiers such as var1, var2 or mode2 were reported as world permissions.

Signed-off-by: Eljees <[email protected]>
Co-authored-by: Ajin Abraham <[email protected]>
This commit is contained in:
Eljees
2026-08-09 16:57:21 -07:00
committed by GitHub
co-authored by Ajin Abraham
parent 4d85257b01
commit 3eadf6cc0a
@@ -612,7 +612,7 @@
type: RegexOr
pattern:
- MODE_WORLD_WRITABLE
- \.getSharedPreferences\(.{0,50}?2\)
- \.getSharedPreferences\([^)]{0,50}?,\s*2\s*\)
- 'openFileOutput\(\s*".{1,48}"\s*,\s*2\s*\)'
severity: high
input_case: exact
@@ -627,7 +627,7 @@
type: RegexOr
pattern:
- MODE_WORLD_READABLE
- \.getSharedPreferences\(.{0,50}?1\)
- \.getSharedPreferences\([^)]{0,50}?,\s*1\s*\)
- 'openFileOutput\(\s*".{1,48}"\s*,\s*1\s*\)'
severity: high
input_case: exact