facebook / mariana-trench

A security focused static analysis tool for Android and Java applications.
https://mariana-tren.ch/
MIT License
1.1k stars 139 forks source link

Default model generators missing from PyPI release #146

Closed goldenkirbi closed 1 year ago

goldenkirbi commented 1 year ago

Bug

Bug description The model generators located in configuration/model-generators are missing from the latest mariana-trench release on PyPI 1.0.4. Model generators are present as expected in release 1.0.3.

Reproduction steps Follow the Getting Started guide, i.e.:

python3 -m venv ~/.venvs/mariana-trench
source ~/.venvs/mariana-trench/bin/activate
pip install mariana-trench
git clone https://github.com/facebook/mariana-trench
cd mariana-trench/documentation/sample-app
mariana-trench \
  --system-jar-configuration-path=$ANDROID_SDK/platforms/android-30/android.jar
  --apk-path=sample-app-debug.apk \
  --source-root-directory=app/src/main/java

Expected behavior The model generators exist and mariana-trench executes successfully

Logs

~ mariana-trench
CRITICAL Unexpected error:
Traceback (most recent call last):
  File "/tmp/mtvenv/lib/python3.10/site-packages/mariana_trench/shim/shim.py", line 742, in main
    arguments.model_generator_search_paths = _separated_paths_exist(
  File "/tmp/mtvenv/lib/python3.10/site-packages/mariana_trench/shim/shim.py", line 59, in _separated_paths_exist
    return ";".join([_path_exists(element) for element in elements])
  File "/tmp/mtvenv/lib/python3.10/site-packages/mariana_trench/shim/shim.py", line 59, in <listcomp>
    return ";".join([_path_exists(element) for element in elements])
  File "/tmp/mtvenv/lib/python3.10/site-packages/mariana_trench/shim/shim.py", line 40, in _path_exists
    raise argparse.ArgumentTypeError(f"Path `{path}` does not exist.")
argparse.ArgumentTypeError: Path `/tmp/mtvenv/share/mariana-trench/configuration/model-generators` does not exist.

Additional context Didn't have too much time to look into this yet, but possibly due to commit d30714d changing the models' file formats from .json to .models.

In scripts/setup.py, _sync_configuration_files, -! *.json seems to exclude non-json files.

def _sync_configuration_files(build_root: Path, repository: Path) -> None:
    filters = ["+ */", "-! *.json"]
# [...]
arthaud commented 1 year ago

Thank, I will have that fixed soon.

arthaud commented 1 year ago

That should be fixed.