Files
goclaw/migrations/000032_secure_cli_user_credentials.up.sql
viettranx 21b6c454ca feat: merge pipeline, per-user credentials, unified picker, group contacts
- Enable merge UI for linking channel contacts to tenant_users
- Contact → tenant_user resolution with cached lookup (60s TTL)
- MCP per-user credentials via user-keyed connection pool
- Secure CLI per-user credentials with AES-256-GCM encryption
- Unified UserPickerCombobox searching contacts + tenant_users
- Group contact collection with chat title in all channels
- Group permission inheritance via wildcard user_id="*"
- Fix heartbeat using wrong userID in group chats
- Filter internal senders from contact collection
- Add contact_type column (user/group) to channel_contacts
- SQLite schema v2 migration for desktop edition
2026-03-29 22:33:17 +07:00

21 lines
1.1 KiB
SQL

-- Per-user credentials for secure CLI binaries.
-- Mirrors mcp_user_credentials pattern: user-specific env vars override binary defaults.
CREATE TABLE secure_cli_user_credentials (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
binary_id UUID NOT NULL REFERENCES secure_cli_binaries(id) ON DELETE CASCADE,
user_id VARCHAR(255) NOT NULL,
encrypted_env BYTEA NOT NULL, -- AES-256-GCM encrypted JSON: {"GH_TOKEN":"xxx"}
metadata JSONB NOT NULL DEFAULT '{}',
tenant_id UUID NOT NULL REFERENCES tenants(id),
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
UNIQUE(binary_id, user_id, tenant_id)
);
CREATE INDEX idx_scuc_tenant ON secure_cli_user_credentials(tenant_id);
CREATE INDEX idx_scuc_binary ON secure_cli_user_credentials(binary_id);
-- Add contact_type column to channel_contacts to distinguish user vs group contacts.
-- Default "user" for backward compatibility with existing records.
ALTER TABLE channel_contacts ADD COLUMN IF NOT EXISTS contact_type VARCHAR(20) NOT NULL DEFAULT 'user';