Skip to content

Prepare keys for environment migration#2090

Merged
MarceloRGonc merged 7 commits intomainfrom
mg/OPS-3849
Mar 11, 2026
Merged

Prepare keys for environment migration#2090
MarceloRGonc merged 7 commits intomainfrom
mg/OPS-3849

Conversation

@MarceloRGonc
Copy link
Contributor

Part of OPS-3849.

Copilot AI review requested due to automatic review settings March 9, 2026 15:59
@linear
Copy link

linear bot commented Mar 9, 2026

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR prepares for an environment migration by adding support for an old Frontegg public key (OLD_FRONTEGG_PUBLIC_KEY) alongside the current one. During migration, JWT tokens signed with either the old or new key will be accepted, ensuring continuity for authenticated users.

Changes:

  • Added OLD_FRONTEGG_PUBLIC_KEY to the AppSystemProp enum for system configuration.
  • Updated both user-info.module.ts and cloud-template.controller.ts to try verifying JWTs against both the new and old public keys (falling back to the old key if the new one fails).
  • Introduced a new verifyUserWithPublicKeys helper function (duplicated in both files) that iterates over an array of keys.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/server/shared/src/lib/system/system-prop.ts Added OLD_FRONTEGG_PUBLIC_KEY enum value
packages/server/api/src/app/user-info/user-info.module.ts Updated auth to try multiple public keys; added verifyUserWithPublicKeys
packages/server/api/src/app/flow-template/cloud-template.controller.ts Updated auth to try multiple public keys; added duplicate verifyUserWithPublicKeys

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.


FRONTEGG_URL = 'FRONTEGG_URL',
FRONTEGG_PUBLIC_KEY = 'FRONTEGG_PUBLIC_KEY',
OLD_FRONTEGG_PUBLIC_KEY = 'OLD_FRONTEGG_PUBLIC_KEY', // TODO: Can be removed after 13/04/2026
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expiration date for these tokens is 1 month. Therefore, we must keep the old tokens valid for at least 1 month.

@sonarqubecloud
Copy link

@MarceloRGonc MarceloRGonc merged commit 016c7e9 into main Mar 11, 2026
25 checks passed
@MarceloRGonc MarceloRGonc deleted the mg/OPS-3849 branch March 11, 2026 08:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants