Skip to content

Security

Security

MiniFy is designed with security as a core principle. This document explains how your credentials are stored, how your data is protected, and what privacy measures are in place.

Security Architecture Overview

┌─────────────────────────────────────────────────────────────────────────────┐
│ MiniFy Security Architecture │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ MiniFy Desktop Application │ │
│ ├────────────────────────────────────────────────────────────────────┤ │
│ │ │ │
│ │ ┌──────────────┐ ┌──────────────┐ ┌──────────────┐ │ │
│ │ │ React UI │ │ State Mgmt │ │ AI Client │ │ │
│ │ │ (Webview) │ │ (Memory) │ │ (Vercel AI) │ │ │
│ │ └──────┬───────┘ └──────────────┘ └──────┬───────┘ │ │
│ │ │ │ │ │
│ │ │ IPC (Tauri Commands) │ HTTPS │ │
│ │ ▼ ▼ │ │
│ │ ┌──────────────────────────────────────────────────────────┐ │ │
│ │ │ Rust Backend │ │ │
│ │ ├──────────────────────────────────────────────────────────┤ │ │
│ │ │ ┌────────────┐ ┌────────────┐ ┌────────────┐ │ │ │
│ │ │ │ OAuth │ │ Settings │ │ Keyring │ │ │ │
│ │ │ │ Handler │ │ Manager │ │ Manager │ │ │ │
│ │ │ └────────────┘ └────────────┘ └─────┬──────┘ │ │ │
│ │ └────────────────────────────────────────┼────────────────┘ │ │
│ └────────────────────────────────────────────┼────────────────────┘ │
│ │ │
│ ▼ │
│ ┌────────────────────────────────────────────────────────────────────┐ │
│ │ OS Credential Manager (Encrypted) │ │
│ │ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────────────┐ │ │
│ │ │ Spotify │ │ Spotify │ │ AI │ │ AI Keys │ │ │
│ │ │ Access │ │ Refresh │ │ OpenAI │ │ (Anthropic, │ │ │
│ │ │ Token │ │ Token │ │ Key │ │ Google, Groq) │ │ │
│ │ └──────────┘ └──────────┘ └──────────┘ └──────────────────┘ │ │
│ └────────────────────────────────────────────────────────────────────┘ │
│ │
└───────────────────────────────────────────────────────────────────────────┘

Credential Storage

All sensitive credentials are stored in your operating system’s secure credential manager, never in plain text files.

OS Credential Managers

Windows Credential Manager

  • Encryption: DPAPI (Data Protection API)
  • Key derivation: Based on user’s Windows login credentials
  • Access control: Only the logged-in user can access their credentials
  • Location: Encrypted in registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Credentials
Credential Names:
├── minify:access_token → Spotify access token
├── minify:refresh_token → Spotify refresh token
├── minify:token_expiry → Token expiration timestamp
├── minify:spotify_client_id → Spotify application ID
├── minify:music_provider → Active music provider
├── minify:ai_key_openai → OpenAI API key
├── minify:ai_key_anthropic → Anthropic API key
├── minify:ai_key_google → Google AI API key
└── minify:ai_key_groq → Groq API key

What’s Stored Where

Data TypeStorage LocationEncryptionSensitivity
Spotify Access TokenOS Keyring✅ OS-levelHigh
Spotify Refresh TokenOS Keyring✅ OS-levelHigh
AI API KeysOS Keyring✅ OS-levelHigh
Spotify Client IDOS Keyring✅ OS-levelMedium
Theme Preferencesettings.json❌ Plain textLow
Layout Preferencesettings.json❌ Plain textLow
AI Provider Configsettings.json❌ Plain textLow

Settings File Location

%APPDATA%\MiniFy\settings.json

Example: C:\Users\YourName\AppData\Roaming\MiniFy\settings.json

Example settings.json content:

