1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-09 00:40:11 +01:00

scanner: use a blacklist instead of a whitelist

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.
This commit is contained in:
Daniel Martí 2015-09-16 17:20:22 -07:00
parent feaf3d04e5
commit d7d9e38ef7

View File

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