chore: improve jwt at-rest token encryption#1755
Open
paustint wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR upgrades the shared at-rest token encryption primitive from legacy unauthenticated AES-256-CBC to authenticated AES-256-GCM, while preserving backward compatibility by auto-detecting and decrypting previously-stored CBC ciphertext. It also updates API service documentation/comments to reflect the new versioned ciphertext format and adds unit tests to lock in the compatibility and tamper-detection behavior.
Changes:
- Switch
encryptStringto write AES-256-GCM with agcm!-prefixed, colon-safe payload format and keepdecryptStringbackward-compatible with legacy CBC blobs. - Add unit tests covering: GCM-by-default output, round-trips, legacy CBC decryption compatibility, and tamper detection.
- Update service-level comments/docs in Salesforce org encryption and JWT token encryption to reflect the new authenticated encryption behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| libs/shared/node-utils/src/lib/shared-node-utils.ts | Implements versioned encryption: write GCM (gcm!…) and read both GCM + legacy CBC. |
| libs/shared/node-utils/src/lib/tests/shared-node-utils.encryption.spec.ts | Adds tests for GCM output, compatibility with legacy CBC, and tamper detection. |
| apps/api/src/app/services/salesforce-org-encryption.service.ts | Updates inline documentation to reflect authenticated GCM writes and legacy read-only debt. |
| apps/api/src/app/services/jwt-token-encryption.service.ts | Updates documentation to reflect versioned encrypt/decrypt primitives and GCM-by-default behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3b1a826 to
06aa30a
Compare
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.
No description provided.