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

Unchecked unwrap resulting in a panic in JWT handling #3019

Closed
reubenmiller opened this issue Jul 29, 2024 · 2 comments
Closed

Unchecked unwrap resulting in a panic in JWT handling #3019

reubenmiller opened this issue Jul 29, 2024 · 2 comments
Assignees
Labels
bug Something isn't working theme:c8y Theme: Cumulocity related topics
Milestone

Comments

@reubenmiller
Copy link
Contributor

Describe the bug

The following log entry shows a panic when unwrapping the JWT token response.

Jul 25 09:41:54 rackfslot2 tedge-mapper[1591753]: thread 'tokio-runtime-worker' panicked at crates/extensions/c8y_auth_proxy/src/tokens.rs:44:72:
Jul 25 09:41:54 rackfslot2 tedge-mapper[1591753]: called `Result::unwrap()` on an `Err` value: NoJwtReceived

Whilst the above panic does not seem to affect the normal operation of the tedge-mapper, however it should be handled to reduce the noise in the logic, as generally a "panic" is viewed as something to fix.

To Reproduce

It is unclear exactly caused the JWT to fail (possibly something to do with the built-in as posted via #2960).

Expected behavior

Panics should be avoided in normal operation and for transient errors (such as a JWT token failing to be returned).

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] Raspberry Pi 4 Model B Rev 1.5
System-Architecture Linux rackfslot2 6.6.20+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.20-1+rpt1 (2024-03-07) aarch64 GNU/Linux
thin-edge.io version tedge 1.1.2~201+g5886e5d

Additional context

@reubenmiller reubenmiller added bug Something isn't working theme:c8y Theme: Cumulocity related topics labels Jul 29, 2024
@Ruadhri17 Ruadhri17 self-assigned this Sep 4, 2024
@Ruadhri17 Ruadhri17 removed their assignment Sep 11, 2024
@Ruadhri17
Copy link
Contributor

Resolved by #3119

Panic was replaced by error message informing that jwt token could not be retrieved.

@gligorisaev gligorisaev self-assigned this Sep 12, 2024
@gligorisaev
Copy link
Contributor

it is extremly hard for me to reproduce this bug, so I trust that it was resolved

@reubenmiller reubenmiller added this to the 1.3.0 milestone Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working theme:c8y Theme: Cumulocity related topics
Projects
None yet
Development

No branches or pull requests

3 participants