Safety checks your installed dependencies for known security vulnerabilities.
Project description
[](https://pyup.io/safety/)
[](https://pypi.python.org/pypi/safety)
[](https://travis-ci.org/pyupio/safety)
[](https://pyup.io/repos/github/pyupio/safety/)
Safety checks your installed dependencies for known security vulnerabilities
# Installation
Install `safety` with pip
```bash
pip install safety
```
# Usage
To check your currently selected virtual environment for dependencies with known security
vulnerabilites, run:
```bash
safety check
```
You should get a report similar to this:
```bash
╒══════════════════════════════════════════════════════════════════════════════╕
│ │
│ /$$$$$$ /$$ │
│ /$$__ $$ | $$ │
│ /$$$$$$$ /$$$$$$ | $$ \__//$$$$$$ /$$$$$$ /$$ /$$ │
│ /$$_____/ |____ $$| $$$$ /$$__ $$|_ $$_/ | $$ | $$ │
│ | $$$$$$ /$$$$$$$| $$_/ | $$$$$$$$ | $$ | $$ | $$ │
│ \____ $$ /$$__ $$| $$ | $$_____/ | $$ /$$| $$ | $$ │
│ /$$$$$$$/| $$$$$$$| $$ | $$$$$$$ | $$$$/| $$$$$$$ │
│ |_______/ \_______/|__/ \_______/ \___/ \____ $$ │
│ /$$ | $$ │
│ | $$$$$$/ │
│ by pyup.io \______/ │
│ │
╞══════════════════════════════════════════════════════════════════════════════╡
│ REPORT │
╞══════════════════════════════════════════════════════════════════════════════╡
│ No known security vulnerabilities found. │
╘══════════════════════════════════════════════════════════════════════════════╛
```
Now, let's install something insecure:
```bash
pip install insecure-package
```
*Yeah, you can really install that.*
Run `safety check` again:
```bash
╒══════════════════════════════════════════════════════════════════════════════╕
│ │
│ /$$$$$$ /$$ │
│ /$$__ $$ | $$ │
│ /$$$$$$$ /$$$$$$ | $$ \__//$$$$$$ /$$$$$$ /$$ /$$ │
│ /$$_____/ |____ $$| $$$$ /$$__ $$|_ $$_/ | $$ | $$ │
│ | $$$$$$ /$$$$$$$| $$_/ | $$$$$$$$ | $$ | $$ | $$ │
│ \____ $$ /$$__ $$| $$ | $$_____/ | $$ /$$| $$ | $$ │
│ /$$$$$$$/| $$$$$$$| $$ | $$$$$$$ | $$$$/| $$$$$$$ │
│ |_______/ \_______/|__/ \_______/ \___/ \____ $$ │
│ /$$ | $$ │
│ | $$$$$$/ │
│ by pyup.io \______/ │
│ │
╞══════════════════════════════════════════════════════════════════════════════╡
│ REPORT │
╞══════════════════════════╤═══════════════╤═══════════════════╤═══════════════╡
│ package │ installed │ affected │ source │
╞══════════════════════════╧═══════════════╧═══════════════════╧═══════════════╡
│ insecure-package │ 0.1.0 │ <0.2.0 │ changelog │
╘══════════════════════════╧═══════════════╧═══════════════════╧═══════════════╛
```
## From files
Just like pip, Safety is able to read local requirement files:
```bash
safety check -r requirements.txt
```
## From stdin
Safety is also able to read from stdin with the `--stdin` flag set.
To check a local requirements file, run:
```
cat requirements.txt | safety check --stdin
```
or the output of `pip freeze`:
```
pip freeze | safety check --stdin
```
or to check a single package:
```
echo "insecure-package==0.1" | safety check --stdin
```
## Travis
```
install:
- pip install safety
script:
- safety check
```
# How it Works
# Support
If you are using `safety` in one of your projects, please consider getting a paid
[pyup.io](https://pyup.io) account. This is what makes projects like this possible.
=======
History
=======
1.0.2 (2017-03-23)
------------------
* Fixed another error on Python 2. The fallback function for get_terminal_size wasn't working correctly.
1.0.1 (2017-03-23)
------------------
* Fixed an error on Python 2, FileNotFoundError was introduced in Python 3.
1.0.0 (2017-03-22)
------------------
* Added terminal size detection. Terminals with fewer than 80 columns should now display nicer reports.
* Added an option to load the database from the filesystem or a mirror that's reachable via http(s).
This can be done by using the --db flag.
* Added an API Key option that uses pyup.io's vulnerability database.
* Added an option to cache the database locally for 2 hours. The default still is to not use the cache. Use the --cache flag.
0.6.0 (2017-03-10)
------------------
* Made the requirements parser more robust. The parser should no longer fail on editable requirements
and requirements that are supplied by package URL.
* Running safety requires setuptools >= 16
0.5.1 (2016-11-08)
------------------
* Fixed a bug where not all requirement files were read correctly.
0.5.0 (2016-11-08)
------------------
* Added option to read requirements from files.
0.4.0 (2016-11-07)
------------------
* Filter out non-requirements when reading from stdin.
0.3.0 (2016-10-28)
------------------
* Added option to read from stdin.
0.2.2 (2016-10-21)
------------------
* Fix import errors on python 2.6 and 2.7.
0.2.1 (2016-10-21)
------------------
* Fix packaging bug.
0.2.0 (2016-10-20)
------------------
* Releasing first prototype.
0.1.0 (2016-10-19)
------------------
* First release on PyPI.
[](https://pypi.python.org/pypi/safety)
[](https://travis-ci.org/pyupio/safety)
[](https://pyup.io/repos/github/pyupio/safety/)
Safety checks your installed dependencies for known security vulnerabilities
# Installation
Install `safety` with pip
```bash
pip install safety
```
# Usage
To check your currently selected virtual environment for dependencies with known security
vulnerabilites, run:
```bash
safety check
```
You should get a report similar to this:
```bash
╒══════════════════════════════════════════════════════════════════════════════╕
│ │
│ /$$$$$$ /$$ │
│ /$$__ $$ | $$ │
│ /$$$$$$$ /$$$$$$ | $$ \__//$$$$$$ /$$$$$$ /$$ /$$ │
│ /$$_____/ |____ $$| $$$$ /$$__ $$|_ $$_/ | $$ | $$ │
│ | $$$$$$ /$$$$$$$| $$_/ | $$$$$$$$ | $$ | $$ | $$ │
│ \____ $$ /$$__ $$| $$ | $$_____/ | $$ /$$| $$ | $$ │
│ /$$$$$$$/| $$$$$$$| $$ | $$$$$$$ | $$$$/| $$$$$$$ │
│ |_______/ \_______/|__/ \_______/ \___/ \____ $$ │
│ /$$ | $$ │
│ | $$$$$$/ │
│ by pyup.io \______/ │
│ │
╞══════════════════════════════════════════════════════════════════════════════╡
│ REPORT │
╞══════════════════════════════════════════════════════════════════════════════╡
│ No known security vulnerabilities found. │
╘══════════════════════════════════════════════════════════════════════════════╛
```
Now, let's install something insecure:
```bash
pip install insecure-package
```
*Yeah, you can really install that.*
Run `safety check` again:
```bash
╒══════════════════════════════════════════════════════════════════════════════╕
│ │
│ /$$$$$$ /$$ │
│ /$$__ $$ | $$ │
│ /$$$$$$$ /$$$$$$ | $$ \__//$$$$$$ /$$$$$$ /$$ /$$ │
│ /$$_____/ |____ $$| $$$$ /$$__ $$|_ $$_/ | $$ | $$ │
│ | $$$$$$ /$$$$$$$| $$_/ | $$$$$$$$ | $$ | $$ | $$ │
│ \____ $$ /$$__ $$| $$ | $$_____/ | $$ /$$| $$ | $$ │
│ /$$$$$$$/| $$$$$$$| $$ | $$$$$$$ | $$$$/| $$$$$$$ │
│ |_______/ \_______/|__/ \_______/ \___/ \____ $$ │
│ /$$ | $$ │
│ | $$$$$$/ │
│ by pyup.io \______/ │
│ │
╞══════════════════════════════════════════════════════════════════════════════╡
│ REPORT │
╞══════════════════════════╤═══════════════╤═══════════════════╤═══════════════╡
│ package │ installed │ affected │ source │
╞══════════════════════════╧═══════════════╧═══════════════════╧═══════════════╡
│ insecure-package │ 0.1.0 │ <0.2.0 │ changelog │
╘══════════════════════════╧═══════════════╧═══════════════════╧═══════════════╛
```
## From files
Just like pip, Safety is able to read local requirement files:
```bash
safety check -r requirements.txt
```
## From stdin
Safety is also able to read from stdin with the `--stdin` flag set.
To check a local requirements file, run:
```
cat requirements.txt | safety check --stdin
```
or the output of `pip freeze`:
```
pip freeze | safety check --stdin
```
or to check a single package:
```
echo "insecure-package==0.1" | safety check --stdin
```
## Travis
```
install:
- pip install safety
script:
- safety check
```
# How it Works
# Support
If you are using `safety` in one of your projects, please consider getting a paid
[pyup.io](https://pyup.io) account. This is what makes projects like this possible.
=======
History
=======
1.0.2 (2017-03-23)
------------------
* Fixed another error on Python 2. The fallback function for get_terminal_size wasn't working correctly.
1.0.1 (2017-03-23)
------------------
* Fixed an error on Python 2, FileNotFoundError was introduced in Python 3.
1.0.0 (2017-03-22)
------------------
* Added terminal size detection. Terminals with fewer than 80 columns should now display nicer reports.
* Added an option to load the database from the filesystem or a mirror that's reachable via http(s).
This can be done by using the --db flag.
* Added an API Key option that uses pyup.io's vulnerability database.
* Added an option to cache the database locally for 2 hours. The default still is to not use the cache. Use the --cache flag.
0.6.0 (2017-03-10)
------------------
* Made the requirements parser more robust. The parser should no longer fail on editable requirements
and requirements that are supplied by package URL.
* Running safety requires setuptools >= 16
0.5.1 (2016-11-08)
------------------
* Fixed a bug where not all requirement files were read correctly.
0.5.0 (2016-11-08)
------------------
* Added option to read requirements from files.
0.4.0 (2016-11-07)
------------------
* Filter out non-requirements when reading from stdin.
0.3.0 (2016-10-28)
------------------
* Added option to read from stdin.
0.2.2 (2016-10-21)
------------------
* Fix import errors on python 2.6 and 2.7.
0.2.1 (2016-10-21)
------------------
* Fix packaging bug.
0.2.0 (2016-10-20)
------------------
* Releasing first prototype.
0.1.0 (2016-10-19)
------------------
* First release on PyPI.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
safety-1.0.2.tar.gz
(1.1 MB
view details)
Built Distribution
File details
Details for the file safety-1.0.2.tar.gz
.
File metadata
- Download URL: safety-1.0.2.tar.gz
- Upload date:
- Size: 1.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 23c6ca324a452b5fc93b53f53ea48435034b7a6a3908c630412fe54cdbb78222 |
|
MD5 | 31db09e548a9cfb8b4ccd94adc2d46d0 |
|
BLAKE2b-256 | 4ccc985fda86acadcd23b908490359ae6fdba436f2becd74b27a0b597da995fb |
File details
Details for the file safety-1.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: safety-1.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 12.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4258bf186c954aaa4d155701d2337696c9499d0daf2527f07a44886da8a3695 |
|
MD5 | 0499fcd238a49f79a981bea1cb6d3184 |
|
BLAKE2b-256 | d358647b336bf6d8c99acb5ccfa1f9fc633b2ce4093aaa6f410f9c059c0e3a99 |