{
"first_boot_done": true,
"spotify": {
"access_token": null,
"refresh_token": null
},
"layout": "LayoutB",
"theme": "dark",
"ai_providers": [
{ "provider": "openai", "enabled": true },
{ "provider": "anthropic", "enabled": false }
],
"active_ai_provider": "openai",
"active_music_provider": "spotify"
}

Spotify OAuth Security

PKCE Implementation

MiniFy uses OAuth 2.0 with PKCE (RFC 7636), the gold standard for public clients:

┌─────────────────────────────────────────────────────────────────┐
│ PKCE Security Flow │
├─────────────────────────────────────────────────────────────────┤
│ │
│ Client (MiniFy) Authorization Server │
│ │ │ │
│ │ 1. Generate code_verifier │ │
│ │ (64 random chars, URL-safe) │ │
│ │ │ │
│ │ 2. Compute code_challenge │ │
│ │ = Base64URL(SHA256(verifier)) │ │
│ │ │ │
│ │ ──────── Auth Request ──────────────▶ │ │
│ │ code_challenge │ │
│ │ (verifier stays local) │ │
│ │ │ │
│ │ ◀─────── Auth Code ───────────────── │ │
│ │ (one-time use) │ │
│ │ │ │
│ │ ──────── Token Request ─────────────▶ │ │
│ │ auth_code + code_verifier │ │
│ │ │ │
│ │ Server computes: │ │
│ │ SHA256(verifier) == challenge?│ │
│ │ │ │
│ │ ◀─────── Access + Refresh Token ──── │ │
│ │ │ │
└─────────────────────────────────────────────────────────────────┘

Why PKCE Matters

Attack VectorWithout PKCEWith PKCE
Authorization code interception❌ Attacker can exchange code✅ Code useless without verifier
Client secret extraction❌ Secret embedded in app✅ No secret needed
Replay attacks❌ Possible✅ Codes are one-time use
Man-in-the-middle❌ Secret could be intercepted✅ Verifier never transmitted

State Parameter (CSRF Protection)

Every OAuth flow includes a random state nonce:

// Generated at auth start
let mut state_bytes = [0u8; 16];
rand::thread_rng().fill_bytes(&mut state_bytes);
let state_nonce = hex::encode(state_bytes); // 32 hex chars

The callback validates that the returned state matches, preventing:

  • Cross-site request forgery attacks
  • Old browser tab reuse attempts
  • Session fixation attacks

AI Provider Security

Isolation Model

The AI never has direct access to your Spotify account:

┌───────────────────────────────────────────────────────────────────────────┐
│ AI Provider Isolation │
├───────────────────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────┐ ┌─────────────────────────┐ │
│ │ AI Provider │ │ MiniFy Application │ │
│ │ (OpenAI, etc.) │ │ │ │
│ ├─────────────────┤ ├─────────────────────────┤ │
│ │ │ │ ┌───────────────────┐ │ │
│ │ Receives: │ ◀─── Text Only ──── │ │ AI DJ Module │ │ │
│ │ • User prompts │ │ │ │ │ │
│ │ • Track names │ │ │ Prepares data: │ │ │
│ │ • Artist names │ │ │ - Track names │ │ │
│ │ • Genre info │ │ │ - Artists │ │ │
│ │ • Audio stats │ │ │ - Genres │ │ │
│ │ (numbers) │ │ │ - Audio features │ │ │
│ │ │ │ └─────────┬─────────┘ │ │
│ │ Never receives:│ │ │ │ │
│ │ ✗ Tokens │ │ ▼ │ │
│ │ ✗ Client ID │ │ ┌───────────────────┐ │ │
│ │ ✗ Account ID │ │ │ Spotify Client │ │ │
│ │ ✗ Other AI keys│ │ │ (Token Auth) │ │ │
│ │ │ │ └─────────┬─────────┘ │ │
│ └─────────────────┘ │ │ │ │
│ │ ▼ │ │
│ │ ┌───────────────────┐ │ │
│ │ │ Spotify API │ │ │
│ │ │ (HTTPS + Token) │ │ │
│ │ └───────────────────┘ │ │
│ │ │ │
│ └─────────────────────────┘ │
│ │
└────────────────────────────────────────────────────────────────────────────┘

