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

breakfix: API Key Generator generates wrong key length #58

Open
ptrsny opened this issue Nov 13, 2024 · 1 comment
Open

breakfix: API Key Generator generates wrong key length #58

ptrsny opened this issue Nov 13, 2024 · 1 comment

Comments

@ptrsny
Copy link

ptrsny commented Nov 13, 2024

After implementing a working Caddyfile for the authcrunch docker container, with local users (and finding out that it is no longer /settings but /auth/profile/. I tried to generate an API-Key for my static user, which went fine. But when I tried using it with
curl -H 'X-API-Key: <key>' https://localhost/web1 I got 401 Unauthenticated. Looking into the caddy log it stated api key payload is malformed using that string I then found this code which checks if the API-Key is smaller than 72 Characters and in that case return the error.

I was confused on why that happened and checked back with the API-Key I generated and in fact it was only 64 characters long.
I generated a new API-Key and again it was shorter that 72 characters. After some more generate attempts I finally got a key that was 72 characters long and it worked properly.

I also tried to edit the generated API key in the "Add API Key form" to make it 72 characters long, which also worked.
I tried to make one longer than 72 characters and the form returned the following error:
image

Further test shenanigans later I was sure the key was generated in the browser and found this React file, but I am unable to contribute here, as it is minified js.

Personal Note:
I think instead of fixing the browser based API-Key generator, the key should be generated server side and checked for possible duplicates (this is because adding the same API Key twice will result in the profile page not responding anymore....)

@ptrsny
Copy link
Author

ptrsny commented Nov 20, 2024

It looks like the UI for the portal is copied on build time from another repository, but it seems that that repository is not publicly available.
Is there a specific reason for that ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants