Skip to main content

Codeaudit

CodeauditLogo

PythonCodeAudit Badge PyPI - Version PyPI - Python Version OpenSSF Best Practices Documentation License Try WebAssembly Version PyPI Downloads

Python Code Audit - A modern Python security source code analyzer based on distrust.

Python Code Audit is a static application security testing (SAST) tool designed to identify security weaknesses in Python source code. It combines powerful analysis features with an intuitive workflow, making essential security audits both simple and engaging.

This tool is designed for anyone who uses or creates Python programs and wants to understand and mitigate potential security risks.

It runs 100% locally in your browser via WebAssembly (WASM). See the full power of Python Code Audit within 60 seconds. No downloads. No dependencies. Just click and run a security audit on any Python package on PyPI!

This tool is created for:

  • Python Users who want to assess the security risks in the Python code they use.
  • Python Developers: Anyone, from professionals to hobbyists, who wants to deliver secure Python code.
  • Security-Conscious Users: People seeking a simple, fast way to gain insight into potential security vulnerabilities within Python packages or files.

Creating secure software can be challenging. This tool, with its comprehensive documentation, acts as your helpful security colleague, making it easier to identify and address vulnerabilities.

Features

Python Code Audit has the following features:

  • Vulnerability Detection: Identifies security vulnerabilities in Python files, essential for package security research.

  • Complexity & Statistics: Reports security-relevant complexity using a fast, lightweight cyclomatic complexity count via Python's AST.

  • Module Usage & External Vulnerabilities: Detects used modules and reports known vulnerabilities for used external modules.

  • Inline Issue Reporting: Shows potential security issues with line numbers and code snippets.

  • External Egress Detection: Identifies embedded API keys and logic that enables communication with remote services, helping uncover hidden data exfiltration paths.

  • CI/CD Ready: Integrates seamlessly into any CI/CD workflow.

  • HTML Reports: All output is saved in simple, static HTML reports viewable in any browser.

Installation

Loved the browser version? Unlock the full power. For advanced security code inspections, CI/CD integration, and all professional features, install the complete Python package:

pip install -U codeaudit

If you have installed Python Code Audit previously and want to ensure you are using the latest validations and features, simply run this command again. Python Code Audit is frequently updated with new checks.

Usage

After installation you can get an overview of all implemented commands. Just type in your terminal:

codeaudit

This will show all commands:

----------------------------------------------------
 _                    __             _
|_) \/_|_|_  _ __    /   _  _| _    |_|    _| o _|_
|   /  |_| |(_)| |   \__(_)(_|(/_   | ||_|(_| |  |_
----------------------------------------------------

Python Code Audit - A modern Python security source code analyzer based on distrust.


Commands to evaluate Python source code:
Usage: codeaudit COMMAND <directory|package>  [report.html]

Depending on the command, you must specify a local directory, a Python file, or a package name hosted on PyPI.org.Reporting: The results are generated as a static HTML report for viewing in a web browser.

Commands:
  overview             Generates an overview report of code complexity and security indicators.
  filescan             Scans Python source code or PyPI packages for security weaknesses.
  cimode               Run a SAST scan for CI workflows.
  modulescan           Generate a report on known vulnerabilities in Python modules and packages.
  checks               Creates an HTML report of all implemented security checks.
  version              Prints the module version. Or use codeaudit [-v] [--v] [-version] or [--version].

Use the Python Code Audit documentation (https://codeaudit.nocomplexity.com) to audit and secure your Python programmes. Explore further essential open-source security tools at https://simplifysecurity.nocomplexity.com/

Example

By running the codeaudit filescan command, detailed security information is determined for a Python file based on more than 89 validations implemented.

The codeaudit filescan command shows all potential security issues that are detected in the source file in a HTML-report.

Per line a the in construct that can cause a security risks is shown, along with the relevant code lines where the issue is detected.

To scan a Python package on PyPI.org on possible security issues, do:

codeaudit filescan <package-name> [reportname.html]

=====================================================================
Codeaudit report file created!
Paste the line below directly into your browser bar:
	file:///home/usainbolt/tmp/codeaudit-report.html

=====================================================================

Example view of filescan report

Contributing

All contributions are welcome! Think of corrections on the documentation, code or more and better tests.

Simple Guidelines:

  • Questions, Feature Requests, Bug Reports please use on the Github Issue Tracker.

Pull Requests are welcome!

When you contribute to Codeaudit, your contributions are made under the same license as the file you are working on.

We adopt the Collective Code Construction Contract(C4) to streamline collaboration.

License

codeaudit is distributed under the terms of the GPL-3.0-or-later license.

Metadata

Release files for codeaudit 1.9.4

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

Source distribution (sdist)

Source distribution for codeaudit 1.9.4
File Size Uploaded Provenance Actions
codeaudit-1.9.4.tar.gz 4.1 MB Without provenance Details for codeaudit-1.9.4.tar.gz

Built distribution (wheel)

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

Total release size: 4.2 MB

Release files / codeaudit-1.9.4.tar.gz

Download URL codeaudit-1.9.4.tar.gz
Size 4.1 MB
Tags Source
SHA-256 checksum
How to use checksums
a7e6ba6e4f95066ece91f3a5f40c068a701a909c4a295f2295c9b3ef3a6def9a
BLAKE2b-256 checksum
How to use checksums
8f30d86aec93f90f95770aa18d689596c6f9d924dede3d220528b5eca9cf7c45
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.2 {"ci":null,"cpu":"x86_64","distro":{"id":"resolute","libc":{"lib":"glibc","version":"2.43"},"name":"Ubuntu","version":"26.04"},"implementation":{"name":"CPython","version":"3.15.2"},"installer":{"name":"hatch","version":"1.18.2"},"openssl_version":"OpenSSL 3.5.9 29 Sep 2026","python":"3.15.2","system":{"name":"Linux","release":"7.0.0-42-generic"}} HTTPX2/2.16.0

Release files / codeaudit-1.9.4-py3-none-any.whl

Download URL codeaudit-1.9.4-py3-none-any.whl
Size 94.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cc90b2a22fb9af32fa3b919c774653e6144317825676efa9ccc32a89bf28ec45
BLAKE2b-256 checksum
How to use checksums
0e30b9da1818a90f6bff547382a4b627515a321ca4f8c8404771eab9b8ce2e0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via Hatch/1.18.2 {"ci":null,"cpu":"x86_64","distro":{"id":"resolute","libc":{"lib":"glibc","version":"2.43"},"name":"Ubuntu","version":"26.04"},"implementation":{"name":"CPython","version":"3.15.2"},"installer":{"name":"hatch","version":"1.18.2"},"openssl_version":"OpenSSL 3.5.9 29 Sep 2026","python":"3.15.2","system":{"name":"Linux","release":"7.0.0-42-generic"}} HTTPX2/2.16.0

Security for codeaudit 1.9.4

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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