Skip to content

fix: correctly decode jwt keys #2573

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

Merged
merged 1 commit into from
Jun 11, 2025
Merged

fix: correctly decode jwt keys #2573

merged 1 commit into from
Jun 11, 2025

Conversation

klkvr
Copy link
Member

@klkvr klkvr commented Jun 10, 2025

Motivation

This currently breaks fusaka-devnet-1

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@klkvr klkvr self-assigned this Jun 10, 2025
@klkvr klkvr added the bug Something isn't working label Jun 10, 2025
Comment on lines +305 to +306
assert_eq!(secret_0.as_ref().unwrap().clone(), secret_1.unwrap());
assert_eq!(secret_0.unwrap(), secret_2.unwrap());
Copy link
Contributor

Choose a reason for hiding this comment

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

There's a potential issue with the assertion sequence. The first assertion uses secret_0.as_ref().unwrap().clone(), but then the second assertion uses secret_0.unwrap(), which would consume the Result value. This creates a "use after move" situation.

Consider either:

  1. Unwrapping all values first:
let unwrapped_0 = secret_0.unwrap();
let unwrapped_1 = secret_1.unwrap();
let unwrapped_2 = secret_2.unwrap();
assert_eq!(unwrapped_0, unwrapped_1);
assert_eq!(unwrapped_0, unwrapped_2);
  1. Or cloning before unwrapping in the first assertion:
assert_eq!(secret_0.clone().unwrap(), secret_1.unwrap());
assert_eq!(secret_0.unwrap(), secret_2.unwrap());

Either approach would prevent the move issue while maintaining the test's intent.

Suggested change
assert_eq!(secret_0.as_ref().unwrap().clone(), secret_1.unwrap());
assert_eq!(secret_0.unwrap(), secret_2.unwrap());
let unwrapped_0 = secret_0.unwrap();
let unwrapped_1 = secret_1.unwrap();
let unwrapped_2 = secret_2.unwrap();
assert_eq!(unwrapped_0, unwrapped_1);
assert_eq!(unwrapped_0, unwrapped_2);

Spotted by Diamond

Is this helpful? React 👍 or 👎 to let us know.

Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

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

makes sense

@github-project-automation github-project-automation bot moved this to Reviewed in Alloy Jun 11, 2025
@mattsse mattsse merged commit 7c2abb7 into main Jun 11, 2025
28 checks passed
@mattsse mattsse deleted the klkvr/fix-jwt branch June 11, 2025 09:19
@github-project-automation github-project-automation bot moved this from Reviewed to Done in Alloy Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants