Commit graph

154 commits

Author SHA1 Message Date
Jochen Sprickerhof
9eaab6050e Fix variable name 2022-05-03 14:59:52 +00:00
Jochen Sprickerhof
91320fa10e Rework code 2022-05-03 14:59:52 +00:00
Jochen Sprickerhof
7ec3905734 Log zip recursion limit 2022-05-03 14:59:52 +00:00
Jochen Sprickerhof
5fc88431f8 Simplify code 2022-05-03 14:59:52 +00:00
Jochen Sprickerhof
d0d56173c9 Support nested apks 2022-05-03 14:59:52 +00:00
Jochen Sprickerhof
9c8e128064 [scanner] replace apkanalyzer by dexdump 2022-05-03 14:59:52 +00:00
Jochen Sprickerhof
253f2e5fef [scanner] Deep copy json structs (Closes: #985)
The lists in the DEFAULT_JSON_PER_BUILD where only initialized and thus
shared between builds resulting in accumulating the entries over all
versions. As per 2f5d780c4 DEFAULT_JSON_PER_BUILD is used as an API, so
use deepcopy to work around it.
2022-04-21 12:58:07 +00:00
linsui
849e671353 Add junrar to blocklist 2022-03-15 12:06:42 +00:00
Jochen Sprickerhof
8fb37445f2 Fix detection of binary files without extension
Regression of fb61168c.
2022-03-02 10:21:20 +01:00
Sylvia van Os
fb61168c38 Also detect versioned so files 2022-02-15 22:36:44 +00:00
Felix C. Stegerman
dbfbc4163c scanner: add com.google.mlkit to NON_FREE_GRADLE_LINES 2021-10-01 13:10:45 +00:00
Benedikt Brückmann
01b9fb1549 Fix pep8 whitespace errors 2021-06-25 06:28:47 +02:00
Benedikt Brückmann
1e943a22df rewrite docstrings to match numpy style guide 2021-06-25 06:28:47 +02:00
Hans-Christoph Steiner
78d37bb13b switch to allow/block list terminology throughout code base
allowlist and blocklist are much clearer terms with no cultural baggage.
This changes all "whitelist" references to "allowlist", and all "blacklist"
references to "blocklist".
2021-06-18 18:26:50 +00:00
linsui
7c831c11dd NON_FREE_GRADLE_LINES: add com.android.billingclient 2021-06-17 11:53:03 +00:00
Benedikt Brückmann
8f0712e89b Add a mypy run to the pipeline 2021-04-02 08:57:56 +00:00
Hans-Christoph Steiner
78842e9cc2 scanner: should not exit with error when apkanalyzer fails
apkanalyzer produces useful output when it can run, but it does not
support all recent JDK versions, and also some DEX versions, so this
cannot count on it to always produce useful output or even to run
without exiting with an error.

211dd65ff0 was based on false
assumptions that apkanalyzer can always produce output.

fdroiddata!8585
fdroiddata!8584
2021-03-15 10:54:29 +01:00
Hans-Christoph Steiner
211dd65ff0 scanner: show error if scan_binary fails to run apkanalyzer 2021-03-09 15:55:45 +01:00
mimi89999
01699db376
Add androidx.work:work-gcm to non-free dependencies 2021-01-11 10:44:48 +01:00
Jochen Sprickerhof
a9c380b2b8 Ignore src/test only in path_in_build_dir
Found while debugging Debian autopkgtests.
2021-01-04 21:20:31 +01:00
Izzy
434a23f822
add Google Play Core to non-free/proprietary dependencies 2021-01-04 17:39:57 +01:00
Hans-Christoph Steiner
bf25b4ca03 eliminate app.builds everywhere, it should be app['Builds']
The .txt format was the last place where the lowercase "builds" was used,
this converts references everywhere to be "Builds".  This makes it possible
to load metadata YAML files with any YAML parser, then have it possible to
use fdroidserver methods on that data, like metadata.write_metadata().

The test files in tests/metadata/dump/*.yaml were manually edited by cutting
the builds: block and putting it the sort order for Builds: so the contents
should be unchanged.

```
sed -i \
 -e 's/app\.builds/app.get('Builds', \[\])/g' \
 -e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \
 -e "s/app\.get(Builds, \[\]) =/app\['Builds'] =/g" \
 -e "s/app\.get(Builds, \[\])/app.get('Builds', \[\])/g" \
 -e "s/app\.get('Builds', \[\])\.append/app\['Builds'\].append/g" \
 -e "s/app\['builds'\]/app.get('Builds', [])/g" \
 */*.*
```
2020-12-15 08:55:05 +01:00
Hans-Christoph Steiner
05cd8c6810 scanner: expose "usual suspects" patterns for use in an API 2020-10-07 18:56:17 +02:00
Hans-Christoph Steiner
5e1377c77a standardize on "Application ID" in UI text 2020-10-01 23:01:55 +02:00
Marcus Hoffmann
c90a72e14d scanner: check for test in path relative to build dir
This was degrading scanner errors to warnings whenever the path from the
current running install of fdroidserver contained test, as has been
happening in the CI image builder:

https://gitlab.com/fdroid/ci-images-server/-/blob/master/test#L6
2020-08-30 20:09:19 +02:00
Marcus Hoffmann
d07b4123e9 scanner: docstrings for handleproblem functions 2020-08-25 21:32:29 +02:00
Marcus Hoffmann
03e723b1af fix crash when scanner wants to remove the same file more than once
A file can be flagged for multiple problems (i.e. multiple unknown maven
repos in one build.gradle file that is included in a scandelete path).

The scanner will try to delete it once for every problem detected, we
don't really care, as long as the file is gone.

fixes fdroid/fdroidserver#759
2020-08-25 21:32:29 +02:00
Hans-Christoph Steiner
0b92e60266 handle file type detection using Pythonic methods
This ditches the custom common.get_extension() for straight core Python
methods.  This should make the code closer to Python conventions.  For
example, pathlib also includes the "." in the extension it returns.
2020-08-24 17:05:49 +02:00
Marcus
f84818c15e scanner: add a simple scan for blacklisted classes after build step
add com.android.billing to blacklist, see
https://gitlab.com/fdroid/fdroiddata/-/issues/2070#note_360611289
2020-06-15 18:03:19 +00:00
Marcus
6986e73506 Merge branch 'allow_appcenter' into 'master'
scanner: allow microsoft appcenter

See merge request fdroid/fdroidserver!764
2020-06-15 10:46:51 +00:00
Marcus Hoffmann
670328c9e5 scanner: allow microsoft appcenter, except appcenter-push
This sdk is open source. It was added because appcenter has a dependency
to play-services. It's possible though to build an app using appcenter
that doesn't pull in play services, so we can't blanket ban the sdk.

The appcenter-push modules has obvious refenrences to firebase, so it's
safe to error on that.

Ref: https://phabricator.wikimedia.org/T254980
2020-06-15 12:24:46 +02:00
Marcus Hoffmann
3a9f1e845c scanner: fix wrong path being passed to function
Also make rename the parameter in safe_path to make it clear that this
is just a relative path.

Closes fdroid/fdroidserver#791.
2020-06-13 03:01:54 +02:00
Marcus Hoffmann
294799e2f5 scanner: fix options handling
closes fdroid/fdroidserver#789
2020-06-11 11:44:00 +02:00
Hans-Christoph Steiner
0837289935 scanner: fix regex for matching URLs in gradle maven{} blocks
closes #465

This script generated gradle-maven-blocks.yaml:
```python
import os
import re
import yaml

pat = re.compile(r'\smaven\s*{[^}]+}')

finds = set()
for root, dirs, files in os.walk('.'):
    for f in files:
        if '.gradle' in f:
            with open(os.path.join(root, f), errors='surrogateescape') as fp:
                contents = fp.read()
            for m in pat.findall(contents):
                finds.add(m)

with open('finds.yaml', 'w') as fp:
    yaml.dump(sorted(finds), fp, default_flow_style=False)

```
2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
6590f3869e scanner: error/warn on dex/gz/zip, closes #394 2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
ee54dbce87 scanner: safely check options, for things using this API
https://gitlab.com/fdroid/fdroidserver/-/issues/771#note_353495799
2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
75acf63efa scanner: remove all gradle wrapper files 2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
2f5d780c49 scanner: always setup JSON data structure so functions work as API 2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
84f225f2f2 scanner: make problem descriptions translationable 2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
d898ad0412 scanner: make AARs and JARs trigger an error
refs #491
2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
3bc246ccad scanner: ignore well known image types that are set executable 2020-06-10 19:42:23 +02:00
Hans-Christoph Steiner
6030445be0 logging.warn() was deprecated in Python 3.3, use logging.warning()
sed -i 's,logging\.warn(,logging.warning(,g' fdroid */*.*

https://docs.python.org/3.3/library/logging.html#logging.Logger.warning
2020-05-27 08:35:14 +02:00
Hans-Christoph Steiner
67332d83a5 scanner: add --json option for outputting machine readable results
* makes per-build entries in per-app entries
* `fdroid scanner --json --verbose` will output logging messages to stderr
* removed " at line N" from one message to make them uniform keys
* this will be used in issuebot

This is a second attempt with tests for how `fdroid build` calls the
scanner functions. closes #771.  It was previously merged in !748 then
reverted in 68c072c72e
2020-05-27 08:35:14 +02:00
Marcus Hoffmann
68c072c72e Revert "scanner: add --json option for outputting machine readable results"
This reverts commit cdaf62e5d9.

See: https://gitlab.com/fdroid/fdroidserver/-/merge_requests/748#note_347769371
2020-05-24 10:24:40 +02:00
Hans-Christoph Steiner
cdaf62e5d9 scanner: add --json option for outputting machine readable results
* makes per-build entries in per-app entries
* `fdroid scanner --json --verbose` will output logging messages to stderr
* removed " at line N" from one message to make them uniform keys
* this will be used in issuebot
2020-05-14 21:58:48 +02:00
Hans-Christoph Steiner
df563d339a
fix pep8 E741 ambiguous variable name 'l' 2020-05-14 12:11:36 +02:00
Hans-Christoph Steiner
ad92b4c678 scanner: add --force option for scanning disabled apps/builds 2020-02-13 13:58:13 +01:00
licaon-kter
135c92f3d0 Add Microsoft Appcenter SDK to forbidden list 2020-02-02 03:50:54 +02:00
Hans-Christoph Steiner
b95f66a806
scanner: only allow HTTPS versions of the whitelist 2019-11-13 11:59:24 +01:00
Mike Hardy
3c398e2aa6 remove redundant google analytics match
'google.*play.*services' and 'firebase' will catch both manners of including analytics I think
https://developers.google.com/android/guides/setup#split
https://firebase.google.com/support/release-notes/android#latest_sdk_versions

This has the desired side effect of also allowing the libre analytics library
'net.mikehardy:google-analytics-java' and 'net.mikehardy:google-analytics-java7'
2019-11-02 18:40:58 +00:00