-
Notifications
You must be signed in to change notification settings - Fork 34
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
🔊 Store token validation errors in the database and display them in the admin dashboard #1102
Comments
FYI, here's the script that I used to identify opcodes with two underscores for ca-ebike
|
As I think about this further, I don't think that the |
Ah actually it looks like having a
So the invalid opcode filter is actually
|
I have previously observed the difference in the charset between phone-generated and script-generated opcodes We should unify the script to behave the same, and potentially relocate both versions to e-mission-common |
We perform opcode generation in e-mission-phone for autogen programs and via a script in e-mission-server (ideally on the admin dash eventually) for pregenerated opcodes. It requires a random string to be generated as a unique identifier. The charset was different between the server and phone implementations, causing potential for issues with pregenerated opcodes e-mission/e-mission-docs#1102 Autogen on the phone used alphanumeric characters. Pregenerated opcodes used "urlsafe" characters https://github.com/e-mission/e-mission-server/blob/33eda70849e4cf800b83d0fb3f609ed9c68e0f35/bin/auth/generate_random_tokens.py#L5 The only differences between "urlsafe characters" and "alphanumeric characters" are hypen, dot, underscore, and tilde (https://stackoverflow.com/a/695469/5110347) The new unified function generates a string of specified length. By default it uses alphanumeric characters but a different charset can be optionally passed in. Includes unit test to guarantee expected behavior. Tests pass in both languages
Created JGreenlee/e-mission-common#14 Need to make PRs in e-mission-phone, e-mission-server, and op-admin-dashboard to use this instead of their own random string generation functions Will add better UI error messages when I do the e-mission-phone PR |
For pre-generated tokens, one of the biggest issues is when the tokens don't work.
This can be either because the token is malformed on the phone, or when the token is properly formatted, but is not found among the valid tokens on the server.
To make it easier for admins to debug these issues themselves, I propose the following:
stats/client_error
messages, possibly with name =malformed_opcode
oropcode_not_found
opcode_not_found
opcodes to valid opcodes and suggest some potential matches, so admins can easily help participants troubleshoot what is going onWhile handling this we should also double check the client code to make sure that each malformed case is recorded properly - e.g. distinguish between the cases in
if (tokenParts.length < 3 || tokenParts.some((part) => part == '')) {
@JGreenlee for visibility
The text was updated successfully, but these errors were encountered: