GithubHelp home page GithubHelp logo

sonatype-nexus-community / jake Goto Github PK

View Code? Open in Web Editor NEW
102.0 8.0 24.0 1.21 MB

Check your Python environments for vulnerable Open Source packages with OSS Index or Sonatype Nexus Lifecycle.

Home Page: https://jake.readthedocs.io/

License: Apache License 2.0

Python 97.97% Dockerfile 2.03%
python vulnerabilities vulnerability-scanners ossindex nexus-iq sonatype-iq

jake's Introduction

jake icon

Jake

CircleCI Python Version Support PyPI Version GitHub license GitHub issues GitHub forks GitHub stars


jake is a tool to check for your Python environments and applications that can:

  • produce CycloneDX software bill-of-materials
  • report on known vulnerabilities

jake is powered by Sonatype OSS Index and can also be used with Sonatype's Nexus IQ Server.

Installation

Install from pypi.org as you would any other Python module:

pip install jake

or

poetry add jake

Other Python package managers are available.

Usage

Getting Started

jake can guide you...

> jake --help
usage: jake [-h] [-v] [-w] [-X]  ...

Put your Python dependencies in a chokehold

optional arguments:
  -h, --help       show this help message and exit
  -v, --version    show which version of jake you are running
  -w, --warn-only  prevents exit with non-zero code when issues have been
                   detected
  -X               enable debug output

Jake sub-commands:
  
    iq             perform a scan backed by Nexus Lifecycle
    ddt            perform a scan backed by OSS Index
    sbom           generate a CycloneDX software-bill-of-materials (no
                   vulnerabilities)

jake will exit with code 0 under normal operation and 1 if vulnerabilities are found (OssIndex) or Policy Violations are detected (Nexus IQ), unless you pass the -w flag in which case jake will always exit with code 0....

Generating an SBOM

jake can take data from various inputs (or just look at your current Python environment) and produce a CycloneDX for you.

> jake sbom --help

usage: jake sbom [-h] [-f FILE_PATH] [-t TYPE] [-o PATH/TO/FILE]
                   [--output-format {json,xml}]
                   [--schema-version {1.0,1.1,1.2,1.3}]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE_PATH, --input FILE_PATH
                        Where to get input data from. If a path to a file is
                        not specified directly here,then we will attempt to
                        read data from STDIN. If there is no data on STDIN, we
                        will then fall back to looking for standard files in
                        the current directory that relate to the type of input
                        indicated by the -t flag.
  -t TYPE, --type TYPE, -it TYPE, --input-type TYPE
                        how jake should find the packages from which to
                        generate your SBOM.ENV = Read from the current Python
                        Environment; CONDA = Read output from `conda list
                        --explicit`; CONDA_JSON = Read output from `conda list
                        --json`; PIP = read from a requirements.txt; PIPENV =
                        read from Pipfile.lock; POETRY = read from a
                        poetry.lock. (Default = ENV)
  -o PATH/TO/FILE, --output-file PATH/TO/FILE
                        Specify a file to output the SBOM to
  --output-format {json,xml}
                        SBOM output format (default = xml)
  --schema-version {1.0,1.1,1.2,1.3}
                        CycloneDX schema version to use (default = 1.3)

Check out these examples using STDIN:

conda list --explicit --md5 | jake sbom -t CONDA
conda list --json | jake sbom -t CONDA_JSON
cat /path/to/Pipfile.lock | python -m jake.app sbom -t PIPENV

Check out these examples specifying a manifest:

jake sbom -t PIP -f /path/to/requirements.txt
jake sbom -t PIPENV -f /path/to/Pipfile.lock

Check for vulnerabilities using OSS Index

jake will look at the packaged installed in your current Python environment and check these against OSS Index for you. Optionally, it can create a CycloneDX software bill-of-materials at the same time in a format that suits you.

> jake ddt --help

usage: jake ddt [-h] [-f FILE_PATH] [-t TYPE] [--clear-cache] [-o PATH/TO/FILE] 
                   [--output-format {xml,json}]
                   [--schema-version {1.2,1.1,1.0,1.3}]
                   [--whitelist OSS_WHITELIST_JSON_FILE]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE_PATH, --input-file FILE_PATH
                        Where to get input data from. If a path to a file is
                        not specified directly here,then we will attempt to
                        read data from STDIN. If there is no data on STDIN, we
                        will then fall back to looking for standard files in
                        the current directory that relate to the type of input
                        indicated by the -t flag.
  -t TYPE, --type TYPE, -it TYPE, --input-type TYPE
                        how jake should find the packages from which to
                        generate your SBOM.ENV = Read from the current Python
                        Environment; CONDA = Read output from `conda list
                        --explicit`; CONDA_JSON = Read output from `conda list
                        --json`; PIP = read from a requirements.txt; PIPENV =
                        read from Pipfile.lock; POETRY = read from a
                        poetry.lock. (Default = ENV)
  --clear-cache         Clears any local cached OSS Index data prior to execution
  -o PATH/TO/FILE, --output-file PATH/TO/FILE
                        Specify a file to output the SBOM to. If not specified the report will be output to the console. STDOUT is not supported.
  --output-format {xml,json}
                        SBOM output format (default = xml)
  --schema-version {1.2,1.1,1.0,1.3}
                        CycloneDX schema version to use (default = 1.3)
  --whitelist OSS_WHITELIST_JSON_FILE
                        Set path to whitelist json file

So you can quickly get a report by running:

