You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
2. Install Pyre and SAPP in the virtual environment:
67
-
```shell
68
-
(pysa) $ pip install pyre-check fb-sapp
69
-
```
70
-
71
-
3. Install dependencies for your project
66
+
2. Install dependencies for your project
72
67
73
68
You can check which packages are installed in your virtual environment by looking at the files in:
74
69
```shell
@@ -82,6 +77,11 @@ If you already have dependencies installed for your project in your virtual envi
82
77
83
78
Installing your project dependencies in your virtual environment will allow Pysa to provide you better results, because it allows Pysa to use [models](pysa_basics.md#model-files) that correspond to those dependencies and detect [sources](pysa_basics.md#sources) and [sinks](pysa_basics.md#sinks) that might be hidden in your dependencies' code
84
79
80
+
3. Install Pyre and SAPP in the virtual environment:
81
+
```shell
82
+
(pysa) $ pip install pyre-check fb-sapp
83
+
```
84
+
85
85
4. Create Pyre configuration file in the project directory you want to run Pysa on:
86
86
87
87
`pyre init` will set up a [configuration file for Pyre (`.pyre_configuration`)](configuration.md) in your project's directory. The defaults for `pyre init` should cover most projects.
@@ -94,7 +94,7 @@ Installing your project dependencies in your virtual environment will allow Pysa
94
94
95
95
If your project isn't type annotated, running Pyre's type inference might improve your Pysa results. Note: this command will modify your code, but don't worry the type annotations won't affect your code at runtime.
96
96
```shell
97
-
(pysa) $ pyre -l .infer -r -i
97
+
(pysa) $ pyre infer -r -i
98
98
```
99
99
100
100
6. Set up SAPP with some high signal filters
@@ -137,12 +137,9 @@ We've provided you with some filters in SAPP to help you find a small subset of
137
137
-[Introduction to Pysa](pysa_basics.md)
138
138
-[DEF CON 28 Pysa Tutorial](https://www.youtube.com/watch?v=8I3zlvtpOww)
**Problem**: `pyre init` shows `ƛ Source directory path/to/dir does not exist. Be sure the source path is relative to the import_root`.
213
+
214
+
**Solution**: You will need to manually update `source_directories` in `.pyre_configuration`. Refer to [Pyre Global configuration section](configuration.md#the-global-configuration) to set up `source_directories`.
215
+
214
216
----
215
217
**Problem**: Running `pyre analyze` results in a bunch of errors and Pysa stops running
**Solution**: Unfortunately, it is likely the case that your machine doesn't have enough memory to run Pysa on projects with similar size to yours.
223
225
224
-
---
225
-
**Problem**: Running any `sapp` command results in `SyntaxError: future feature annotations is not defined`
226
+
----
227
+
**Problem**: `pyre analyze --no-verify` exits with error `ƛ Uncaught exception: (Invalid_argument "~/.venvs/pysa/lib/pyre_check/typeshed/stdlib/zlib.pyi is not a directory")`
226
228
227
-
**Solution**: SAPP requires Python 3.7. Ensure you are running a Python version later than Python 3.7
229
+
**Solution**: Delete your virtual environment and recreate your virtual environment by following the steps in the [Initial configuration](#initial-configuration) section
228
230
```shell
229
-
$ python3 --version
231
+
(pysa) $ deactivate
232
+
$ rm -rf ~/.venvs/pysa
230
233
```
231
-
---
232
-
**Problem**: I can't connect to the Web UI and it displays an error related to SSL. The SAPP server log displays a bunch of `400 Bad Request` error codes
233
-
234
-
**Solution**: Make sure you are visiting [`http://localhost:5000`](http://localhost:5000) and not `https://localhost:5000`
235
-
236
-
---
237
-
**Problem**: I'm seeing a bunch of errors like `~/.venvs/pysa/lib/pyre_check/taint/filename.pysa: module.path.function_name is not part of the environment!`
234
+
----
238
235
<!-- TODO(T89279545) Update `not part of environment` sections after this task is done -->
236
+
**Problem**: I'm seeing a bunch of errors like `~/.venvs/pysa/lib/pyre_check/taint/filename.pysa: module.path.function_name is not part of the environment!`
239
237
240
238
**Solution**:
241
239
If you don't use the `module.path.function_name` mentioned in your project, you can ignore them. Pysa ships with many taint models for code that isn't present in all projects. The errors you are seeing is Pysa informing you that Pysa hasn't found the source code for that particular function in your project or your venv.
@@ -252,6 +250,28 @@ If you do use the `module.path.function_name` mentioned in your project and the
252
250
"taint_models_path": "~/.venvs/pysa/lib",
253
251
}
254
252
```
253
+
----
254
+
**Problem**: Running any `sapp` command results in `SyntaxError: future feature annotations is not defined`
255
+
256
+
**Solution**: SAPP requires Python 3.7. Ensure you are running a Python version later than Python 3.7
257
+
```shell
258
+
$ python3 --version
259
+
```
260
+
----
261
+
262
+
<!-- TODO(T83001415) remove the section below after the todo is completed -->
263
+
**Problem**: Running any `sapp` command results in a bunch of `SAWarning`s like
264
+
```
265
+
SAWarning: SAWarning: relationship 'Child.parent' will copy column parent.id to column child.parent_id, which conflicts with relationship(s): 'Parent.children' (copies parent.id to child.parent_id). If this is not the intention, consider if these relationships should be linked with back_populates, or if viewonly=True should be applied to one or more if they are read-only. For the less common case that foreign key constraints are partially overlapping, the orm.foreign() annotation can be used to isolate the columns that should be written towards. The 'overlaps' parameter may be used to remove this warning.
266
+
```
267
+
**Solution**: Please ignore the `SAWarning`s. They don't affect the functionality of SAPP and everything should be working as intended.
268
+
269
+
----
270
+
271
+
**Problem**: I can't connect to the Web UI and it displays an error related to SSL. The SAPP server log displays a bunch of `400 Bad Request` error codes
272
+
273
+
**Solution**: Make sure you are visiting [`http://localhost:5000`](http://localhost:5000) and not `https://localhost:5000`
274
+
255
275
----
256
276
**Problem**: If your SAPP server shows `404 Not found` and the webpage shows `The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.`
257
277
@@ -277,17 +297,12 @@ Checking which issues SAPP imported - you should expect the following lines to a
277
297
```
278
298
279
299
----
280
-
**Problem**: `pyre analyze --no-verify` exits with error `ƛ Uncaught exception: (Invalid_argument "~/.venvs/pysa/lib/pyre_check/typeshed/stdlib/zlib.pyi is not a directory")`
300
+
**Problem**: The issues on SAPP Web UI have boxes with `No file found for filename.py`, so I cannot see the source code related to the trace for my issues
281
301
282
-
**Solution**: Delete your virtual environment and recreate your virtual environment by following the steps in the [Initial configuration](#initial-configuration) section
302
+
**Solution**: Try passing the path to your project source code with `--source-directory` to `sapp server`
283
303
```shell
284
-
(pysa) $ deactivate
285
-
$ rm -rf ~/.venvs/pysa
304
+
(pysa) $ sapp server --source-directory path/to/project_source_code
286
305
```
287
-
----
288
-
**Problem**: `pyre init` shows `ƛ Source directory path/to/dir does not exist. Be sure the source path is relative to the import_root`.
289
-
290
-
**Solution**: You will need to manually update `source_directories` in `.pyre_configuration`. Refer to [Pyre Global configuration section](configuration.md#the-global-configuration) to set up `source_directories`.
291
306
292
307
----
293
308
**Problem**: Pysa still doesn't work despite trying everything above
0 commit comments