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

TokenServiceTests.testInvalidateRefreshTokenThatIsAlreadyInvalidated fails with ClassCastException #85902

Closed
rjernst opened this issue Apr 14, 2022 · 5 comments · Fixed by #85978
Assignees
Labels
:Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team >test-failure Triaged test failures from CI

Comments

@rjernst
Copy link
Member

rjernst commented Apr 14, 2022

CI Link

https://gradle-enterprise.elastic.co/s/72jn3jmotbelc/console-log?task=:x-pack:plugin:security:test

Repro line

./gradlew ':x-pack:plugin:security:test' --tests "org.elasticsearch.xpack.security.authc.TokenServiceTests.testInvalidateRefreshTokenThatIsAlreadyInvalidated" -Dtests.seed=4C8C62EC8BC30D4A -Dtests.locale=sr-Latn -Dtests.timezone=America/Fortaleza -Druntime.java=17

Does it reproduce?

Yes

Applicable branches

master

Failure history

No response

Failure excerpt

org.elasticsearch.xpack.security.authc.TokenServiceTests > testInvalidateRefreshTokenThatIsAlreadyInvalidated FAILED
  java.lang.ClassCastException: class java.util.HashMap cannot be cast to class org.elasticsearch.common.bytes.BytesReference (java.util.HashMap is in module java.base of loader 'bootstrap'; org.elasticsearch.common.bytes.BytesReference is in unnamed module of loader 'app') |  
  | at __randomizedtesting.SeedInfo.seed([4C8C62EC8BC30D4A:CD4EFA933E0F14A5]:0) |  
  | at org.elasticsearch.xpack.core.security.authc.Authentication.maybeRewriteMetadataForApiKeyRoleDescriptors(Authentication.java:706) |  
  | at org.elasticsearch.xpack.core.security.authc.Authentication.maybeRewriteForOlderVersion(Authentication.java:165) |  
  | at org.elasticsearch.xpack.security.authc.TokenService.createOAuth2Tokens(TokenService.java:372) |  
  | at org.elasticsearch.xpack.security.authc.TokenService.createOAuth2Tokens(TokenService.java:319) |  
  | at org.elasticsearch.xpack.security.authc.TokenServiceTests.testInvalidateRefreshTokenThatIsAlreadyInvalidated(TokenServiceTests.java:605)
@rjernst rjernst added >test-failure Triaged test failures from CI needs:triage Requires assignment of a team area label :Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) labels Apr 14, 2022
@elasticmachine elasticmachine added the Team:Security Meta label for security team label Apr 14, 2022
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-security (Team:Security)

@dakrone
Copy link
Member

dakrone commented Apr 14, 2022

dimitris-athanasiou added a commit to dimitris-athanasiou/elasticsearch that referenced this issue Apr 15, 2022
@dimitris-athanasiou
Copy link
Contributor

And another: https://gradle-enterprise.elastic.co/s/naxqf73jl6cp6

Preparing mute.

Also, cc @albertzaharovits as it seems relevant to recent work.

@ywangd
Copy link
Member

ywangd commented Apr 18, 2022

@tvernum Do you mind me taking this? This is caused by my latest refactor (#85590) for randomizing Authentication object for tests. Apparently, there are discrepencies like this one.

@tvernum tvernum assigned ywangd and unassigned tvernum Apr 19, 2022
ywangd added a commit to ywangd/elasticsearch that referenced this issue Apr 19, 2022
The token method creates a new authentication based on the existing one.
It changes only the authentication type. Hence it should use the version
of the existing authentication as well instead of CURRENT.

Resolves: elastic#85902
@ywangd
Copy link
Member

ywangd commented Apr 19, 2022

PR is #85978

ywangd added a commit that referenced this issue Apr 21, 2022
#85978)

The token method creates a new authentication based on the existing one.
It changes only the authentication type. Hence it should use the version
of the existing authentication as well instead of CURRENT.

Resolves: #85902
ywangd added a commit to ywangd/elasticsearch that referenced this issue Apr 21, 2022
elastic#85978)

The token method creates a new authentication based on the existing one.
It changes only the authentication type. Hence it should use the version
of the existing authentication as well instead of CURRENT.

Resolves: elastic#85902
elasticsearchmachine pushed a commit that referenced this issue Apr 21, 2022
#85978) (#86049)

The token method creates a new authentication based on the existing one.
It changes only the authentication type. Hence it should use the version
of the existing authentication as well instead of CURRENT.

Resolves: #85902
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Security/Authentication Logging in, Usernames/passwords, Realms (Native/LDAP/AD/SAML/PKI/etc) Team:Security Meta label for security team >test-failure Triaged test failures from CI
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants