Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Panda v7 - support key rotation #247

Merged
merged 1 commit into from
Nov 12, 2024

Conversation

rtyley
Copy link
Member

@rtyley rtyley commented Nov 8, 2024

This upgrades Panda from v3 to v7, increasing security by allowing us to use key-rotation as introduced with guardian/pan-domain-authentication#150.

I'm very happy to do a walkthrough of the changes with the reviewer if that helps!

Changes to Panda that affected code in this project

This upgrades Panda from v3 to v7, allowing us to use key rotation as introduced with guardian/pan-domain-authentication#150.

### Necessary code changes

* Panda v5
  * guardian/pan-domain-authentication#147 removed the old `PublicKey` & `PrivateKey` classes in our `com.gu.pandomainauth` package, in favour of using the existing `java.security` classes. To create instances of those classes, we can use the `SettingsReader.{privateKeyFor, publicKeyFor}` methods.
* Panda v6:
  * guardian/pan-domain-authentication#152 means the `CookieUtils.generateCookieData()` method now communicates errors with `CookieResult` values containing `CookieIntegrityFailure`, rather than exceptions.
* Panda v7:
  * guardian/pan-domain-authentication#150 means that code shouldn't directly reference private or public keys anymore (eg do not reference `settings.signingKeyPair`). Instead, use `settings.signingAndVerification` or `publicSettings.verification`. Note also that `publicSettings.publicKey` was previously optional, and `publicSettings.verification` is not.
@rtyley rtyley force-pushed the upgrade-to-panda-v7-support-key-rotation branch from e08ec78 to 58ca049 Compare November 8, 2024 20:23
@rtyley rtyley marked this pull request as ready for review November 12, 2024 10:22
@rtyley rtyley requested a review from a team as a code owner November 12, 2024 10:22
@philmcmahon
Copy link
Contributor

Wow thank you Roberto! I'm just deploying this to our test environment now...

@rtyley
Copy link
Member Author

rtyley commented Nov 12, 2024

Wow thank you Roberto! I'm just deploying this to our test environment now...

Ah brilliant! Let me know how it goes...

Copy link
Contributor

@philmcmahon philmcmahon left a comment

Choose a reason for hiding this comment

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

This is working fine on our playground environment, let's go!

Thanks again @rtyley

panda gif

@philmcmahon philmcmahon merged commit a5c5754 into main Nov 12, 2024
4 checks passed
@philmcmahon philmcmahon deleted the upgrade-to-panda-v7-support-key-rotation branch November 12, 2024 14:23
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.

2 participants