-
Notifications
You must be signed in to change notification settings - Fork 51
Bug: tracker keys can contain any char not only alphanumeric chars #976
Copy link
Copy link
Closed
Description
Parent issue: #773
We generate random 32-char keys like this: YZSl4lMZupRuOpSRC3krIKR5BPB14nrJ, with only alphanumeric chars.
This is the statement we use to generate the keys:
let random_id: String = thread_rng()
.sample_iter(&Alphanumeric)
.take(AUTH_KEY_LENGTH)
.map(char::from)
.collect();And this is the Key struct.
/// A randomly generated token used for authentication.
///
/// It contains lower and uppercase letters and numbers.
/// It's a 32-char string.
#[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone, Display, Hash)]
pub struct Key(String);After merging this PR, it will be possible to upload preexisting keys. The uploaded keys should have the same restrictions:
- 32 chars
- Only alphanumeric chars: a-z, A-Z and 0-9.
However, the Key struct does not enforce these restrictions. It only checks that the string length is 32. That will allow uploading keys like this: %QEs2ZNcCm9cwEV9dBpcPB5OwNFWFiRd, which is not a valid key.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
BugIncorrect BehaviorIncorrect Behavior