feat: per-identity credential management with groups and RBAC#28
Conversation
Adds a credential mapping system so different users/agents get their own API keys when calling backend MCP services. Resolution chain: user-specific → group → defaults → services.json fallback. - credentials.json schema with Zod validation (groups, per-identity, defaults) - CredentialManager with CRUD, async write mutex, disk persistence (0600 perms) - Per-user connection pooling (service::userId keys) with baseServiceNames - Credential merge into service configs at /call, /list-tools, /schema time - Pool invalidation on credential changes via closeServicePattern() - 12 daemon API routes extracted to src/daemon/routes/credentials.ts - CLI: credentials set/remove/resolve/group/reload subcommands - RBAC: credentials-read (agent+), credentials-write (admin only) - Security: redacted GET responses, IDOR protection on resolve, header/env injection prevention, malformed JSON handling - 61 new tests across 4 test files Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
I'll analyze this and get back to you. |
🔍 Review Swarm Report — Round 15 reviewers: Correctness, Adversarial Critic, Quality Analyst, Security Auditor, Backend Specialist CRITICAL (1)
HIGH (4)
MEDIUM (9)
LOW / INFO (not blocking)
Validation
Security Checklist
Fixer agent dispatched for all CRITICAL/HIGH/MEDIUM findings. Re-review pending. 🤖 Generated by review-swarm (5 parallel CC agents) |
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
The king-ng label is for King Capital repos. This is a rodaddy repo. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
✅ Review Swarm — Round 2: All Findings FixedRe-reviewer verified all 14 CRITICAL/HIGH/MEDIUM findings from Round 1 are resolved. 946 tests pass, typecheck clean, no regressions. Fixes Applied
Files Changed (fixer + cleanup)Validation
🤖 Generated by review-swarm (Round 2 re-review) |
Neither has infra set up yet. Deploy job referenced a self-hosted runner and SSH deploy target that don't exist. Claude review workflow referenced a LiteLLM proxy that isn't reachable from the runner. Clean these out so CI only runs what actually works (typecheck + tests + build). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Review swarm follow-upI ran a 3-round review swarm on PR #28 with five lanes each round:
Pinned diffs used during the swarm:
Findings fixed
Tests and verification
Pushed fix commit: |
Accidentally removed in PR #28 cleanup. The deploy job was functional — CT 216 runs the compiled binary deployed by this job. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

Summary
What's New
Core:
credentials.jsonschema with groups, per-identity credentials, and defaultsCredentialManagerclass with async write mutex, Zod validation, disk persistence (0600 perms)service::userIdkeys) withbaseServiceNamesfor health/metrics/call,/list-tools,/schematimecloseServicePattern()API (12 routes, extracted to
src/daemon/routes/credentials.ts):GET/POST/DELETE /api/credentials— list (redacted), set, removeGET /api/credentials/resolve— resolve effective credential (IDOR-protected)POST/DELETE /api/credentials/defaults— set/remove defaultsGET/POST /api/credentials/groups— list/create groupsPUT/DELETE /api/credentials/groups/:name— add/remove members or delete groupPOST /api/credentials/reload— reload from diskCLI:
mcp2cli credentials list|set|set-default|remove|remove-default|resolve|group|reloadRBAC:
credentials-read(agent+): list, resolve own credentialscredentials-write(admin only): set, remove, group managementSecurity (from swarm review):
***)Test plan
bunx tsc --noEmit)mcp2cli credentials set rico open-brain --header "Authorization: Bearer xxx"mcp2cli credentials resolve rico open-brain🤖 Generated with Claude Code