Skip to main content

pytrust

PyPI License

pytrust is a CLI tool to analyze Python packages for their use of file system, environment variables, web requests, and exec calls. It helps you audit dependencies and generate permission reports in YAML format.

Installation

pip install pytrust

Usage

Analyze a single package and print its permissions as YAML

$ pytrust pypdf
pypdf:
  file_system: true
  env_vars: false
  web_requests: false
  exec_usage: false

Check a package against a permissions file

$ pytrust pypdf package-permissions.yaml
Permission violations found:
 - file_system: REQUIRED but NOT GIVEN

Analyze all installed (non-default) packages and print combined YAML

$ pytrust > all-packages-permissions.yaml

# Gives:
pypdf:
  file_system: true
  env_vars: false
  web_requests: false
  exec_usage: false
pytz:
  file_system: true
  env_vars: true
  web_requests: false
  exec_usage: false
flit:
  file_system: true
  env_vars: true
  web_requests: true
  exec_usage: false
six:
  file_system: false
  env_vars: false
  web_requests: false
  exec_usage: true
... (the list might be pretty long!)

Permissions YAML Example

In this file you specify which packages are allowed to access certain resources. For example:

pypdf:
	file_system: true  # needed to read/write PDF files
	env_vars: false
	web_requests: false
	exec_usage: false

Permissions

  • INTERNET: Is socket/urllib/requests used?
  • FILE_SYSTEM: Is the file system accessed?
  • ENV_VARS: Are environment variables accessed?
  • EXEC_USAGE: Is exec() or similar used?

Contributing & Help

  • Issues and PRs welcome!

Made with ❤️ by Martin Thoma and contributors.

Metadata

Release files for pytrust 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytrust 0.2.6
File Size Uploaded Provenance
pytrust-0.2.6.tar.gz 5.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytrust 0.2.6
File Interpreter ABI Platform
pytrust-0.2.6-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / pytrust-0.2.6.tar.gz

Download URL pytrust-0.2.6.tar.gz
Size 5.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fc7c944efda688dba5d4485583a4c7c7e5392487373fc10f229c60389dcd49d0
BLAKE2b-256 checksum
How to use checksums
75766223a6ef17e1e125aadded3567bf03ce26f6a32c8827fb996db3fed1d10e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Release files / pytrust-0.2.6-py3-none-any.whl

Download URL pytrust-0.2.6-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
abadb43f1ce3b375e760a0a7089d11d83e45a0e92caa77893c3770ddcf393cfa
BLAKE2b-256 checksum
How to use checksums
aec3521b4e796c18740e160c9cd2caadaccb466a7c76f3393072b5a196391306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.32.3

Security for pytrust 0.2.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page