diff --git a/tools/pysa_integration_tests/model_verify.py b/tools/pysa_integration_tests/model_verify.py new file mode 100644 index 00000000000..d1bcf25c0bb --- /dev/null +++ b/tools/pysa_integration_tests/model_verify.py @@ -0,0 +1,35 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +import subprocess +import venv +import os +import shutil +import tempfile +from pathlib import Path +from ...api.connection import PyreConnection +from ...api.query import get_invalid_taint_models + +cur_dir = Path(__file__).parent +envpath = cur_dir / ".env" +requirements_path = cur_dir / "verify_models" / "requirements.txt" +activate = envpath / "bin" / "activate" +command = f"pip install -r {requirements_path}" + +if os.path.exists(envpath): + shutil.rmtree(envpath) +os.mkdir(envpath) +venv.create(envpath, with_pip=True) + + +subprocess.check_call(["bash", "-c", f"source {activate}; {command}"]) + +pyre_connection = PyreConnection(cur_dir / "verify_models") + +temp_file = tempfile.TemporaryFile(prefix=".pyre_configuration", suffix=".local", dir=cur_dir) +temp_file.write(b'{"source_directories": ["verify_models"]}') + +print(get_invalid_taint_models(pyre_connection)) +shutil.rmtree(envpath) diff --git a/tools/pysa_integration_tests/verify_models/README.md b/tools/pysa_integration_tests/verify_models/README.md new file mode 100644 index 00000000000..659e4d48155 --- /dev/null +++ b/tools/pysa_integration_tests/verify_models/README.md @@ -0,0 +1,8 @@ +# Overview + +This folder helps model_verify.py in model validation. + +# Contents + +1. requirements.txt : File that contain the library dependencies needed for the models defined. +2. main.py : File with an empty main function to help run pyre on the folder. diff --git a/tools/pysa_integration_tests/verify_models/main.py b/tools/pysa_integration_tests/verify_models/main.py new file mode 100644 index 00000000000..ea2162650c4 --- /dev/null +++ b/tools/pysa_integration_tests/verify_models/main.py @@ -0,0 +1,7 @@ +# Copyright (c) Facebook, Inc. and its affiliates. +# +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +def main(): + pass diff --git a/tools/pysa_integration_tests/verify_models/requirements.txt b/tools/pysa_integration_tests/verify_models/requirements.txt new file mode 100644 index 00000000000..3d09e0600f1 --- /dev/null +++ b/tools/pysa_integration_tests/verify_models/requirements.txt @@ -0,0 +1,44 @@ +Django +mysql-connector-python +lxml +aiohttp +boto3 +s3fs +python-amazon-simple-product-api +dill +falcon +Pillow +Markdown +aiofiles +fabric +fabric2 +furl +mysqlclient +pandas +psycopg2 +PyMySQL +pymssql +asyncssh +jsonpickle +pexpect +paramiko +Mako +Chameleon +Genshi +trender +Cheetah3 +airspeed +chevron +SQLAlchemy +tornado +Jinja2 +MarkupSafe +WTForms +Flask-WTF +djangorestframework +Flask +Werkzeug +PyYAML +requests +pycurl +pyre-check