Skip to content

🔒 Secure Bug Reporting with Encrypted Logs #48

Description

@Lewik

🔒 Secure Bug Reporting with Encrypted Logs

Problem

Users want to report bugs with detailed logs, but logs may contain sensitive information (conversation content, file paths, project names). Currently no secure way to share debug information.

Solution

Implement log encryption system allowing users to:

  1. Clean all user/AI conversation content from logs
  2. Encrypt logs locally with developer's public key
  3. Submit encrypted logs via GitHub issues
  4. Only developer can decrypt logs for debugging

User Workflow

  1. User encounters bug
  2. Goes to Settings → Logging section
  3. Clicks "Encrypt Logs Folder" → creates encrypted bundle + opens folder with result
  4. User manually creates GitHub issue and pastes encrypted data
  5. User adds bug description and submits issue

Implementation Plan

Phase 1: Log Cleanup 🧹

  • Remove ALL message content from logs:
    • User messages (sendMessage() calls)
    • AI responses (Claude output)
    • Tool execution results containing sensitive data
    • Voice transcription content
  • Keep only technical events:
    • Process start/stop events
    • File I/O operations (with full paths - they'll be encrypted anyway)
    • Error stack traces
    • System configuration data

Phase 2: Encryption Infrastructure 🔐

  • Developer key generation: Generate RSA key pair locally on dev machine
  • Key storage:
    • Public key: src/main/resources/keys/public.pem
    • Private key: keys/private.pem (add to .gitignore)
  • Encryption service: Integrate Google Tink for file encryption
  • Archive creation: ZIP entire logs/ folder before encryption

Phase 3: Settings UI 🎨

Add new "Logging" section to Settings panel with specific buttons:

Button 1: "Open Logs Folder"

  • Action: Desktop.open(File("logs/"))
  • Behavior: Opens logs directory in system file manager
  • Position: Top of logging section

Button 2: "Encrypt Logs Folder"

  • Action:
    1. Create ZIP of entire logs/ directory
    2. Encrypt ZIP with public key
    3. Save as logs/encrypted/gromozeka-logs-[timestamp].enc
    4. Open encrypted/ folder in file manager
  • Behavior: Shows progress indicator during encryption
  • Success: Toast notification + auto-open result folder
  • Error: Error dialog with details

Button 3: "Clear All Logs"

  • Action: Delete all files in logs/ directory
  • Behavior: Confirmation dialog before deletion
  • Position: Bottom of section with warning styling

Technical Implementation Details

Encryption Service

class LogEncryptionService {
    fun encryptLogsFolder(): File {
        // 1. ZIP logs/ directory  
        // 2. Encrypt with embedded public key
        // 3. Save to logs/encrypted/
        // 4. Return encrypted file
    }
}

Key Management

  • One-time generation: Developer runs key generation script locally
  • Public key: Embedded in JAR (/keys/public.pem)
  • Private key: keys/private.pem in repo root (gitignored)
  • Algorithm: RSA 4096-bit for hybrid encryption

File Structure After Encryption

logs/
├── dev.log                           # Cleaned logs  
├── session-abc123.jsonl             # Cleaned session logs
├── screenshot.png                   # User-added files
└── encrypted/
    └── gromozeka-logs-20240115-143022.enc  # Encrypted bundle

Settings UI Layout

[Logging]
┌─────────────────────────────────┐
│ 📁 [Open Logs Folder]          │  ← Opens logs/
├─────────────────────────────────┤
│ 🔒 [Encrypt Logs Folder]       │  ← Creates encrypted bundle
├─────────────────────────────────┤  
│ 🗑️ [Clear All Logs]           │  ← Deletes all log files
└─────────────────────────────────┘

Privacy & Security Guarantees

  • No conversation content in logs (user or AI messages)
  • Full file paths preserved (encrypted anyway)
  • Only developer can decrypt logs
  • User explicit control over encryption timing
  • Local encryption only - no network transmission

Success Criteria

  • All user messages removed from StreamLogger and session logs
  • All AI responses removed from logs
  • "Encrypt Logs Folder" button creates encrypted bundle reliably
  • Encrypted folder opens automatically after encryption
  • Users can add screenshots/files before encryption
  • Developer can decrypt logs with private key
  • Private key properly gitignored

Developer Decryption Workflow

# Decrypt received logs from GitHub issue
cd keys/
openssl rsautl -decrypt -inkey private.pem -in gromozeka-logs-*.enc -out logs.zip
unzip logs.zip
# Analyze full logs with complete context

Files to Update

  • StreamLogger.kt - remove message logging
  • Session.kt - clean message persistence
  • logback-spring.xml - remove sensitive log categories
  • SettingsPanel.kt - add logging section UI
  • .gitignore - add keys/private.pem

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions