Add auth to adapters endpoint and encrypt endpoint configs (#251)#261
Open
Add auth to adapters endpoint and encrypt endpoint configs (#251)#261
Conversation
- Add v2Auth middleware to GET /api/v2/adapters (was unauthenticated) - Encrypt endpoint configs at rest using the same encrypt/decrypt pattern already used for user_auths credentials - Decrypt on read in getEndpoint, getEndpoints, updateEndpoint, setEndpointDefault Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
jessie-coco
approved these changes
Mar 9, 2026
Contributor
jessie-coco
left a comment
There was a problem hiding this comment.
Codex Review R1: CLEAN — 0 P1 + 0 P2 + 0 P3
Scope: server/db.js (+26/-8), server/index.js (+1/-1)
What was checked
| Dimension | Result |
|---|---|
| Correctness | ✅ Encryption/decryption pattern mirrors existing user_auths implementation exactly. All CRUD paths covered: createEndpoint encrypts, getEndpoint/getEndpoints decrypt, updateEndpoint encrypts on write + decrypts on return, setEndpointDefault decrypts on return. |
| Security | ✅ GET /api/v2/adapters now gated behind apiReadLimiter + v2Auth. Endpoint configs (GitHub tokens, webhook secrets, Telegram bot tokens) encrypted at rest with AES-256-GCM. |
| Types & contracts | ✅ config field handling consistent with existing credentials pattern. encrypt() gracefully degrades (returns plaintext) if key not configured. |
| Edge cases | ✅ decryptEndpointRow(null) → null. isEncrypted() guard handles legacy plaintext rows. updates.config truthiness check matches updateUserAuth pattern. |
| Integration | ✅ No callers broken. Adapters endpoint reads registry status, not endpoint configs. |
| Dead code | ✅ None. |
Summary
Clean, minimal PR. Both bugs (unauthenticated adapters endpoint + plaintext endpoint configs) are fixed correctly using patterns already established in the codebase. Backward compatibility with existing plaintext rows is preserved via isEncrypted() guard.
LGTM — approve.
Contributor
|
@boot-coco Codex review R1: CLEAN — approved. No issues found. See full review above. |
jessie-coco
pushed a commit
that referenced
this pull request
Mar 9, 2026
After token inheritance was removed in #261 for security, github_auto and system_default routing lost access to GitHub tokens. This adds a fallback that looks up the user's own GitHub auth credential when no token is present on the target config. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
apiReadLimiter+v2Authmiddleware toGET /api/v2/adapters, which was previously unauthenticated and exposed adapter channel status to anyone.encrypt()/decrypt()toendpoints.configcolumn using the same pattern already in place foruser_auths.credentials. Endpoint configs (GitHub tokens, webhook secrets, Telegram bot tokens) are now encrypted at rest.getEndpoint,getEndpoints,updateEndpoint,setEndpointDefault) to decrypt on retrieval, withisEncrypted()guard for backward compatibility with existing plaintext rows.Closes #251
Test plan
GET /api/v2/adaptersreturns 401 without auth tokenGET /api/v2/adaptersworks with valid v2 auth🤖 Generated with Claude Code