gate icon indicating copy to clipboard operation
gate copied to clipboard

feat(gate-web): Add delete session tokens from redis endpoint

Open juangod-1 opened this issue 1 year ago • 2 comments

When Spring Boot is upgraded and old tokens no longer work, users get 500's until they delete the cookies from their browser, which causes bad user experience.

A way around this is to delete the spring:session* keys from Redis, as explained here:

https://spinnaker.io/changelogs/1.34.0-changelog/#spring-boot-2615

$ redis-cli keys "spring:session*" | xargs redis-cli del

In our case, we don't have CLI access to our Redis instance in Production. Because of this, we wrote a Gate endpoint that deletes the keys from Redis, so it can be triggered in Production with a curl call:

curl -H "Cookie: SESSION=...." -i -X POST https://spinnaker-host/api/v1/auth/deleteSessionCache

I'm sure many other users of Spinnaker have the same issue and could benefit from this.

juangod-1 avatar Sep 06 '24 10:09 juangod-1

We prefer that non-test backend code be written in Java or Kotlin, rather than Groovy. The following files have been added and written in Groovy:

  • gate-web/src/main/groovy/com/netflix/spinnaker/gate/services/SessionService.groovy

See our server-side conventions here.

spinnakerbot avatar Sep 06 '24 12:09 spinnakerbot

The following commits need their title changed:

  • 639c99de3814df134322ac0e84396142dc8ad515: Add delete session tokens from redis endpoint

Please format your commit title into the form:

<type>(<scope>): <subject>, e.g. fix(kubernetes): address NPE in status check

This allows us to easily generate changelogs & determine semantic version numbers when cutting releases. You can read more about commit conventions here.

spinnakerbot avatar Sep 06 '24 12:09 spinnakerbot

@juangod-wise can you run $ ./gradlew spotlessApply please?

dbyron-sf avatar Nov 14 '24 22:11 dbyron-sf

@juangod-wise can you run $ ./gradlew spotlessApply please?

Done! :)

juangod-1 avatar Nov 15 '24 08:11 juangod-1