Skip to content
This repository was archived by the owner on Feb 8, 2018. It is now read-only.

Fix early error handling #4205

Closed
wants to merge 1 commit into from
Closed

Conversation

@chadwhitacre
Copy link
Contributor Author

chadwhitacre commented Nov 24, 2016

In all three of those cases, in the context of the delegate_error_to_simplate frame, request is the empty string(!). (BTW, this is displayed better under the new client, as '' instead of ; #4200.) This surprised me. There is a test at the top of that function for request is None, but how can request be the empty string?

Well, it turns out that we do initialize Request thus, so that some sort of other error could—and seemingly does—result in request as the empty string inside delegate_error_to_simplate.

I think the fix here in Gratipay is probably a function immediately before delegate_error_to_simplate that converts '' to None, with a reticket in Aspen (Pando). However, we should write a test first. Towards that: (1) and (3) are both CRLF injections, and (2) is a bad redirect location, as indicated by the err key in the /app/error.spt frame context.

@chadwhitacre
Copy link
Contributor Author

And I still don't quite understand how request is ending up the empty string. If Request.from_wsgi were to raise, I'd expect request to go missing from the context.

@chadwhitacre
Copy link
Contributor Author

tfw google for curl crlf injection and find gratipay/security-qf35us#1 😁

@chadwhitacre
Copy link
Contributor Author

I'm trying:

curl -I http://localhost:8537/%0dSet-Cookie:Xsrf_token=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;

@chadwhitacre
Copy link
Contributor Author

I am triggering the CRLF protection, but I'm not seeing the empty string request behavior.

@chadwhitacre
Copy link
Contributor Author

Skunked. :-/

@chadwhitacre chadwhitacre force-pushed the fix-early-error-handling branch from b32bc05 to 06251d3 Compare May 17, 2017 10:42
@chadwhitacre
Copy link
Contributor Author

Rebased, was b32bc05.

@chadwhitacre
Copy link
Contributor Author

Only the last of the original four errors is still available in Sentry:

https://sentry.io/gratipay/gratipay-com/issues/199760784/

@chadwhitacre
Copy link
Contributor Author

I give up. 😞

@chadwhitacre chadwhitacre deleted the fix-early-error-handling branch May 17, 2017 11:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant