Skip to main content

CLI tool to check package permissions.

Project description

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.

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

pytrust-0.2.6.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pytrust-0.2.6-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file pytrust-0.2.6.tar.gz.

File metadata

  • Download URL: pytrust-0.2.6.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for pytrust-0.2.6.tar.gz
Algorithm Hash digest
SHA256 fc7c944efda688dba5d4485583a4c7c7e5392487373fc10f229c60389dcd49d0
MD5 28855f9ff0b2afcf103a5a9cdf490b0e
BLAKE2b-256 75766223a6ef17e1e125aadded3567bf03ce26f6a32c8827fb996db3fed1d10e

See more details on using hashes here.

File details

Details for the file pytrust-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: pytrust-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-requests/2.32.3

File hashes

Hashes for pytrust-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 abadb43f1ce3b375e760a0a7089d11d83e45a0e92caa77893c3770ddcf393cfa
MD5 f45863f70aba106354daaf96d77dba23
BLAKE2b-256 aec3521b4e796c18740e160c9cd2caadaccb466a7c76f3393072b5a196391306

See more details on using hashes here.

Supported by

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