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

obsolete validation regexp on auth tokens #13

Closed
premier-boats opened this issue Jul 18, 2019 · 3 comments
Closed

obsolete validation regexp on auth tokens #13

premier-boats opened this issue Jul 18, 2019 · 3 comments
Labels
bug This is a verified bug

Comments

@premier-boats
Copy link

When setting up a new flow on a new device, deploying the flow warns that "The workspace contains some nodes that are not properly configured:"

In the blynk-ws-client settings node, the auth token is highlighted in red.
Annotation 2019-07-18 101934

If I ignore the warning on deploying the flow, the flow works as expected and the Blynk nodes connect successfully.

Current auth tokens include any alphanumeric character as well as some symbols (possibly the Base64 encoding alphabet?). The validation regexp only allows 32 a-fA-F0-9 characters.

I can't find specifics from Blynk on the auth token format. For validation it might be sufficient to require the field to be non-empty to avoid problems with future format changes.

@gablau gablau added the bug This is a verified bug label Jul 18, 2019
@gablau
Copy link
Owner

gablau commented Jul 18, 2019

Hi and thanks for reporting,
it's true, the way to generate tokens changed on June 17th, now it's a base64 see here.
So let's say I can change the regexp with this: ^[a-zA-Z0-9]{32}$

Soon update the library with a new version.

Best regard

@premier-boats
Copy link
Author

"-_=" are all legal characters for URL-encoded base64, as used here:
https://github.com/blynkkk/blynk-server/blob/master/server/utils/src/main/java/cc/blynk/utils/TokenGeneratorUtil.java

The "=" (padding) character should never appear as the server is encoding exactly 24 bytes, which fits perfectly into 32 base64 digits.

See the base64 URL-safe table, here, for legal characters: https://tools.ietf.org/html/rfc4648#page-7

@gablau
Copy link
Owner

gablau commented Jul 26, 2019

fix in release 1.0.0

@gablau gablau closed this as completed Jul 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This is a verified bug
Projects
None yet
Development

No branches or pull requests

2 participants