Skip to main content

Overview

KafkaCode uses multiple detection methods to identify privacy issues, secrets, and compliance violations in your source code.

Detection Categories

Secrets Detection

API keys, tokens, credentials

PII Detection

Personal identifiable information

Compliance Checks

GDPR, CCPA requirements

Context Analysis

AI-powered semantic analysis

Secrets Detection

Critical Level Secrets

Pattern: AKIA[0-9A-Z]{16}Example:
Severity: Critical (100 points)
Pattern: -----BEGIN (RSA |EC )?PRIVATE KEY-----Example:
Severity: Critical (100 points)
Pattern: sk_live_[0-9a-zA-Z]{24}Example:
Severity: Critical (100 points)
Pattern: Password/credentials in connection stringsExample:
Severity: Critical (100 points)

High Level Secrets

Pattern: GitHub, GitLab, and other OAuth tokensExample:
Severity: High (50 points)
Pattern: jwt_secret, JWT_SECRET assignmentsExample:
Severity: High (50 points)
Pattern: Generic API key patternsExample:
Severity: High (50 points)

PII Detection

Medium Level PII

Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}Example:
Severity: Medium (10 points)GDPR Consideration: Email addresses are PII under GDPR
Pattern: Various international formatsExample:
Severity: Medium (10 points)CCPA Consideration: Phone numbers are personal information
Pattern: \d{3}-\d{2}-\d{4}Example:
Severity: Critical (100 points)
Pattern: Luhn algorithm validated sequencesExample:
Severity: Critical (100 points)

Low Level PII

Pattern: \b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\bExample:
Severity: Low (1 point)
Pattern: URLs containing /api/, /admin/, /secret/Example:
Severity: Low (1 point)

High Entropy Strings

KafkaCode detects strings with high randomness that might be secrets:
Thresholds:
  • Entropy > 4.5 and length > 16: Potential secret
  • Entropy > 5.0 and length > 24: Likely secret
Example:

Sensitive Keywords

Detection of sensitive data based on variable naming:

Context-Aware Detection

The AI analyzer understands code context:

Example 1: Configuration vs Hardcoded

The AI recognizes that hardcoded values are problematic while env vars are acceptable.

Example 2: Test Data vs Real Data

The AI understands context and reduces false positives for test data.

Example 3: Public vs Private

Compliance-Specific Detection

GDPR Compliance

Personal Data

  • Name, email, phone
  • IP addresses
  • Location data
  • Cookies with PII

Special Categories

  • Health data
  • Biometric data
  • Genetic data
  • Religious/political views

CCPA Compliance

Personal Information

  • Contact information
  • Financial information
  • Purchase history
  • Browsing history

Identifiers

  • Device IDs
  • IP addresses
  • Cookie IDs
  • Account usernames

False Positive Reduction

KafkaCode uses several techniques to reduce false positives:
1

Context Analysis

AI understands if a value is a placeholder, test data, or real credential
2

Assignment Context

Only flags sensitive keywords when they’re being assigned values
3

Environment Variable Detection

Recognizes when values come from env vars or config files
4

Comment Analysis

Understands # TODO or # FIXME comments that mention sensitive data

Best Practices

  • ✅ Use environment variables for all secrets
  • ✅ Store credentials in secure vaults (AWS Secrets Manager, etc.)
  • ✅ Use .env files with .gitignore
  • ✅ Rotate secrets regularly
  • ✅ Use different secrets for dev/staging/prod
  • ❌ Never commit secrets to version control
  • ❌ Don’t hardcode API keys or passwords
  • ❌ Don’t store PII unnecessarily
  • ❌ Don’t log sensitive information
  • ❌ Don’t share secrets in plain text

Next Steps

Privacy Grading

Understand how grades are calculated

Interpreting Results

Learn to read scan reports

Custom Patterns

Add your own detection rules

Examples

See real-world examples