From 15828fa946e1ef76e25e9f2f93b55a2279c282e7 Mon Sep 17 00:00:00 2001 From: PulkitMishra Date: Sun, 22 Aug 2021 02:48:48 +0530 Subject: [PATCH 1/4] adds verify_models folder for integration testing --- tools/pysa_integration_tests/verify_models/README.md | 8 ++++++++ tools/pysa_integration_tests/verify_models/main.py | 2 ++ .../pysa_integration_tests/verify_models/requirements.txt | 3 +++ 3 files changed, 13 insertions(+) create mode 100644 tools/pysa_integration_tests/verify_models/README.md create mode 100644 tools/pysa_integration_tests/verify_models/main.py create mode 100644 tools/pysa_integration_tests/verify_models/requirements.txt 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..66135be4792 --- /dev/null +++ b/tools/pysa_integration_tests/verify_models/main.py @@ -0,0 +1,2 @@ +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..27d6db299c8 --- /dev/null +++ b/tools/pysa_integration_tests/verify_models/requirements.txt @@ -0,0 +1,3 @@ +Flask +lxml +pyre-check From fa1ae99d600f34ee025c735d10173173b95afd2b Mon Sep 17 00:00:00 2001 From: PulkitMishra Date: Sun, 22 Aug 2021 02:50:00 +0530 Subject: [PATCH 2/4] adds script for creating virtual environment and a pyre connection --- tools/pysa_integration_tests/model_verify.py | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 tools/pysa_integration_tests/model_verify.py diff --git a/tools/pysa_integration_tests/model_verify.py b/tools/pysa_integration_tests/model_verify.py new file mode 100644 index 00000000000..287c2cb804d --- /dev/null +++ b/tools/pysa_integration_tests/model_verify.py @@ -0,0 +1,30 @@ +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) From 2bfe666b6ca06d882a7b5bbf178bfa92c480040a Mon Sep 17 00:00:00 2001 From: PulkitMishra Date: Sun, 22 Aug 2021 10:24:28 +0530 Subject: [PATCH 3/4] adds license --- tools/pysa_integration_tests/model_verify.py | 5 +++++ tools/pysa_integration_tests/verify_models/main.py | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/tools/pysa_integration_tests/model_verify.py b/tools/pysa_integration_tests/model_verify.py index 287c2cb804d..d1bcf25c0bb 100644 --- a/tools/pysa_integration_tests/model_verify.py +++ b/tools/pysa_integration_tests/model_verify.py @@ -1,3 +1,8 @@ +# 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 diff --git a/tools/pysa_integration_tests/verify_models/main.py b/tools/pysa_integration_tests/verify_models/main.py index 66135be4792..ea2162650c4 100644 --- a/tools/pysa_integration_tests/verify_models/main.py +++ b/tools/pysa_integration_tests/verify_models/main.py @@ -1,2 +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 From 807f1efea810e813a56eabd85ee3edb075d0b417 Mon Sep 17 00:00:00 2001 From: PulkitMishra Date: Sun, 22 Aug 2021 12:50:40 +0530 Subject: [PATCH 4/4] adds library dependencies for all defined models --- .../verify_models/requirements.txt | 43 ++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/tools/pysa_integration_tests/verify_models/requirements.txt b/tools/pysa_integration_tests/verify_models/requirements.txt index 27d6db299c8..3d09e0600f1 100644 --- a/tools/pysa_integration_tests/verify_models/requirements.txt +++ b/tools/pysa_integration_tests/verify_models/requirements.txt @@ -1,3 +1,44 @@ -Flask +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