Authentication
Panguard AI uses an OAuth-based authentication flow for CLI sessions, with multiple layers of credential security including AES-256-GCM encryption, TOTP two-factor authentication, and timing-safe API key verification.Authentication Flow Overview
CLI Login
Standard Flow (With Browser)
Start login
Browser authentication
Your default browser opens to
panguard.ai/login?cli_state={state}. Complete login via Google OAuth or email and password.Token callback
The server redirects back to the local callback URL. The CLI receives and stores the session token.
Headless Flow (SSH / No Browser)
Google OAuth
Panguard supports Google OAuth for one-click sign-in. When you click “Sign in with Google” on the web or during the CLI flow, Panguard receives only your email and display name — no Google password or other account data is accessed.Credential Storage
File Location and Permissions
0o600 (owner read/write only) immediately after creation. The CLI verifies these permissions on every startup and warns if they have been loosened.
Token Format
Session Lifetime
- CLI sessions are valid for 30 days
- After expiration, run
panguard loginagain - Check expiration with
panguard whoami
Credentials Encryption
Sensitive configuration fields (API keys, LLM provider tokens) are encrypted at rest using AES-256-GCM:| Property | Value |
|---|---|
| Algorithm | AES-256-GCM |
| Key derivation | Machine-specific key from hardware identifiers |
| Storage | ~/.panguard/llm.enc for AI provider keys |
| IV | Unique per encryption operation |
The encryption key is derived from your machine’s hardware identifiers, so encrypted config files cannot be copied to a different machine and decrypted.
TOTP Two-Factor Authentication
Panguard supports TOTP-based 2FA for additional account security.Enable 2FA
Navigate to Account Settings on panguard.ai and select Enable Two-Factor Authentication. Scan the QR code with your authenticator app (Google Authenticator, Authy, 1Password, etc.).
Save backup codes
Panguard generates 10 single-use backup codes. Store them securely — these are the only way to recover your account if you lose your authenticator device.
Session Management
Logout
- Local — Deletes
~/.panguard/credentials.json - Server-side — Invalidates the session token on the Panguard API server
Verify Session
Manager API Authentication
The Panguard Manager (fleet orchestration layer) uses Bearer token authentication for its REST API:| Property | Value |
|---|---|
| Header | Authorization: Bearer <token> |
| Comparison | SHA-256 timing-safe (crypto.timingSafeEqual) |
| Rate limiting | Per-token, configurable |
Timing-safe comparison prevents timing attacks that could be used to guess valid tokens character by character.
Threat Cloud API Authentication
The Threat Cloud API uses API keys with per-key rate limiting:| Property | Value |
|---|---|
| Header | X-API-Key: <key> |
| Rate limit | Per-key, default 100 requests/minute |
| Key format | 64-character hex string |
| Comparison | SHA-256 timing-safe |
Security Measures Summary
| Measure | Details |
|---|---|
| CSRF protection | Random state token validates the OAuth callback |
| Callback restriction | Only localhost callback URLs are accepted |
| File permissions | credentials.json set to 0o600 on creation |
| Token expiration | Sessions auto-expire after 30 days |
| Flow timeout | Pending authentication flows cleaned up after 10 minutes |
| Encryption at rest | AES-256-GCM for sensitive config fields |
| Timing-safe comparison | All API token verification uses constant-time comparison |
| 2FA support | Optional TOTP with backup codes |