Cybersecurity Updates & Tools

Kereva Scanner for Python LLM Application Security

Kereva LLM Code Scanner is a static analysis tool built to inspect Python applications that use Large Language Models (LLMs). It helps developers identify potential security weaknesses, problematic prompt patterns, and implementation issues without executing the application.

LLM-powered applications introduce risks that traditional code analysis may not fully address. Prompt construction, user input handling, model output processing, and framework-specific integrations can all create security and reliability challenges. Kereva Scanner provides specialized checks for these areas, making it useful during development, code reviews, and pre-deployment assessments.

Key Features of Kereva Scanner

  • Static Code Analysis: Examines source code without running the application, allowing developers to identify potential problems before deployment.
  • LLM-focused Security Checks: Includes specialized scanners for issues associated with LLM applications, such as prompt injection risks, subjective prompt wording, and potentially unsafe implementation patterns.
  • Python and Jupyter Notebook Support: Analyzes standard Python files and Jupyter notebooks, making it suitable for both application development and experimentation.
  • Flexible Reporting: Displays findings in the console or exports structured JSON reports for further analysis and integration with development workflows.
  • Selective Scanning: Allows developers to list available scanners and run selected checks instead of scanning every supported category.

Installing Kereva LLM Code Scanner

Start by cloning the project repository and installing its Python dependencies. Make sure Git and a compatible Python environment are available before proceeding.

git clone https://github.com/rbitr/kereva-scanner.git
cd kereva-scanner
pip install -r requirements.txt

After installation, you can run the scanner against individual files or directories. The following examples demonstrate the basic commands:

Scan a Python file:

python main.py path/to/file.py

Scan an entire directory:

python main.py path/to/directory

Export findings as JSON:

python main.py --json --json-dir reports

JSON output is useful for preserving scan results, processing findings with other scripts, and connecting security checks to automated development pipelines.

Specialized Scanner Modules

Kereva Scanner organizes its analysis into specialized modules that examine different parts of an LLM application:

  • Prompt Scanners: Inspect prompt construction for potentially problematic patterns, including improper XML tag usage, subjective terms, and inefficient caching approaches.
  • Chain Scanners: Examine input handling and application chains for potential weaknesses, including risks associated with LangChain-based implementations.
  • Output Scanners: Identify potentially unsafe output-processing patterns, including risks involving code execution and output constraint validation.

Developers can inspect the available checks before running a scan:

python main.py --list_scans

To execute a specific scanner, use the --scans option with its scanner identifier:

python main.py --scans prompt.subjective_terms

For more detailed diagnostics, enable comprehensive scanning and configure a directory for log files:

python main.py --comprehensive --log-dir logs

Where Kereva Scanner Fits into LLM Development

Kereva Scanner can support several stages of the software development lifecycle. Security teams can use it during source-code reviews to identify suspicious prompt and input-handling patterns. Developers can also use its findings to improve prompt engineering practices and review how model-generated output is processed.

Its command-line interface and JSON reporting make it a potential addition to CI/CD workflows. Automated scans can help teams identify issues before changes reach production, although static analysis should be combined with runtime testing, manual reviews, and dedicated LLM security assessments.

Download Kereva LLM Code Scanner

Kereva LLM Code Scanner provides Python developers with a focused way to inspect LLM application code for security and implementation concerns. Its specialized scanners, notebook support, selective execution, and structured reporting make it a useful addition to development security workflows.

Explore the source code, installation instructions, and available scanner options in the official Kereva Scanner GitHub repository.

For additional security testing, explore our guide to DefectDojo for managing security findings.