libsast
A generic SAST library built on top of semgrep and regex
What it is and what it does
libsast is a Python library that brings static security analysis to your codebase through regex-based pattern matching and semantic-aware analysis. You define security patterns in YAML files and point libsast at your code; it returns a JSON report with matched findings, line numbers, and metadata like CWE and severity classifications.
The library is designed for security engineers who need programmatic access to SAST capabilities rather than a standalone tool. It depends on billiard for task distribution, pyyaml for rule parsing, and requests for network operations. The pattern matcher supports complex logical rules (AND, OR, NOT combinations). Both engines can be used independently or together, with pattern matching available cross-platform and semantic analysis available on Mac and Linux.
Use it for:
- Integrate security scanning into CI/CD pipelines to catch vulnerabilities before code is merged.
- Build custom security analysis tools that apply organization-specific patterns to codebases.
- Scan mobile or web application code for known dangerous APIs and insecure patterns.
- Generate compliance reports by running predefined rule sets across multiple projects.
- Automate security code reviews by detecting common misconfigurations and hardcoded secrets.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
libsast is a static application security testing library that scans code using regex-based pattern matching and semantic analysis to find security issues.
Yes, if you need programmatic SAST capabilities. The library is actively maintained, has no known vulnerabilities, and supports current Python versions (3.10 through 3.14). The copyleft license is acceptable for most open-source and internal use but requires review for proprietary distribution. Install friction is low. Best suited for teams building security tooling or integrating scanning into automated workflows.
Install
libsast on PyPI
pip
pip install libsastuv
uv add libsastpoetry
poetry add libsastInstalling libsast
Before you install
Low install friction with a pure-Python wheel distribution. Actively maintained with a recent release 4 days ago and steady commit activity. Requires a separate semantic analysis tool for full functionality; pattern matching works cross-platform but semantic analysis is limited to Mac and Linux.
License in practice
Licensed under LGPL-3.0-or-later (copyleft). Any derivative work or modification must be distributed under compatible terms; proprietary applications linking this library must comply with copyleft obligations.
Quickstart
pip install libsast
from libsast.scanner import Scanner
scanner = Scanner(path='./code', pattern_file='rules.yaml')
results = scanner.scan()
Semantic analysis support is limited to Mac and Linux; pattern matcher alone is cross-platform. Requires Python 3.10 or later.
Verify before relying
- Whether the package's API is stable or still evolving given Beta development status.
- Performance characteristics when scanning large codebases or with many custom rules.
- How rule updates are managed and whether dependency versions are pinned or auto-updated.
- Specific capabilities and output format of the Scanner class and its methods.
Package facts
| License | LGPL-3.0-or-later (copyleft) |
| Python support | supports the current Python release (<4.0,>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — billiard, pyyaml, requests |
| Maintenance | actively maintained — 4 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 383,550/month — #7,076 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: libsast-3.1.8-py3-none-any.whl
Keywords: libsast, SAST, Python SAST, SAST API, Regex SAST, Pattern Matcher
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
njsscannjsscan is a static application security…
copyleft · top 15,000 on PyPI
semgrepSemgrep is a static analysis tool that searches…
copyleft · top 1,000 on PyPI
mobsfscanmobsfscan is a static analysis tool that…
copyleft · top 15,000 on PyPI
flawfinderFlawfinder scans C/C++ source code to identify…
copyleft · top 15,000 on PyPI
zaproxyPython client library for the OWASP ZAP…
permissive · top 15,000 on PyPI
anysProvides matcher objects that compare equal to…
permissive · top 5,000 on PyPI
secscanner2junitConverts GitLab security scanner output (SAST,…
copyleft · top 15,000 on PyPI
kingfisher-binKingfisher is a command-line secret scanner…
permissive · top 15,000 on PyPI
cycodeCycode is a command-line security scanner that…
permissive · top 15,000 on PyPI
zizmorzizmor is a static analysis tool that scans…
permissive · top 5,000 on PyPI