You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Follow up for ENG-2857 since I missed some places to update.
Code Changes
Steps to Confirm
Pre-Merge Checklist
Issue requirements met
All CI pipelines succeeded
CHANGELOG.md updated
Add a
db-migrationThis indicates that a change includes a database migration
label to the entry if your change includes a DB migration
Add a
high-riskThis issue suggests changes that have a high-probability of breaking existing code
label to the entry if your change includes a high-risk change (i.e. potential for performance impact or unexpected regression) that should be flagged
Updates unreleased work already in Changelog, no new entry necessary
UX feedback:
All UX related changes have been reviewed by a designer
No UX review needed
Followup issues:
Followup issues created
No followup issues
Database migrations:
Ensure that your downrev is up to date with the latest revision on main
Ensure that your downgrade() migration is correct and works
If a downgrade migration is not possible for this change, please call this out in the PR description!
If there are any new client scopes created as part of the pull request, remember to update public-facing documentation that references our scope registry
This PR is a follow-up to ENG-2857, replacing all remaining direct accesses to CONFIG.security.app_encryption_key with get_encryption_key() across JWE token creation and extraction paths. The get_encryption_key() function adds a process-lifetime caching layer and a warning when the key is empty, and is designed to support future key manager integrations (e.g., AWS KMS).
Updated src/fides/api/oauth/utils.py: 5 call sites across _get_webhook_jwe_or_error, _get_request_task_jwe_or_error, validate_download_token, extract_token_and_load_client, and extract_token_and_load_client_async
Updated src/fides/api/v1/endpoints/oauth_endpoints.py: acquire_access_token for JWE creation
Updated src/fides/api/v1/endpoints/user_endpoints.py: logout_oauth_client and user_login
One remaining direct usage of CONFIG.security.app_encryption_key found in src/fides/api/models/registration.py (passed as a static string to StringEncryptedType, evaluated at import time rather than lazily) — this may be a missed update worth addressing
Confidence Score: 4/5
Safe to merge; all changes are mechanical substitutions with no behavioral change in the hot path.
All modified call sites correctly adopt get_encryption_key(), imports are placed at the top of each file, and there are no contract changes. The small score deduction reflects one remaining direct usage of CONFIG.security.app_encryption_key in registration.py that was not addressed, which is a minor inconsistency with the stated goal of the ticket.
src/fides/api/models/registration.py — still passes CONFIG.security.app_encryption_key as a static string to StringEncryptedType, bypassing the callable/lazy-evaluation pattern introduced by this PR.
Important Files Changed
Filename
Overview
src/fides/api/oauth/utils.py
Replaces 5 direct usages of CONFIG.security.app_encryption_key with get_encryption_key() across JWT extract/validate functions; import added at top of file. Changes are mechanical and correct.
src/fides/api/v1/endpoints/oauth_endpoints.py
Updates acquire_access_token to use get_encryption_key() for JWE creation; import added correctly at top.
src/fides/api/v1/endpoints/user_endpoints.py
Updates logout_oauth_client and user_login to use get_encryption_key(); import added correctly at top.
src/fides/service/user/user_service.py
Updates accept_invite to use get_encryption_key() for JWE creation; import added correctly at top.
Comments Outside Diff (1)
src/fides/api/models/registration.py, line 18-25 (link)
Missed app_encryption_key usage
The PR description states this is updating "all places" to use get_encryption_key(), but UserRegistration.user_email in this model still passes CONFIG.security.app_encryption_key as a static string value at class definition time:
This means the key is captured once when the module is first imported, rather than being resolved lazily through get_encryption_key(). While encrypted_type() in encryption_utils.py passes get_encryption_key as a callable (supporting future key managers like AWS KMS), this model bypasses that pattern entirely.
Consider updating this to pass get_encryption_key as a callable, consistent with how encrypted_type() works:
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
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.
Ticket ENG-2857
Description Of Changes
Follow up for ENG-2857 since I missed some places to update.
Code Changes
Steps to Confirm
Pre-Merge Checklist
CHANGELOG.mdupdatedmaindowngrade()migration is correct and works