Skip to main content

Precaution security static analysis command line

Project description

Precaution CLI Build and Test

Precli is the core of the Precaution GitHub App and Action. It also serves as a command line interface to demonstate its functionality. It is designed to do static code analysis of source code with a number of rules covering the standard library for the corresponding programming language.

If your needs go beyond the analysis of just the standard library, consider upgrading to Precaution Professional to get access to finding and fixing security vulnerabilities in third-party libraries. See https://www.securesauce.dev/ for more details.

Quick Start

To install precli (requires Python 3.12):

pip install precli

Note: If using arm based macOS, you’ll also need to install this package:

pip install git+https://github.com/tree-sitter/tree-sitter-python@v0.21.0

Run precli on a single test example:

precli tests/unit/rules/python/stdlib/hmac/examples/hmac_timing_attack.py

Example code:

# level: ERROR
# start_line: 18
# end_line: 18
# start_column: 13
# end_column: 15
import hmac


received_digest = (
    b"\xe2\x93\x08\x19T8\xdc\x80\xef\x87\x90m\x1f\x9d\xf7\xf2"
    b"\xf5\x10>\xdbf\xa2\xaf\xf7x\xcdX\xdf"
)

key = b"my-super-duper-secret-key-string"
password = b"pass"
digest = hmac.digest(key, password, digest="sha224")

print(digest == received_digest)

Example result:

Example output

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

precli-0.6.4.tar.gz (358.3 kB view hashes)

Uploaded Source

Built Distribution

precli-0.6.4-py3-none-any.whl (135.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page