BC-11659 Encrypt oauth-refreshToken before storing in db#6382
Open
dyedwiper wants to merge 15 commits into
Open
BC-11659 Encrypt oauth-refreshToken before storing in db#6382dyedwiper wants to merge 15 commits into
dyedwiper wants to merge 15 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR implements encryption-at-rest for OAuth refresh tokens stored in the server database, by integrating the existing infra encryption service into the OAuth session-token persistence flow.
Changes:
- Encrypt
OauthSessionToken.refreshTokenbefore persisting viaOauthSessionTokenService.save. - Decrypt
refreshTokenwhen loading the latest token viafindLatestByUserId. - Update test factories/domain object to support the new encrypted storage behavior (including a setter on the domain object).
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| apps/server/src/modules/oauth/testing/oauth-session-token-entity.factory.ts | Generates encrypted refresh tokens for entity-based tests. |
| apps/server/src/modules/oauth/service/oauth-session-token.service.ts | Encrypts on save and decrypts on read using DefaultEncryptionService. |
| apps/server/src/modules/oauth/service/oauth-session-token.service.spec.ts | Adds an encryption service mock provider to the unit-test module. |
| apps/server/src/modules/oauth/domain/do/oauth-session-token.ts | Adds a refreshToken setter to allow service-layer mutation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
|
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.



Description
Links to Tickets or other pull requests
BC-11659
Changes
Approval for review
generate-client:serverwas executed in vue frontend and changes were tested and put in a PR with the same branch name.