Skip to content

Conversation

@tothi
Copy link

@tothi tothi commented Oct 28, 2025

No description provided.

@rofl0r
Copy link
Contributor

rofl0r commented Oct 29, 2025

what's this supposed to resolve ? your solution uses a VLA, which is 1) a C99 feature and 2) potentially unsafe. iirc the spec mentions a max size of 255 for both username and password.

@tothi
Copy link
Author

tothi commented Oct 29, 2025

Regardless of specs I have an upstream proxy using longer user/pass than 255. So actually I need it. Ok, I understand it is not the best solution, but somehow I needed to fix it. Do you have any ideas how to make it safe and compliant?

@rofl0r
Copy link
Contributor

rofl0r commented Oct 29, 2025

is the combo of user/pass longer than 255 or a single one of them ?
i guess the best course of action is to first dig up the relevant RFC for basic auth and then make an informed decision.

@tothi
Copy link
Author

tothi commented Oct 29, 2025

actually it is a very long username, it is token rather than a "username". quickly looked at rfcs, have not found any length limitation yet. but actual implementations like Apache also has 255 hardcoded: https://httpd.apache.org/docs/2.4/programs/htpasswd.html#restrictions

@tothi
Copy link
Author

tothi commented Oct 29, 2025

btw, until this is only mine problem I wouldn't think it is necessary to add it to the prod branch. otherwise, if we don't want to introduce VLA, a basic workaround could be using a compile time option for the length 255 (and leave 255 as default). but I am also happy with my fork if I want to use tinyproxy in this very special situation. so don't feel a pressure, if you want, you can close this PR, I won't be sad. :)

@rofl0r
Copy link
Contributor

rofl0r commented Oct 30, 2025

the RFC does indeed not mention any limits, though it is certainly reasonable to have some. since socks5 restricts each of username/pass to 255 chars, we could eventually allow the same for http auth, meaning a total of 510 chars for both.

@tothi
Copy link
Author

tothi commented Oct 30, 2025

thanks, unfortuntaly it does not help for my current use case. "username" is ~1k chars long.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants