skillfed

libsast

A generic SAST library built on top of semgrep and regex

libsast v3.1.8 383.6K downloads/30d#7,076 on PyPI139
Copyleft license LGPL-3.0-or-later Active released

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 libsast

uv

uv add libsast

poetry

poetry add libsast

Installing 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

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)Programming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: SecurityTopic :: Software Development :: Quality Assurance

Tags

static application security testingcode security scanningregex pattern matching securitySAST library pythonvulnerability detection codesecurity pattern matchersemantic code analysis
security-scanningcode-analysisci-cd-integration

More Security packages