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

scanner: ignore well known image types that are set executable

This commit is contained in:
Hans-Christoph Steiner 2020-06-03 14:34:21 +02:00
parent 83edb5b80a
commit 3bc246ccad

View File

@ -16,6 +16,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import imghdr
import json import json
import os import os
import re import re
@ -196,6 +197,8 @@ def scan_source(build_dir, build=metadata.Build()):
for sp in safe_paths: for sp in safe_paths:
if sp.match(path): if sp.match(path):
return True return True
if imghdr.what(path) is not None:
return True
return False return False
gradle_compile_commands = get_gradle_compile_commands(build) gradle_compile_commands = get_gradle_compile_commands(build)
@ -277,7 +280,7 @@ def scan_source(build_dir, build=metadata.Build()):
elif is_executable(filepath): elif is_executable(filepath):
if is_binary(filepath) and not safe_path(path_in_build_dir): if is_binary(filepath) and not safe_path(path_in_build_dir):
warnproblem('possible binary', path_in_build_dir) warnproblem('executable binary, possibly code', path_in_build_dir)
for p in scanignore: for p in scanignore:
if p not in scanignore_worked: if p not in scanignore_worked: