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

Fix Authorization header format validation to match RFC HTTP header specifications #138

Closed
wants to merge 2 commits into from

Conversation

anomal
Copy link
Contributor

@anomal anomal commented Sep 20, 2021

According to RFC 2616, HTTP header values may have leading and trailing whitespace.

This fix may or may not address the 401 Unauthorized response in signalapp/Signal-iOS#5114 . (I do not own a Mac to be able to run iOS app version 3.9.0 in Xcode Simulator in debug mode, in order to reproduce the issue.) Either way, HTTP clients may implement the Authorization header values according to the RFC spec with leading or trailing whitespace.

Please comment on signalapp/Signal-iOS#5114 if/when this fix is deployed in production. An important Signal contact of mine cannot access years of Signal messages on their old iPhone that can only run iOS 10, which is only supported up to app version 3.9.0. These messages contain important data such as passwords to accounts, photos, and messages to reconstruct a sequence of events that occurred in the past.

@anomal
Copy link
Contributor Author

anomal commented Sep 21, 2021

Note that people often write HTTP headers in the following format:

Authorization: Basic YWxhZGRpbjpvcGVuc2VzYW1l

In other words, there is a space after the colon, which is equivalent to a space before the header value.

RFC 2616 4.2 even mentions that the header value preceded by a single space is preferred:

The field value MAY be preceded by any amount of LWS, though a single SP is preferred.

@ehrenkret-signal
Copy link
Contributor

I believe the HttpParser in the framework library strips these leading or trailing spaces out before ever reaching this point.

Do you have any evidence that the framework is not removing these leading or trailing spaces?

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