Skip to main content

Overview

The LLMAnalyzer class uses AI/LLM to perform contextual analysis of code for privacy issues that go beyond simple pattern matching.

Constructor

Example:

Properties

verbose

Controls verbose logging output. Type: boolean

Methods

analyzeFile(filePath, content, patternFindings)

Performs AI-powered analysis on file content.
Parameters:
  • filePath (string): Path to the file
  • content (string): File content
  • patternFindings (Finding[]): Findings from pattern scanner (context)
Returns: Promise resolving to array of findings Example:

How It Works

The LLM Analyzer:
  1. Takes context from pattern findings - Uses initial pattern matches to focus analysis
  2. Analyzes code semantically - Understands code context and intent
  3. Identifies subtle issues - Finds privacy concerns that patterns miss
  4. Reduces false positives - Filters out non-issues based on context
  5. Provides specific recommendations - Gives actionable advice

Usage Examples

Basic LLM Analysis

Combined Analysis

The LLM Analyzer helps reduce false positives by understanding code context, such as distinguishing between test data and real credentials.

Next Steps

PatternScanner

Pattern-based detection

How It Works

Understand the dual-layer approach