akka / akka-http

The Streaming-first HTTP server/module of Akka
https://doc.akka.io/docs/akka-http
Other
1.34k stars 594 forks source link

failed: JwtDirectivesSpec #4382

Closed patriknw closed 2 months ago

patriknw commented 2 months ago

https://github.com/akka/akka-http/actions/runs/8731366009/job/23956632051

[info] - should validate JWTs using asymmetric keys *** FAILED *** (5 milliseconds)
[info]   java.lang.IllegalArgumentException: Error PEM decoding JWT public key from key id [asymmetric-key]: Could not find a private key, a certificate or the given string is not PEM encoded data.
[info]   at akka.http.jwt.internal.JwtKeyLoader$.throwIAE(JwtKeyLoader.scala:79)
[info]   at akka.http.jwt.internal.JwtKeyLoader$.loadPem(JwtKeyLoader.scala:75)
[info]   at akka.http.jwt.internal.JwtKeyLoader$.loadKey(JwtKeyLoader.scala:49)
[info]   at akka.http.jwt.internal.JwtSupport$.$anonfun$fromConfig$1(JwtSettingsImpl.scala:86)
[info]   at scala.collection.StrictOptimizedIterableOps.map(StrictOptimizedIterableOps.scala:100)
[info]   at scala.collection.StrictOptimizedIterableOps.map$(StrictOptimizedIterableOps.scala:87)
[info]   at scala.collection.convert.JavaCollectionWrappers$JCollectionWrapper.map(JavaCollectionWrappers.scala:98)
[info]   at akka.http.jwt.internal.JwtSupport$.fromConfig(JwtSettingsImpl.scala:79)
[info]   at akka.http.jwt.internal.JwtSettingsImpl$.fromSubConfig(JwtSettingsImpl.scala:40)
[info]   at akka.http.jwt.internal.JwtSettingsImpl$.fromSubConfig(JwtSettingsImpl.scala:35)
[info]   at akka.http.impl.util.SettingsCompanionImpl.apply(SettingsCompanionImpl.scala:51)
[info]   at akka.http.jwt.scaladsl.JwtSettings$.apply(JwtSettings.scala:29)
[info]   at akka.http.jwt.scaladsl.server.directives.JwtDirectivesSpec.$anonfun$new$63(JwtDirectivesSpec.scala:278)

@efgpinto can you look into this

efgpinto commented 2 months ago

Interesting.. So it passes for all versions against default but not for snapshot or main.

I went back and I think this is related to this change.

Now, I'm not sure if we need to adjust the code on akka-http or on akka-pki because I did not fully understand the intent from the upstream change.. @johanandren maybe you can have some input here?

johanandren commented 2 months ago

It's there to handle more types of pem files, so if it fails it is a regression on the Akka side, I'll take a look next week.

johanandren commented 2 months ago

Fix in https://github.com/akka/akka/pull/32399

efgpinto commented 2 months ago

Just confirmed the above PR fixed the nightly build. Closing.