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

Sid and Kid swapped when importing jwt from CLI #3343

Closed
4 of 6 tasks
sktan18 opened this issue Nov 8, 2022 · 0 comments · Fixed by #3344
Closed
4 of 6 tasks

Sid and Kid swapped when importing jwt from CLI #3343

sktan18 opened this issue Nov 8, 2022 · 0 comments · Fixed by #3344
Assignees
Labels
bug Something is not working.

Comments

@sktan18
Copy link

sktan18 commented Nov 8, 2022

Preflight checklist

Describe the bug

I was trying to overwrite "hydra.jwt.access-token" by importing a set of jwt from command line. The sid and kid were swapped when stored in the database. Looking at the source code, the caller of the JwkApi.SetJsonWebKey is passing in the arguments in the wrong order.
Function: func (a *JwkApiService) SetJsonWebKey(ctx context.Context, set string, kid string)

Caller: m.JwkApi.SetJsonWebKey(cmd.Context(), k.Kid, set).JsonWebKey(k).Execute()

Reproducing the bug

  1. Run hydra docker
  2. Import jwt to overwrite sid "hydra.jwt.access-token"
    hydra import jwk "hydra.jwt.access-token" --skip-tls-verify --use sig /etc/ssl/certs/ecdsakey.json /etc/ssl/certs/ecdsapub.json --alg ES384 -e $HYDRA_ADMIN_URL

"hydra.jwt.access-token" will be safe as the kid. Sid will be auto-generated.

Relevant log output

No response

Relevant configuration

No response

Version

v2.0.1

On which operating system are you observing this issue?

Windows

In which environment are you deploying?

Docker Compose

Additional Context

Possible workaround (not ideal), set the kid as "hydra.jwt.access-token" so that the arguments are swapped back...

@sktan18 sktan18 added the bug Something is not working. label Nov 8, 2022
@aeneasr aeneasr self-assigned this Nov 8, 2022
aeneasr added a commit that referenced this issue Nov 8, 2022
aeneasr added a commit that referenced this issue Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants