Skip to content

feat: Per-Key Combo Access Control#2203

Open
Fadliirjiyansy wants to merge 2 commits into
decolua:masterfrom
Fadliirjiyansy:main
Open

feat: Per-Key Combo Access Control#2203
Fadliirjiyansy wants to merge 2 commits into
decolua:masterfrom
Fadliirjiyansy:main

Conversation

@Fadliirjiyansy

Copy link
Copy Markdown

Feature: Per-Key Combo Access Control

Adds ability to restrict which combos an API key can access.

Changes

  • Schema: allowedCombos TEXT column in apiKeys table (JSON array storage)
  • Middleware: Combo access control in ALL SSE handlers (chat, image, tts, search, fetch)
  • Dashboard UI: Multi-select combo checkboxes in Create/Edit API Key modal
  • Migration: Auto-add column via syncSchemaFromTables (no versioned migration needed)

Behavior

  • allowedCombos: [] or null → allow all (backward compatible)
  • Combo name in model param → check permission, 403 if not allowed
  • Regular model string (openai/gpt-4) → always allowed

Architecture

Excalidraw

Testing

  • Build passes (npm run build exit 0)
  • All 5 SSE handlers consistently enforce allowedCombos
  • Backward compatible with existing API keys (empty = allow all)

root added 2 commits June 29, 2026 04:15
- Add allowedCombos field to API key schema (JSON TEXT)
- Add combo access control middleware to all SSE handlers (chat, image, tts, search, fetch)
- Add multi-select combo UI in dashboard Create/Edit Key modal
- Backward compatible: empty/null allowedCombos = allow all
- Auto-migration via syncSchemaFromTables
…search)

- chat.js: per-key combo check after apiKey validation
- imageGeneration.js: per-key combo check after apiKey validation
- tts.js: hoist apiKey scope + per-key combo check
- search.js: per-key combo check using getComboModelsFromData
- All 5 handlers now consistently enforce allowedCombos restrictions
- Backward compatible: empty/null allowedCombos = allow all
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