> jake ddt

                   ___           ___           ___     
       ___        /  /\         /  /\         /  /\    
      /__/\      /  /::\       /  /:/        /  /::\   
      \__\:\    /  /:/\:\     /  /:/        /  /:/\:\  
  ___ /  /::\  /  /::\ \:\   /  /::\____   /  /::\ \:\ 
 /__/\  /:/\/ /__/:/\:\_\:\ /__/:/\:::::\ /__/:/\:\ \:\
 \  \:\/:/~~  \__\/  \:\/:/ \__\/~|:|~~~~ \  \:\ \:\_\/
  \  \::/          \__\::/     |  |:|      \  \:\ \:\  
   \__\/           /  /:/      |  |:|       \  \:\_\/  
                  /__/:/       |__|:|        \  \:\    
                  \__\/         \__\|         \__\/    

                                                  
            /)                     /)             
        _/_(/    _     _  __   _  (/_   _         
 o   o  (__/ )__(/_   /_)_/ (_(_(_/(___(/_ o   o  
                                                  
                                                  

Jake Version: 1.1.0
Put your Python dependencies in a chokehold.

๐Ÿ Collected 42 packages from your environment (0:00:00.10)
๐Ÿ Successfully queried OSS Index for package and vulnerability info (0:00:00.59)
๐Ÿ Sane number of results from OSS Index


โ•”Summaryโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฆโ•โ•โ•โ•โ•—
โ•‘ Audited Dependencies โ•‘ 42 โ•‘
โ• โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฌโ•โ•โ•โ•โ•ฃ
โ•‘ Vulnerablities Found โ•‘ 0  โ•‘
โ•šโ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•โ•ฉโ•โ•โ•โ•โ•

...and this is what jake will output if any bad things are found:

                   ___           ___           ___     
       ___        /  /\         /  /\         /  /\    
      /__/\      /  /::\       /  /:/        /  /::\   
      \__\:\    /  /:/\:\     /  /:/        /  /:/\:\  
  ___ /  /::\  /  /::\ \:\   /  /::\____   /  /::\ \:\ 
 /__/\  /:/\/ /__/:/\:\_\:\ /__/:/\:::::\ /__/:/\:\ \:\
 \  \:\/:/~~  \__\/  \:\/:/ \__\/~|:|~~~~ \  \:\ \:\_\/
  \  \::/          \__\::/     |  |:|      \  \:\ \:\  
   \__\/           /  /:/      |  |:|       \  \:\_\/  
                  /__/:/       |__|:|        \  \:\    
                  \__\/         \__\|         \__\/    

                                                  
            /)                     /)             
        _/_(/    _     _  __   _  (/_   _         
 o   o  (__/ )__(/_   /_)_/ (_(_(_/(___(/_ o   o  
                                                  
                                                  

Jake Version: 1.1.5
Put your Python dependencies in a chokehold

๐Ÿ Collected 69 packages from your environment                       โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% -:--:--
๐Ÿ Successfully queried OSS Index for package and vulnerability info โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% -:--:--
๐Ÿ Sane number of results from OSS Index                             โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% -:--:--

[59/69] - pkg:pypi/[email protected] [VULNERABLE]
Vulnerability Details for pkg:pypi/[email protected]                                                                                                                                                                                                                                                                     
โ”œโ”€โ”€ โš   ID: 333aca51-7375-4a9d-be64-16d316ab9274                                                                                                                                                                                                                                                                         
โ”‚   โ””โ”€โ”€ โ•ญโ”€ CVE-2020-36242 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚       โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
โ”‚       โ”‚ In the cryptography package before 3.3.2 for Python, certain sequences of update calls to symmetrically encrypt multi-GB values could result in an integer overflow and buffer overflow, as demonstrated by the Fernet class.                                                                                โ”‚
โ”‚       โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
โ”‚       โ”‚ Details:                                                                                                                                                                                                                                                                                                     โ”‚
โ”‚       โ”‚   - CVSS Score: 9.1 - Critical                                                                                                                                                                                                                                                                               โ”‚
โ”‚       โ”‚   - CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H                                                                                                                                                                                                                                                โ”‚
โ”‚       โ”‚   - CWE: Unknown                                                                                                                                                                                                                                                                                             โ”‚
โ”‚       โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
โ”‚       โ”‚ References:                                                                                                                                                                                                                                                                                                  โ”‚
โ”‚       โ”‚   - https://ossindex.sonatype.org/vulnerability/333aca51-7375-4a9d-be64-16d316ab9274?component-type=pypi&component-name=cryptography&utm_source=python-oss-index-lib%400.2.1&utm_medium=integration                                                                                                          โ”‚
โ”‚       โ”‚   - https://nvd.nist.gov/vuln/detail/CVE-2020-36242                                                                                                                                                                                                                                                          โ”‚
โ”‚       โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
โ”‚       โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ
โ””โ”€โ”€ โš   ID: f19ff95c-cec5-4263-8d3b-e3e64698881e                                                                                                                                                                                                                                                                         
    โ””โ”€โ”€ โ•ญโ”€ CVE-2018-10903 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
        โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
        โ”‚ A flaw was found in python-cryptography versions between >=1.9.0 and <2.3. The finalize_with_tag API did not enforce a minimum tag length. If a user did not validate the input length prior to passing it to finalize_with_tag an attacker could craft an invalid payload with a shortened tag (e.g. 1      โ”‚
        โ”‚ byte) such that they would have a 1 in 256 chance of passing the MAC check. GCM tag forgeries can cause key leakage.                                                                                                                                                                                         โ”‚
        โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
        โ”‚ Details:                                                                                                                                                                                                                                                                                                     โ”‚
        โ”‚   - CVSS Score: 7.5 - High                                                                                                                                                                                                                                                                                   โ”‚
        โ”‚   - CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N                                                                                                                                                                                                                                                โ”‚
        โ”‚   - CWE: Unknown                                                                                                                                                                                                                                                                                             โ”‚
        โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
        โ”‚ References:                                                                                                                                                                                                                                                                                                  โ”‚
        โ”‚   - https://ossindex.sonatype.org/vulnerability/f19ff95c-cec5-4263-8d3b-e3e64698881e?component-type=pypi&component-name=cryptography&utm_source=python-oss-index-lib%400.2.1&utm_medium=integration                                                                                                          โ”‚
        โ”‚   - https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-10903                                                                                                                                                                                                                                               โ”‚
        โ”‚   - https://github.com/pyca/cryptography/pull/4342/commits/688e0f673bfbf43fa898994326c6877f00ab19ef                                                                                                                                                                                                          โ”‚
        โ”‚   - https://nvd.nist.gov/vuln/detail/CVE-2018-10903                                                                                                                                                                                                                                                          โ”‚
        โ”‚                                                                                                                                                                                                                                                                                                              โ”‚
        โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

                    Summary                     
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Audited Dependencies โ”ƒ Vulnerabilities Found โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ 69                   โ”‚ 2                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Check out these examples using STDIN:

conda list --explicit --md5 | jake ddt -t CONDA
conda list --json | jake ddt -t CONDA_JSON
cat /path/to/Pipfile.lock | python -m jake.app ddt -t PIPENV

Check out these examples specifying a manifest:

jake ddt -t PIP -f /path/to/requirements.txt
jake ddt -t PIPENV -f /path/to/Pipfile.lock

A pre-commit hook is also available for use

  - repo: https://github.com/sonatype-nexus-community/jake
    rev: "v1.3.0"
    hooks:
      - id: scan

Whitelisting

Whitelisting of vulnerabilities can be done! To whitelist vulnerabilities add the --whitelist argument and pass a json file like this:

> jake ddt --whitelist jake-whitelist.json

The file should look like this:

{"ignore": [{"id": "f19ff95c-cec5-4263-8d3b-e3e64698881e", "reason": "Insert reason here"}]}

The only field that actually matters is id and that is the ID you receive from OSS Index for a vulnerability. You can add fields such as reason so that you later can understand why you whitelisted a vulnerability.

Any id that is whitelisted will be squelched from the results, and not cause a failure.

Check for vulnerabilities using Sonatype Nexus Lifecycle

Access Sonatype's proprietary vulnerability data using jake:

> jake iq --help

usage: jake iq [-h] [-f FILE_PATH] [-t TYPE] -s https://localhost:8070 -i APP_ID -u USER_ID -p PASSWORD [-st STAGE]

optional arguments:
  -h, --help            show this help message and exit
  -f FILE_PATH, --input-file FILE_PATH
                        Where to get input data from. If a path to a file is
                        not specified directly here,then we will attempt to
                        read data from STDIN. If there is no data on STDIN, we
                        will then fall back to looking for standard files in
                        the current directory that relate to the type of input
                        indicated by the -t flag.
  -t TYPE, --type TYPE, -it TYPE, --input-type TYPE
                        how jake should find the packages from which to
                        generate your SBOM.ENV = Read from the current Python
                        Environment; CONDA = Read output from `conda list
                        --explicit`; CONDA_JSON = Read output from `conda list
                        --json`; PIP = read from a requirements.txt; PIPENV =
                        read from Pipfile.lock; POETRY = read from a
                        poetry.lock. (Default = ENV)
  -s https://localhost:8070, --server-url https://localhost:8070
                        Full http(s):// URL to your Nexus Lifecycle server
  -i APP_ID, --application-id APP_ID
                        Public Application ID in Nexus Lifecycle
  -u USER_ID, --username USER_ID
                        Username for authentication to Nexus Lifecycle
  -p PASSWORD, --password PASSWORD
                        Password for authentication to Nexus Lifecycle
  -st STAGE, --stage STAGE
                        The stage for the report

So passing parameters that suit your Nexus Lifecycle environment you can get a report:

> jake iq -s https://my-nexus-lifecyle -i APP_ID -u USERNAME -p PASSWORD

                   ___           ___           ___     
       ___        /  /\         /  /\         /  /\    
      /__/\      /  /::\       /  /:/        /  /::\   
      \__\:\    /  /:/\:\     /  /:/        /  /:/\:\  
  ___ /  /::\  /  /::\ \:\   /  /::\____   /  /::\ \:\ 
 /__/\  /:/\/ /__/:/\:\_\:\ /__/:/\:::::\ /__/:/\:\ \:\
 \  \:\/:/~~  \__\/  \:\/:/ \__\/~|:|~~~~ \  \:\ \:\_\/
  \  \::/          \__\::/     |  |:|      \  \:\ \:\  
   \__\/           /  /:/      |  |:|       \  \:\_\/  
                  /__/:/       |__|:|        \  \:\    
                  \__\/         \__\|         \__\/    

                                                  
            /)                     /)             
        _/_(/    _     _  __   _  (/_   _         
 o   o  (__/ )__(/_   /_)_/ (_(_(_/(___(/_ o   o  
                                                  
                                                  

Jake Version: 1.0.1
Put your Python dependencies in a chokehold

๐Ÿ IQ Server at https://my-nexus-lifecyle is up and accessible (0:00:00.14)
๐Ÿ Collected 42 packages from your environment (0:00:00.09)
๐Ÿงจ Something slithers around your ankle! There are policy warnings from Sonatype Nexus IQ. (0:00:11.50)

Your Sonatype Nexus IQ Lifecycle Report is available here:
  HTML: https://my-nexus-lifecyle/ui/links/application/APP_ID/report/4831bcb7fbaa45c3a2481048e446b598
  PDF:  https://my-nexus-lifecyle/ui/links/application/APP_ID/report/4831bcb7fbaa45c3a2481048e446b598/pdf

Why Jake?

Jake The Snake was scared of Snakes. The finishing move was DDT. He finishes the Snake with DDT.

Who better to wrangle those slippery dependencies in any virtual or real environment.

Python Support

We endeavour to support all functionality for all current actively supported Python versions. However, some features may not be possible/present in older Python versions due to their lack of support.

Changelog

See our CHANGELOG.

Releasing

We perform releases manually by clicking the "On Hold" button in the CircleCI web page.

If you see a feature in the code that we have not released, please speak up, and we'll be sure to click the magic button.

We use python-semantic-release to generate releases from commits to the main branch.

For example, to perform a "patch" release, add a commit to main with a comment like below. The fix: prefix matters.

fix: Resolve vulnerability: CVE-2020-27783 in lxml

The Fine Print

Remember:

It is worth noting that this is NOT SUPPORTED by Sonatype, and is a contribution of ours to the open source community (read: you!)

  • Use this contribution at the risk tolerance that you have
  • Do NOT file Sonatype support tickets related to ossindex-lib
  • DO file issues here on GitHub, so that the community can pitch in

Phew, that was easier than I thought. Last but not least of all - have fun!

jake's People

Contributors

actions-user avatar allenhsieh avatar arichtman avatar bhamail avatar butterb0wl avatar cshaley avatar darthhater avatar daviskirk avatar jimmydore avatar jwa5426 avatar madpah avatar sanzoghenzo avatar scherzhaft avatar thecodinator19 avatar therealak12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jake's Issues

[BUG] "jake ddt" produces a ValueError when a CWE is found

Describe the bug
When finding a vulnerability having a CWE, jake 1.4.1 seems to assume the CWE ID is numerical, and fails with a ValueError.

To Reproduce
Steps to reproduce the behavior:

  1. Run a docker container with image python:3.6-slim: docker run --rm -it --name jaketest python:3.6-slim bash
  2. Inside the container, install and activate a virtual environment. The version of pip inside that environment will be 18.1 which has known vulnerabilities.
  3. Install jake inside the virtual environment
  4. Run jake ddt
  5. jake produces the error ValueError: invalid literal for int() with base 10: 'CWE-22', see https://gitlab.com/j2c-bce/helloworld-fastapi/-/jobs/2028565003 for an example

Expected behavior
Jake produces a vulnerability report. In the same environment as above, this worked with jake==1.1.5.

Screenshots

Jake Version: 1.4.1
Put your Python dependencies in a chokehold

๐Ÿ Collected 26 packages from your environment                       โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00
๐Ÿ Successfully queried OSS Index for package and vulnerability info โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00
๐Ÿ Sane number of results from OSS Index                             โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00
๐Ÿ Munching & crunching data...                                      โ”โ”โ•บโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”  12% 0:00:01
Traceback (most recent call last):
  File "/venv/bin/jake", line 11, in <module>
    sys.exit(main())
  File "/venv/lib/python3.6/site-packages/jake/app.py", line 124, in main
    JakeCmd().execute()
  File "/venv/lib/python3.6/site-packages/jake/app.py", line 69, in execute
    exit_code: int = command.execute(arguments=self._arguments)
  File "/venv/lib/python3.6/site-packages/jake/command/__init__.py", line 45, in execute
    return self.handle_args()
  File "/venv/lib/python3.6/site-packages/jake/command/oss.py", line 137, in handle_args
    cwes=[int(oic_vulnerability.get_cwe())] if oic_vulnerability.get_cwe() else None,
ValueError: invalid literal for int() with base 10: 'CWE-22'

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Python Version: 3.6.15
  • Version: 1.4.1

invalid version in Jake generated BOM

Describe the bug
when using jake bom, versions in generated bom end in ?extension=tar.gz

To Reproduce

$ jake sbom | xmllint --format -
<?xml version="1.0"?>
<bom xmlns:v="http://cyclonedx.org/schema/ext/vulnerability/1.0" xmlns="http://cyclonedx.org/schema/bom/1.1" version="1">
  <components>
    <component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
      <name>yaspin</name>
      <version>0.16.0?extension=tar.gz</version>
      <purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
    </component>
...

Expected behavior
just the version in the version tag, yet to define if bom-ref attribute should have the extension parameter or not

$ jake sbom | xmllint --format -
<?xml version="1.0"?>
<bom xmlns:v="http://cyclonedx.org/schema/ext/vulnerability/1.0" xmlns="http://cyclonedx.org/schema/bom/1.1" version="1">
  <components>
    <component type="library" bom-ref="pkg:pypi/[email protected]?extension=tar.gz">
      <name>yaspin</name>
      <version>0.16.0</version>
      <purl>pkg:pypi/[email protected]?extension=tar.gz</purl>
    </component>
...

[FEATURE] Scan dependencies determined by a requirements file without installing them

  • What are you trying to do?
    Scan dependencies determined by a requirements file without having to actually having these dependencies installed

  • What feature or behavior is this required for?
    The jake installation itself has its own dependencies, and in certain cases these dependencies conflict with the dependencies of the scanned project (see https://gitlab.com/j2c-bce/helloworld-fastapi/-/jobs/2033667516 for an example situation. I solved it by upgrading the project dependencies in this case, but there might exist situation where that is not an option)

  • How could we solve this issue? (Not knowing is okay!)
    Idk, maybe generate a SBOM from the requirements file and use that to look for vulnerabilities?

  • Anything else?

cc @bhamail / @DarthHater

[FEATURE] Add environment variable to override default location for cache and log files.

  • Jake puts log and cache files in the ${HOME}/.ossindex directory. There are some cases where this isn't optimal. For example, in a CI environment with multiple executors on the same agent there may be multiple simultaneous jake invocations. It would be helpful in this situation if there was a JAKE_HOME or JAKE_WORKDIR environment variable that could be set to override the default location.

  • This is mostly useful for CI but there may be other automation cases where the home directory for a daemon user isn't writable.

  • Something like environ.get('JAKE_WORKDIR', Path.home()) should do the trick. I think there are a few places that change would need to be made. I don't quite know how to test it since my Python knowledge is not great.

cc @bhamail / @DarthHater

[BUG] Strict option placement for -w flag

Hi all, not sure if this is even a bug but I encountered this when trying to set up pre-commit scans that were warn-only. When running Jake scans, the warn option is strictly positional.

Steps to reproduce the behavior:

  1. Run jake ddt -w
  2. See error jake: error: unrecognized arguments: -w

Expected behavior
jake -h ddt is identical to jake ddt -x
According to this jake -w ddt should be same as jake ddt -w

Screenshots
image

Desktop (please complete the following information):

  • OS: WSL/Ubuntu 20.04 LTS
  • Uname -a: Linux bruce-banner 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Python Version: Python 3.10.1
  • Version jake 1.4.3

Additional context
os-release:

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

[BUG] Pinned to Yaml 5.3.1, which is insecure

Jake pins the versions, so when the host apps installs the updated secure library, jake comes in and uninstalls the secure library and installs an insecure library.

  • PyYAML [required: ==5.3.1, installed: 5.3.1]

Ref to vulnerability bulletin: https://snyk.io/vuln/pip:pyyaml

Please stop pinning versions, or if you really like pinning versions you need to update your pinned versions the day that safety publishes vulnerabilities and get your version out to pypi.

Alpo Time - use jake to scan jake during CI

  • What are you trying to do?
    Update the CI config of the jake project to run jake against itself and report any vulnerabilities found. CI should fail if vulnerabilities are found.

  • What feature or behavior is this required for?
    Yummy dog food.

  • How could we solve this issue? (Not knowing is okay!)
    Update CI with yummy goodness

  • Anything else?
    Dunno

cc @bhamail / @DarthHater

Allow Jake to send username and APIKey to OSS Index

Right now we just make requests to OSS Index with no auth.

OSS Index can accept basic auth requests with:

To make authenticated requests use HTTP Basic authentication.

Email address is used for HTTP Basic authentication user name, NOT nickname.

API Token can be used in place of password.

From: https://ossindex.sonatype.org/doc/rest

Essentially, we should allow a user to configure their username and "password" for jake and have that go with requests if they've configured it.

[FEATURE] Check for newer version of Jake during startup

  • What are you trying to do?
    When Jake runs, it should check to see if a newer version of Jake has been released. If a new release exists, prompt the user to upgrade to the latest release. The prompt should include a command to perform the upgrade, e.g. pip install jake --upgrade

some learnings from similar efforts:

  • provide a way to bypass the check (via CLI flag). see: sonatype-nexus-community/nancy#217
    and sonatype-nexus-community/nancy#218
    The ability to skip the check when a given ENV VAR is set is also useful in CI systems.
  • cache the date/time when the last check was performed, and only check again in say 28 hours.
  • also include the command to perform the upgrade in the application help (and maybe the README.md?).

cc @bhamail / @DarthHater

[FEATURE] Support conda-lock files

  • What are you trying to do?

https://github.com/conda-incubator/conda-lock/ includes a transitive pinned list of packages to install in a Conda environment, to allow for reproducible builds. I am fairly certain it contains the same information as conda list.

It would be nice to be able to scan for vulnerabilities using this file, because then one wouldn't have to actually install the packages to check for vulnerabilities.

Unlike environment.yml, it should contain a complete list of packages that will be installed, so there's no worry about extra dependencies being installed and not scanned for vulnerable releases.

  • How could we solve this issue? (Not knowing is okay!)

Write a parser for conda-lock output files. Should be pretty simple:

# platform: linux-64
# env_hash: 27bd039b2991103d63cefc823705756d66514e1c6bf6f156bc6eb3bd87679676

@EXPLICIT

https://conda.anaconda.org/conda-forge/linux-64/_libgcc_mutex-0.1-conda_forge.tar.bz2#d7c89558ba9fa0495403155b64376d81
https://conda.anaconda.org/conda-forge/linux-64/ca-certificates-2021.5.30-ha878542_0.tar.bz2#6a777890e94194dc94a29a76d2a7e721
https://conda.anaconda.org/conda-forge/linux-64/ld_impl_linux-64-2.35.1-hed1e6ac_0.tar.bz2#d0cf77c331382475133dc6c34e7461d7
https://conda.anaconda.org/conda-forge/linux-64/libgfortran5-9.3.0-he4bcb1c_17.tar.bz2#0c15349375fc3d0cb2114fcabe2f0aba
  • Anything else?

Thank you for writing this tool! I'm writing a blog post about it right now.

cc @bhamail / @DarthHater

[FEATURE] Move to using Poetry for our dependencies, etc...

  • What are you trying to do?
    We seem to be doing the flaming hoops dance with pip etc... and it sure seems Poetry is very good at handling all the bad stuff that pip is not good at handling

  • What feature or behavior is this required for?
    Separating out dev deps, reproducible builds, etc...

  • How could we solve this issue? (Not knowing is okay!)
    Get it building and creating something awesome using poetry!

  • Anything else?
    Just have fun!

cc @bhamail / @DarthHater

[BUG] Jake crashes on ddt scan "TypeError: 'int' object is not callable"

Describe the bug
When running a Jake scan it crashes out attempting to call an int object somewhere in TinyDB.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the repository https://github.com/arichtman/foxOps
  2. Enter the virtual environment and run Jake poetry run jake ddt
  3. See error

Expected behavior
Normal execution of Jake OSS Index-backed scan

Screenshots
image

Desktop (please complete the following information):

  • OS: WSL2 Ubuntu 20.04 LTS
  • Uname -a: Linux bruce-banner 5.10.60.1-microsoft-standard-WSL2 #1 SMP Wed Aug 25 23:20:18 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
  • Python Version: 3.10.1
  • Version 1.4.3

Additional context
os-release:

NAME="Ubuntu"
VERSION="20.04.3 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.3 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

[BUG] \U0001f40d character causes an error when running jake through a batch file on windows

The human-readable header information appears to cause an exception due to windows-incompatible characters being output.

I'm attempting to run jake on a windows machine through a batch file against a conda environment.
There's a line in the batch file as follows:

conda list | jake ddt -c -q

This should pass the conda list of packages through to jake and generate the usual output. However, this throws the following exception instead:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\threading.py", line 864, in run
    self._target(*self._args, **self._kwargs)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\yaspin\core.py", line 360, in _spin
    sys.stdout.write(out)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
    self.write_plain_text(text, cursor, start)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
    self.wrapped.write(text[start:end])
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u280b' in position 0: character maps to <undefined>

Traceback (most recent call last):
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\Win10_64bit\.conda\envs\jake-test\Scripts\jake.exe\__main__.py", line 9, in <module>
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\click\core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\click\core.py", line 782, in main
    rv = self.invoke(ctx)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\click\core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\click\core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\click\core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\jake\__main__.py", line 233, in ddt
    spinner.ok("?? ")
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\yaspin\core.py", line 325, in ok
    self._freeze(_text)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\yaspin\core.py", line 344, in _freeze
    sys.stdout.write(self._last_frame)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 41, in write
    self.__convertor.write(text)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 162, in write
    self.write_and_convert(text)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 187, in write_and_convert
    self.write_plain_text(text, cursor, start)
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\site-packages\colorama\ansitowin32.py", line 195, in write_plain_text
    self.wrapped.write(text[start:end])
  File "c:\users\win10_64bit\.conda\envs\jake-test\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\U0001f40d' in position 0: character maps to <undefined>

The culprit is this information at the top of the output:

๏ฟฝ[?25h??  Collecting Dependencies
๏ฟฝ[?25h??  Querying OSS Index
๏ฟฝ[?25h??  Auditing results from OSS Index

If the output is set to JSON then the error no longer occurs (because that's no longer output). Note that this works when issued as a command at the command prompt as expected - it's only when it's run via a batch file that this exception is thrown, for some reason.

  • OS: Windows 10 Pro
  • Python Version: 3.6.2
  • Jake Version: 0.2.77

One simple option would be to strip that heading information away and only leave the reasults when '-q' is used as a switch, but the preferred option would probably be to use characters that wouldn't cause problems under windows at all.

[BUG] PyYAML is somehow hardcoded to PyYAML<6.0.0,>=5.4.1

Describe the bug
I have requirements.in and requirements-dev.in files where I track my dependencies via pip-tools.
I added jake into requirements-dev.in file and when I tried to compile requirements via pip-compile --upgrade && pip-compile requirements-dev.in -o requirements-dev.txt --upgrade I got next error:

Could not find a version that matches pyyaml<6.0.0,==6.0,>=5.1,>=5.4.1 (from -r requirements.txt (line 611))
Tried: 3.10, 3.10, 3.11, 3.11, 3.12, 3.12, 3.13, 5.1, 5.1.1, 5.1.2, 5.2, 5.3, 5.3.1, 5.4, 5.4, 5.4.1, 5.4.1, 6.0, 6.0
Skipped pre-versions: 3.13b1, 3.13rc1, 4.2b1, 4.2b2, 4.2b4, 5.1b1, 5.1b3, 5.1b5, 5.2b1, 5.3b1, 5.4b1, 5.4b1, 5.4b2, 5.4b2, 6.0b1, 6.0b1
There are incompatible versions in the resolved dependencies:
pyyaml==6.0 (from -r requirements.txt (line 611))
PyYAML<6.0.0,>=5.4.1 (from jake==1.1.3->-r requirements-dev.in (line 21))
PyYAML>=5.1 (from uvicorn[standard]==0.15.0->-r requirements.txt (line 728))
pyyaml>=5.1 (from pre-commit==2.15.0->-r requirements-dev.in (line 16))

Expected behavior
The PyYAML version 6.0 should be installed.

Desktop (please complete the following information):

  • OS: Ubuntu v20
  • Python Version: 3.8.10
  • Version 1.1.3

[BUG] requirements pinned to rigidly

Describe the bug
jake is a build tool, and it isn't the only one. jake must be installed in the same venv as the packages it is trying to check, same as other tools like pytest. (I verified jake has to be installed in the same venv as the code under test, if I install to pipx & run jake, it will tell me about jake's dependencies). If a tool that must share the same venv as other tools pins all of its dependencies to an exact version (e.g. ==2.1.1) then you get conflicts. Yes, you can ignore conflicts until something comes along, I don't know says a vulnerability a package & you have update that package to the secure one.

pip check
jake 0.2.65 has requirement idna==2.10, but you have idna 2.8.
jake 0.2.65 has requirement requests==2.25.0, but you have requests 2.22.0.
jake 0.2.65 has requirement urllib3==1.26.2, but you have urllib3 1.25.11.

I recommend you change your requirements to something more like library>=1.5.0

This won't make the problem go away, but it makes dependency hell more manageable, especially over time as the other tools in the ecosystem move on to higher dependency version numbers, sometimes before jake does.

[BUG] Regression on exit code since v1.2.0

Describe the bug
Since v1.2.0, jake always exit with exit code 0, even when vulnerabilities are found

To Reproduce
Steps to reproduce the behavior:

pip install pyjwt==1.3.0 jake==1.2.2
jake ddt
echo $?

Output:

โฏ jake ddt
                   ___           ___           ___     
       ___        /  /\         /  /\         /  /\    
      /__/\      /  /::\       /  /:/        /  /::\   
      \__\:\    /  /:/\:\     /  /:/        /  /:/\:\  
  ___ /  /::\  /  /::\ \:\   /  /::\____   /  /::\ \:\ 
 /__/\  /:/\/ /__/:/\:\_\:\ /__/:/\:::::\ /__/:/\:\ \:\
 \  \:\/:/~~  \__\/  \:\/:/ \__\/~|:|~~~~ \  \:\ \:\_\/
  \  \::/          \__\::/     |  |:|      \  \:\ \:\  
   \__\/           /  /:/      |  |:|       \  \:\_\/  
                  /__/:/       |__|:|        \  \:\    
                  \__\/         \__\|         \__\/    

                                                  
            /)                     /)             
        _/_(/    _     _  __   _  (/_   _         
 o   o  (__/ )__(/_   /_)_/ (_(_(_/(___(/_ o   o  
                                                  
                                                  

Jake Version: 1.2.2
Put your Python dependencies in a chokehold

๐Ÿ Collected 29 packages from your environment                       โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% -:--:--
๐Ÿ Successfully queried OSS Index for package and vulnerability info โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% -:--:--
๐Ÿ Sane number of results from OSS Index                             โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% -:--:--

[15/29] - pkg:pypi/[email protected] [VULNERABLE]
Vulnerability Details for pkg:pypi/[email protected]                                                                                                                                                                                                                                              
โ””โ”€โ”€ โš   ID: 4dc8bf86-e2ee-45b0-881f-bb4f03748b5b                                                                                                                                                                                                                                             
    โ””โ”€โ”€ โ•ญโ”€ CVE-2017-11424 โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
        โ”‚                                                                                                                                                                                                                                                                                  โ”‚
        โ”‚ In PyJWT 1.5.0 and below the `invalid_strings` check in `HMACAlgorithm.prepare_key` does not account for all PEM encoded public keys. Specifically, the PKCS1 PEM encoded format would be allowed because it is prefaced with the string `-----BEGIN RSA PUBLIC KEY-----` which  โ”‚
        โ”‚ is not accounted for. This enables symmetric/asymmetric key confusion attacks against users using the PKCS1 PEM encoded public keys, which would allow an attacker to craft JWTs from scratch.                                                                                   โ”‚
        โ”‚                                                                                                                                                                                                                                                                                  โ”‚
        โ”‚ Details:                                                                                                                                                                                                                                                                         โ”‚
        โ”‚   - CVSS Score: 7.5 - High                                                                                                                                                                                                                                                       โ”‚
        โ”‚   - CVSS Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N                                                                                                                                                                                                                    โ”‚
        โ”‚   - CWE: Unknown                                                                                                                                                                                                                                                                 โ”‚
        โ”‚                                                                                                                                                                                                                                                                                  โ”‚
        โ”‚ References:                                                                                                                                                                                                                                                                      โ”‚
        โ”‚   - https://ossindex.sonatype.org/vulnerability/4dc8bf86-e2ee-45b0-881f-bb4f03748b5b?component-type=pypi&component-name=pyjwt&utm_source=python-oss-index-lib%400.2.1&utm_medium=integration                                                                                     โ”‚
        โ”‚   - https://github.com/jpadilla/pyjwt/pull/277                                                                                                                                                                                                                                   โ”‚
        โ”‚   - https://nvd.nist.gov/vuln/detail/CVE-2017-11424                                                                                                                                                                                                                              โ”‚
        โ”‚                                                                                                                                                                                                                                                                                  โ”‚
        โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

                    Summary                     
โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ Audited Dependencies โ”ƒ Vulnerabilities Found โ”ƒ
โ”กโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ•‡โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ฉ
โ”‚ 29                   โ”‚ 1                     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
(test-jake) 
/tmp via ๐Ÿ v3.8.11 (test-jake) on โ˜๏ธ  (eu-central-1) 
โฏ echo $?
0

Expected behavior
Jake should exit with a code 1.
This works when using jake==1.1.5

Desktop (please complete the following information):

  • OS: MacOS 12.1 / Debian11
  • Python Version: 3.8.11 / 3.9.9
  • Version 1.2+

[BUG] unexpected FIN and broken pipe through web proxy

Describe the bug
A clear and concise description of what the bug is.
I'm not sure that this is a bug. Has this been tested through an outbound web proxy?

jake ddt works flawlessly through standard gateways, but fails with broken pipe when executed through web proxy.

To Reproduce
Steps to reproduce the behavior:
export http_proxy/https_proxy variables pointing to outbound web proxy.
conda list | jake ddt

Expected behavior
I expect it to scan and present vulnerabilities for all install modules (534). Instead, it lists 371 modules and no vulnerabilities.

Screenshots
If applicable, add screenshots to help explain your problem.

>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):

  File "/opt/conda/lib/python3.8/site-packages/conda/exceptions.py", line 1079, in __call__

    return func(*args, **kwargs)

  File "/opt/conda/lib/python3.8/site-packages/conda/cli/main.py", line 84, in _main

    exit_code = do_call(args, p)

  File "/opt/conda/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 83, in do_call

    return getattr(module, func_name)(args, parser)

  File "/opt/conda/lib/python3.8/site-packages/conda/cli/main_list.py", line 141, in execute

    exitcode = print_packages(prefix, regex, format, piplist=args.pip,

  File "/opt/conda/lib/python3.8/site-packages/conda/cli/main_list.py", line 85, in print_packages

    print('\n'.join(map(text_type, output)))

BrokenPipeError: [Errno 32] Broken pipe

$ /opt/conda/bin/conda list

environment variables:

             CIO_TEST=<not set>

           CONDA_ROOT=/opt/conda

       CURL_CA_BUNDLE=<not set>

          HTTPS_PROXY=<set>

           HTTP_PROXY=<set>

             NO_PROXY=<set>

                 PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ec2-user/.loca
                      l/bin:/home/ec2-user/bin:/opt/conda/bin

   REQUESTS_CA_BUNDLE=<not set>

        SSL_CERT_FILE=<not set>

           http_proxy=<set>

          https_proxy=<set>

             no_proxy=<set>



 active environment : None

   user config file : /home/ec2-user/.condarc

populated config files : /home/ec2-user/.condarc

      conda version : 4.8.4

conda-build version : 3.19.2

     python version : 3.8.2.final.0

   virtual packages : __glibc=2.26

   base environment : /opt/conda  (writable)

       channel URLs : http://x.x.x.x/condarepo/linux-64

                      http://x.x.x.x/condarepo/noarch

      package cache : /opt/conda/pkgs

                      /home/ec2-user/.conda/pkgs

   envs directories : /opt/conda/envs

                      /home/ec2-user/.conda/envs

           platform : linux-64

         user-agent : conda/4.8.4 requests/2.23.0 CPython/3.8.2 Linux/4.14.186-146.268.amzn2.x86_64 amzn/2 glibc/2.26

            UID:GID : 1000:1000

         netrc file : None

       offline mode : False

An unexpected error has occurred. Conda has prepared the above report.

Desktop (please complete the following information):

  • OS: [e.g. iOS] Amazon Linux 2
  • Python Version: [e.g. 3.7.6] 3.8.2
  • Version [e.g. 22] 0.2.24

Additional context
Add any other context about the problem here.
Appears to be a code issue, but unsure. tcpdump seems to exonerate the proxy.

[REVIEW] Review all dependencies

Given the point raised in #72, we need to assess all dependencies used in jake and confirm if they are required, maintained, supported etc..

This may lead to vendorising some packages that are no longer maintained and/or removing them from jake if their value is not important enough.

[BUG] Jake doesn't support wheel-only installation

Describe the bug
Python packages come in two sorts, sdist and wheels. Sdist runs on installation setup.py, which allows for running malicious code. Wheels do not run setup.py on install, they just unpack the code & a user would have to invoke the malicious code intentionally via import or the like.

Jake has a dependency on termcolor, which doesn't not have a wheel. https://pypi.org/project/termcolor/#files

To Reproduce

export PIP_ONLY_BINARY=:all:
pipenv install jake --skip-lock --verbose

Or
pip install jake --only-binary=:all:
(The flag names are misleading, because when the flag is active, it installs only the wheel version & will ignore sdist for the package and ALL dependencies, even if they are all pure python)

Expected behavior
Jake should install without having to run setup.py for it or any dependency. The audience of jake is enterprises who are taking supply chain risks serious, probably because they have something valuable to protect. If I were a malicious hacker, I'd target termcolor on pypi (just need to guess their password), upload a malicious sdist and then steal valuables from jake users when setup.py runs.

Screenshots

[pipenv.exceptions.InstallError]: Collecting jake==1.1.3
[pipenv.exceptions.InstallError]:   Using cached jake-1.1.3-py3-none-any.whl (25 kB)
[pipenv.exceptions.InstallError]: Collecting PyYAML<6.0.0,>=5.4.1
[pipenv.exceptions.InstallError]:   Using cached PyYAML-5.4.1-cp39-cp39-win_amd64.whl (213 kB)
[pipenv.exceptions.InstallError]: ERROR: Could not find a version that satisfies the requirement termcolor<2.0.0,>=1.1.0 (from jake) (from versions: none)
[pipenv.exceptions.InstallError]: ERROR: No matching distribution found for termcolor<2.0.0,>=1.1.0
ERROR: Couldn't install package: jake
 Package installation failed...

I would recommend vendorizing your entire dependency chain (or at least the wheel-less one), but that is just because I'm paranoid about supply chain risks.

[BUG] Invalid references for NVD CVE identifiers in CycloneDX JSON 1.4 format

Describe the bug
Version <= 1.4.1 produce wrong references in the CycloneDX JSON report.

To Reproduce
Steps to reproduce the behavior:

  1. Run jake ddt -o ~/dd2/unittests/scans/cyclonedx/jake2.json --output-format json --schema-version 1.4 --clear-cache
  2. check the report data

Expected behavior

According to the specification, references like CVE identifier should be like this:

      "references": [
        {
          "id": "CVE-2018-7489",
          "source": {
            "name": "NVD",
            "url": "https://nvd.nist.gov/vuln/detail/CVE-2019-9997"
          }
        }
      ],

But current format is like this which is not compliant with the schema of the spec:

            "references": [
                {
                    "source": {
                        "url": "https://nvd.nist.gov/vuln/detail/CVE-2021-33203"
                    }
                }
            ],

A lot of data are missing. I'm interested in the source > name and the id which critical to know it's CVE by program.

Desktop (please complete the following information):

  • OS: Arch
  • Python Version: 3.9
  • Version 1.4.1

Additional context
I'm working with reports of Jake/CycloneDX JSON 1.4 format

[BUG]"conda list | jake iq -c" produces different results in comparison to "jake iq" and "nexus-iq-cli"

jake v0.2.66
Nexus IQ Server 103

Describe the bug
Running conda list | jake iq -c leads to completely different results in comparison to jake iq without stdout piping

Example environment environment.yml:

name: testenv
channels:
  - conda-forge
  - defaults
dependencies:
  - python
  - pyjwt>=1.6.4,<2.0
  - pandas
  - pip
  - openssl
  - py
  - bleach
  - pip:
    - numpy

To Reproduce

  1. Create and activate a conda environment including some packages from conda-forge, for example "pandas".
conda env create -f environment.yml
conda activate testenv
pip install jake
  1. Setup a Nexus-IQ-Server.
  2. Submit test results to the Nexus IQ server via conda list | jake iq -c and jake iq.
  3. Check the results in the printed nexus-iq link. Notice, that the vulnarability result is completely different.

I expect the result to be identical. It shouldn't matter if I pipe the output of conda list to the tool or let Jake find out the dependencies in the currently activated environment.

Screenshots
conda list | jake iq -c results in:
image

jake iq results in:
image

[FEATURE] add a optional whitelist to ddt

  • What are you trying to do?

It would nice to have a whitelist where certain vulnerabilities / packages that are ignored in the evaluation of the error code.

  • What feature or behavior is this required for?

There might be packages that have known vulnerabilities but are patched manually or not used in a fashion that makes them vulnerable. In these cases it would be nice to have a kind of "whitelist".
This is especially relevant if the error code returned by jake is relevant in some way or another (pre commit hook for example).

  • How could we solve this issue? (Not knowing is okay!)

auditjs has a "whitelist" option that might be applicable here as well:
https://github.com/sonatype-nexus-community/auditjs#whitelisting

jake ddt --whitelist .jake.json 

or something similar.

cc @bhamail / @DarthHater

[FEATURE] Don't install testing dependencies when installing via pip

  • What are you trying to do?
    The list of dependencies that is installed together with Jake at the moment is extremely long. Not all of these requirements are needed for running Jake, but only for its development.

  • What feature or behavior is this required for?
    Having a lightweight environment to run Jake from, e.g. as part of a CI process.

  • How could we solve this issue? (Not knowing is okay!)
    Revising the list of dependencies installed via install_requires, only including the minimum set necessary for running Jake. Other dependencies can be moved to tests_requires, if they are necessary to run the tests.

  • Anything else?
    As a follow-up step, it might make sense to relax the defined versions, to make Jake play nicer with other projects installed in the same repo.

cc @bhamail / @DarthHater

[FEATURE] Manage site-packages priority

I can't find a good way to prioritize which site package gets prioritized on the system path. Gonna have to go into the tubes and figure it out but i imagine it'll be a few lines. Would be really cool to have jake manage it and let a user shuffle those around.

cc @bhamail / @DarthHater

[BUG] TypeError in oss.py when CWEs are found (#95 followup)

Describe the bug
When finding a vulnerability having a CWE, jake 1.4.3 now produces a TypeError (seems to be a followup error of the #95 bugfix)

To Reproduce
Steps to reproduce the behavior:

  1. Run a docker container with image python:3.6-slim: docker run --rm -it --name jaketest python:3.6-slim bash
  2. Inside the container, install and activate a virtual environment. The version of pip inside that environment will be 18.1 which has known vulnerabilities.
  3. Install jake inside the virtual environment
  4. Run jake ddt
  5. jake produces the error TypeError: sequence item 0: expected str instance, int found

Expected behavior
Jake produces a vulnerability report.

Screenshots

(jake143) root@0163a4bf5553:/# pip show pip
Name: pip
Version: 18.1
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: [email protected]
License: MIT
Location: /jake143/lib/python3.6/site-packages
Requires: 
Required-by: 
(jake143) root@0163a4bf5553:/# jake ddt
                   ___           ___           ___     
       ___        /  /\         /  /\         /  /\    
      /__/\      /  /::\       /  /:/        /  /::\   
      \__\:\    /  /:/\:\     /  /:/        /  /:/\:\  
  ___ /  /::\  /  /::\ \:\   /  /::\____   /  /::\ \:\ 
 /__/\  /:/\/ /__/:/\:\_\:\ /__/:/\:::::\ /__/:/\:\ \:\
 \  \:\/:/~~  \__\/  \:\/:/ \__\/~|:|~~~~ \  \:\ \:\_\/
  \  \::/          \__\::/     |  |:|      \  \:\ \:\  
   \__\/           /  /:/      |  |:|       \  \:\_\/  
                  /__/:/       |__|:|        \  \:\    
                  \__\/         \__\|         \__\/    

                                                  
            /)                     /)             
        _/_(/    _     _  __   _  (/_   _         
 o   o  (__/ )__(/_   /_)_/ (_(_(_/(___(/_ o   o  
                                                  
                                                  

Jake Version: 1.4.3
Put your Python dependencies in a chokehold

๐Ÿ Collected 26 packages from your environment                       โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00
๐Ÿ Successfully queried OSS Index for package and vulnerability info โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00
๐Ÿ Sane number of results from OSS Index                             โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00
๐Ÿ Munching & crunching data...                                      โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ” 100% 0:00:00

[4/26] - [email protected] [VULNERABLE]
Traceback (most recent call last):
  File "/jake143/bin/jake", line 11, in <module>
    sys.exit(main())
  File "/jake143/lib/python3.6/site-packages/jake/app.py", line 124, in main
    JakeCmd().execute()
  File "/jake143/lib/python3.6/site-packages/jake/app.py", line 69, in execute
    exit_code: int = command.execute(arguments=self._arguments)
  File "/jake143/lib/python3.6/site-packages/jake/command/__init__.py", line 45, in execute
    return self.handle_args()
  File "/jake143/lib/python3.6/site-packages/jake/command/oss.py", line 174, in handle_args
    self._print_oss_index_report(components=components)
  File "/jake143/lib/python3.6/site-packages/jake/command/oss.py", line 239, in _print_oss_index_report
    OssCommand._print_vulnerability(tree=tree, v=v)
  File "/jake143/lib/python3.6/site-packages/jake/command/oss.py", line 298, in _print_vulnerability
    """
  File "/jake143/lib/python3.6/site-packages/jake/command/oss.py", line 292, in <listcomp>
    f'CWEs: {",".join(v.cwes) if v.cwes else "Not Recorded"}[bright_white]' for rating in v.ratings])}
TypeError: sequence item 0: expected str instance, int found
(jake143) root@0163a4bf5553:/# 

Desktop (please complete the following information):

  • OS: Linux x86-64
  • Python Version: 3.6.15
  • Version: 1.4.3

Additional context
In a Python 3.9.10 virtual environment with no additional packages installed, jake 1.4.3 exits with the error TypeError: 'int' object is not callable โ€“ probably also caused by the #95 fix.

[BUG] Missing attribute generating report in version 1.4 in JSON format, an attribute is missing.

When generating report in version 1.4 in JSON format, an attribute is missing in the components data.

According to the specification of CycloneDX a vulnerability reference a component by his bom-ref. So the components should have bom-ref.

My advice is to use the PURL string as a bom-ref

image

Renamed with txt because github
jake.json.txt

Version

  • Python 3.9
  • Jake 1.4.0
  • cmd jake ddt --output-format cyclonedx-json --schema-version 1.4 -o ~/dd2/jake.json

-r problems

Trying to point to a requirements file and having issues. Am I missing something dumb? Thanks <3

image

Running jake on Windows produces OSError [BUG]

Description
Running jake on Windows produces the following error:

> jake --help
Traceback (most recent call last):
  File "...\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "...\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "...\Scripts\jake.exe\__main__.py", line 4, in <module>
  File "...\lib\site-packages\jake\__main__.py", line 22, in <module>
    from os import _exit, EX_OSERR, path, mkdir
ImportError: cannot import name 'EX_OSERR' from 'os' (...\lib\os.py)
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='cp1252'>
OSError: [Errno 22] Invalid argument

Desktop:

  • OS: Windows 10 - 1903
  • Python: 3.6
  • Version 0.1.7

[FEATURE] Pre-commit hook support

  • Pre-commit is a popular Python tool for managing, using, and sharing Git hooks. Presently there appear to be no shared hooks for Jake.

  • This supports using Jake for local feedback in an automated fashion

  • The impact of not implementing is higher barriers to uptake of Jake, as well as some minor duplication of work with developers implementing something locally

  • PR incoming. No further comment.

cc @bhamail / @DarthHater

[FEATURE] Output Vulnerabilities in a table

  • What are you trying to do?

Similar to what we did on Nancy, output vulnerabilities in a table format.

Screen Shot 2020-05-19 at 5 20 32 PM

  • What feature or behavior is this required for?

Not really required, but just a nice UX improvement. @ChurchRyan can answer questions if necessary!

  • How could we solve this issue? (Not knowing is okay!)

On the branch Summary I have started a bit of this work, and used a table to output a Summary. If you follow that approach, you can replicate this for Vulnerabilities in audit.py in the print_vulnerability method.

  • Anything else?

HAVE A BLAST!!!!

cc @bhamail / @DarthHater

[BUG] Support for scanning conda packages using "jake ddt -c" removed from version 1.0

In the earlier versions of jake e.g. 0.2.77 I was able to scan non-python conda packages which show up in a "conda list" but not in "pip list" output. This was very useful for looking for vulnerabilities in packages from conda-forge which are not available in conda main. The command used was:
conda list | jake ddt -c
In more recent versions support for the -c flag appears to have been removed. Does anyone know why this was removed and if it can be restored?

[BUG] Jake may exit with exit code 0 given a high number of vulnerabilities

Jake exits with an exit code which is the number of vulnerabilities. The problem is that exit codes have a limit, and when that limit is exceeded unexpected things happen.

$ python -c "import sys; sys.exit(12)" || echo $?
12
$ python -c "import sys; sys.exit(100)" || echo $?
100
$ python -c "import sys; sys.exit(200)" || echo $?
200
$ python -c "import sys; sys.exit(300)" || echo $?
44
$ python -c "import sys; sys.exit(255)" || echo $?
255
$ python -c "import sys; sys.exit(256)" || echo $?
$ python -c "import sys; sys.exit(256)" && echo $?
0

If someone is unlucky enough to have a number of vulnerabilities that is a multiple of 256, the exit code will be zero, indicating everything is fine...

You probably want to do something like code = min(audit.audit_results(), 255) instead of just using the result of audit_results() as is.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.