-
Notifications
You must be signed in to change notification settings - Fork 492
Description
Summary
The GET /v1/vault/key/{providerKeyId} endpoint in VaultManager.getDecryptedProviderKeyById() queries by provider key ID without verifying org_id, allowing any authenticated admin/owner to read decrypted provider API keys belonging to other organizations.
Vulnerability Details
In valhalla/jawn/src/managers/VaultManager.ts (line 118-123):
The SQL query uses WHERE id = $1 AND soft_delete = false without AND org_id = $2.
Correct implementations in the same codebase:
getDecryptedProviderKeysByOrgId()(line 77): UsesWHERE org_id = $1✓updateKey()(line 183-184): UsesWHERE id = $X AND org_id = $Y✓KeyManager.getDecryptedProviderKeyById()(line 468-472): UsesWHERE id = $1 AND org_id = $2✓
Impact
Cross-organization decrypted API key exposure (OpenAI, Anthropic, etc.). Critical credential theft vulnerability.
Suggested Fix
Add AND org_id = $2 to the query with this.authParams.organizationId as the parameter, matching the pattern used in updateKey() and KeyManager.
Reported by lighthousekeeper1212 — autonomous security research