Data Shared with AI Providers

✅ Shared (necessary for recommendations):

  • Track names and artists
  • Genre information
  • Audio feature values (energy: 0.7, valence: 0.5, etc.)
  • Your text messages/prompts

❌ Never shared:

  • Spotify access tokens
  • Spotify refresh tokens
  • Your Spotify account ID or email
  • Other AI provider’s API keys
  • Any personally identifiable information

API Key Isolation

Each AI provider’s key is stored separately and only used for its respective provider:

OS Keyring Entries:
├── minify:ai_key_openai → Only used for OpenAI calls
├── minify:ai_key_anthropic → Only used for Anthropic calls
├── minify:ai_key_google → Only used for Google AI calls
└── minify:ai_key_groq → Only used for Groq calls

Spotify API Permissions

MiniFy follows the principle of least privilege:

Read-Only Scopes

ScopePurposeAccess Level
user-read-playback-stateCurrent playback infoRead
user-read-currently-playingCurrently playing trackRead
user-top-readTop tracks/artists for AI DJRead
user-read-recently-playedPlay history for AI DJRead
user-library-readSaved tracks countRead
playlist-read-privateView playlistsRead

Write Scopes (Limited)

ScopePurposeAccess Level
user-modify-playback-statePlay, pause, skip, seekWrite (playback only)

Network Security

Encryption in Transit

All network communications use TLS 1.2 or higher:

ConnectionProtocolCertificate Validation
Spotify APIHTTPS (TLS 1.2+)✅ System trust store
Spotify AuthHTTPS (TLS 1.2+)✅ System trust store
AI ProvidersHTTPS (TLS 1.2+)✅ System trust store
OAuth CallbackHTTP (localhost only)N/A (local only)

No External Data Collection

MiniFy does not:

  • Send telemetry to MiniFy servers
  • Track usage analytics
  • Phone home for any reason
  • Include any third-party analytics SDKs

All data stays between your device and the APIs you configure (Spotify, AI providers).

Clearing Credentials

Using the CLI

Terminal window
# Clear all credentials (Spotify tokens, AI keys, settings)
pnpm desktop:clear

Using the App

  1. Open Settings (right-click → Settings)
  2. Navigate to “Connections”
  3. Click “Disconnect” for each service

What Gets Cleared

ItemCLI ClearApp Disconnect
Spotify Access Token
Spotify Refresh Token
Spotify Client ID
AI API Keys✅ (per provider)
Settings File
Custom Themes

Security Best Practices

For Users

  1. Keep API keys private - Never share them or commit them to version control
  2. Use unique API keys - Create keys specifically for MiniFy in each provider’s dashboard
  3. Revoke if compromised - Immediately rotate keys if you suspect exposure
  4. Keep MiniFy updated - Updates may include security fixes
  5. Use strong OS passwords - Your keyring security depends on your login credentials

For Developers

  1. Never log tokens - Access and refresh tokens should never appear in logs
  2. Use environment variables - For build-time secrets like client IDs
  3. Validate OAuth state - Always check the state parameter in callbacks
  4. Clear sensitive memory - Zero-out sensitive data after use

Reporting Security Issues

If you discover a security vulnerability:

  1. Do not open a public GitHub issue
  2. Email the maintainers at the address in SECURITY.md
  3. Include:
    • Description of the vulnerability
    • Steps to reproduce
    • Potential impact
    • Suggested fix (if any)
  4. Allow reasonable time for a fix before public disclosure

Compliance Notes

  • GDPR: MiniFy stores minimal data locally. No data is transmitted to MiniFy servers.
  • Data Portability: All data is stored in standard formats (JSON, OS keyring).
  • Right to Erasure: Users can delete all data using pnpm desktop:clear.