Repository navigation
fix: rotate database credentials from Vault without restart - #773
Merged
nonsobethel0-dev merged 2 commits intoOct 18, 2026
Merged
nonsobethel0-dev merged 2 commits into
nonsobethel0-dev merged 2 commits into
Conversation
Database credentials were loaded from Vault once at startup and baked into the PrismaClient, so rotating them in Vault left the app on stale (and eventually revoked) credentials until a restart. - PrismaService now wraps a swappable PrismaClient (interface merge + Proxy keep the existing API for all callers) and exposes rotateCredentials(): new clients are connected before being swapped in, a rejected credential keeps the current connection, and replaced clients are drained for DATABASE_ROTATION_DRAIN_MS (default 30s) before disconnecting. - New DatabaseCredentialRotationService polls Vault every VAULT_REFRESH_INTERVAL_MS (default 5m, 0 disables) and applies changes to DATABASE_URL / DATABASE_REPLICA_URL; Vault or connect failures are logged and retried on the next tick. - Split fetchVaultSecrets() out of loadVaultSecrets() for runtime reuse. - Validate the new env vars, document rotation in the README, and add tests covering rotation, failure fallback, draining, and polling. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@wandooadzer-cmyk Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
nonsobethel0-dev
merged commit Oct 18, 2026
18b86c1
into
Parashield-Protocol:main
0 of 3 checks passed
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.
Database credentials were loaded from Vault once at startup and baked into the PrismaClient, so rotating them in Vault left the app on stale (and eventually revoked) credentials until a restart.
About this PR
This PR resolves 4 enhancement issues:
Changes
#375 - API versioning strategy
X-API-Versionresponse headerDeprecationheader for v1 withLinkheader pointing to v2 successorx-api-versionheader for API version negotiation#373 - Pagination on policy and claims list endpoints
pageandlimitquery parameters toGET /api/v1/productsendpointgetActiveProductsservice method to support Prisma-based pagination withtake/skipgetClaimsByWalletQuery,getClaimHistory) already had pagination#372 - Rate limiting on claim submission endpoint
limit: 5/60s) toPOST /api/v1/claimsendpoint@Throttledecorator with stricter limits than global throttler (60/60s)#374 - Webhook support for policy/claim status changes
WebhooksServicewith register/unregister/list and status notification methodsWebhooksControllerwithPOST /api/v1/webhooks/registerandGET /api/v1/webhooksendpointspolicy.status.changeeventclaim.status.changeeventIssue Closure
This PR closes the following issues using GitHub keyword syntax:
Verification
Closes #658
Closes #657
Closes #656
Closes #655
{ success, data, total, page, limit })policy.status.change,claim.status.change)