chiark / gitweb /
scanner: use a blacklist instead of a whitelist
authorDaniel Martí <mvdan@mvdan.cc>
Thu, 17 Sep 2015 00:20:22 +0000 (17:20 -0700)
committerDaniel Martí <mvdan@mvdan.cc>
Thu, 17 Sep 2015 00:23:34 +0000 (17:23 -0700)
This is much closer to what we did before with mimetypes. Using a whitelist
turns out to be a bad idea since repositories seem to be randomly filled with
executable images and documents, which trigger the scanner.

In an ideal world the scanner would complain about all of those. For now, just
warn about the possibility of them being hidden binaries.

fdroidserver/scanner.py

index c5e18ddc4a0c073224bc42cc6f5f054e57ea82a8..f46627d38cab0539bc88e9f5e5ac951b5ac0ee0a 100644 (file)
@@ -160,18 +160,13 @@ def scan_source(build_dir, root_dir, thisbuild):
                     for name in suspects_found(line):
                         count += handleproblem('usual supect \'%s\' at line %d' % (name, i), fd, fp)
 
-            # These files are often found - avoid checking if they are binary
-            # to speed up the scanner
-            elif ext in [
-                    'xml', 'md', 'txt', 'html', 'sh', 'png', 'jpg',
-                    'ttf', 'otf']:
-                pass
-
-            elif is_binary(fp):
-                if is_executable(fp):
-                    count += handleproblem('executable binary', fd, fp)
-                elif ext == '':
-                    count += handleproblem('unknown binary', fd, fp)
+            elif ext in ['', 'bin', 'out', 'exe']:
+                if is_binary(fp):
+                    count += handleproblem('binary', fd, fp)
+
+            elif is_executable(fp):
+                if is_binary(fp):
+                    warnproblem('possible binary', fd)
 
     for p in scanignore:
         if p not in scanignore_worked: