Skip to content

fix: AI privacy — connection policy, Gemini key, file protection#619

Merged
datlechin merged 1 commit intomainfrom
fix/ai-privacy-security
Apr 7, 2026
Merged

fix: AI privacy — connection policy, Gemini key, file protection#619
datlechin merged 1 commit intomainfrom
fix/ai-privacy-security

Conversation

@datlechin
Copy link
Copy Markdown
Member

Summary

Fixes 3 privacy/security issues found during AI system audit:

  • H2 — Inline suggestions ignore connection AI policy: InlineSuggestionManager never checked AIConnectionPolicy. A connection set to "Never" still sent SQL to the AI provider for inline completions. Fix: added connectionPolicy property, passed through the view chain (MainEditorContentViewQueryEditorViewSQLEditorViewSQLEditorCoordinatorInlineSuggestionManager), and checked in isEnabled().

  • H6 — Gemini API key exposed in URL query string: All 3 Gemini endpoints (streamGenerateContent, fetchAvailableModels, testConnection) embedded the API key as ?key= in the URL, making it visible in proxy logs, network captures, and OS-level logging. Fix: moved to x-goog-api-key HTTP header (supported by Gemini API), matching how Anthropic uses x-api-key and OpenAI uses Authorization: Bearer.

  • H8 — Chat history stored as unencrypted plain-text JSON: AI conversations in ~/Library/Application Support/TablePro/ai_chats/ had no file protection beyond atomic writes. Fix: added .completeFileProtectionUntilFirstUserAuthentication to both file writes and the directory itself, providing FileVault-level encryption at rest.

Test plan

  • Build succeeds with no new warnings
  • Set connection AI policy to "Never" → inline suggestions should not appear in the SQL editor
  • Set connection AI policy to "Always Allow" → inline suggestions work normally
  • Gemini provider: test connection, fetch models, and chat all work (key now in header)
  • AI chat conversations are saved with file protection attributes

@datlechin datlechin merged commit a97d6e9 into main Apr 7, 2026
2 checks passed
@datlechin datlechin deleted the fix/ai-privacy-security branch April 7, 2026 11:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant