mike-engel / jwt-cli

A super fast CLI tool to decode and encode JWTs built in Rust
MIT License
1.02k stars 65 forks source link

App crash on `jwt encode` command with `@` in secret #335

Open dhra opened 6 days ago

dhra commented 6 days ago

Summary

The jwt encode command crashes when using a secret containing special characters. The crash occurs due to the inability to read the file specified by the --secret parameter.

Steps to reproduce

Run the following command


jwt encode --secret=@@@vovocha '{"hello":"world"}'

Actual result

thread 'main' panicked at src/utils.rs:42:44:
Unable to read file @@vovocha
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Expected behavior

Users should be able to create a valid JWT with secrets that start with the '@' symbol.

More details:

jwt --version
jwt 6.1.0

OS: Ubuntu