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

ActionDispatch::RequestId#make_request_id strips characters used by common request ID modules #31644

Closed
bradland opened this issue Jan 5, 2018 · 1 comment

Comments

@bradland
Copy link

bradland commented Jan 5, 2018

While using Apache + Passenger, we pass a request ID to our app using mod_request_id. This library uses the @ symbol as part of its alphabet, as documented in this paragraph:

The UNIQUE_ID environment variable is constructed by encoding the 144-bit (32-bit IP address, 32 bit pid, 32 bit time stamp, 16 bit counter, 32 bit thread index) quadruple using the alphabet [A-Za-z0-9@-] in a manner similar to MIME base64 encoding, producing 24 characters. The MIME base64 alphabet is actually [A-Za-z0-9+/] however + and / need to be specially encoded in URLs, which makes them less desirable.

The make_request_id method removes the @ symbol from any request ID passed through X-Request-Id.

request_id.gsub(/[^\w\-]/, "".freeze).first(255)

Any chance make_request_id could be loosened up a bit to accommodate request IDs generated by this common library?

composerinteralia added a commit to composerinteralia/rails that referenced this issue Jan 30, 2018
It makes sense to be as strict as possible
with headers from the outside world,
but allowing @ to support Apache's mod_unique_id
(see rails#31644) seems OK to me
@y-yagi
Copy link
Member

y-yagi commented Feb 16, 2018

Fixed by #31815

@y-yagi y-yagi closed this as completed Feb 16, 2018
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

No branches or pull requests

2 participants