Skip to content

Conversation

ojarjur
Copy link
Collaborator

@ojarjur ojarjur commented Sep 2, 2017

When the agent sends a request to the proxy server, it includes an
OAuth access token in the 'Authorization' header to identify itself.

Previously, that token was being generated as soon as the agent had
a request to forward to the backend server. However, that token was
only guaranteed to be valid for 10 seconds, and the backend server
could take longer than that to respond.

This allowed a scenario where the OAuth access token would expire
between the time the request to the proxy was generated and the
time when it was actually sent to the proxy server.

This commit fixes that issue by delaying the proxy request round
trip until we know that the request has enough data to be sent
to the proxy server. This amounts to the response from the backend
server either having some of its body written (for a non-empty
backend response), or the response being finished (for an empty
backend response).

When the agent sends a request to the proxy server, it includes an
OAuth access token in the 'Authorization' header to identify itself.

Previously, that token was being generated as soon as the agent had
a request to forward to the backend server. However, that token was
only guaranteed to be valid for 10 seconds, and the backend server
could take longer than that to respond.

This allowed a scenario where the OAuth access token would expire
between the time the request to the proxy was generated and the
time when it was actually sent to the proxy server.

This commit fixes that issue by delaying the proxy request round
trip until we know that the request has enough data to be sent
to the proxy server. This amounts to the response from the backend
server either having some of its body written (for a non-empty
backend response), or the response being finished (for an empty
backend response).
@ojarjur ojarjur requested review from chmeyers and jimmc September 2, 2017 00:14
@ojarjur ojarjur merged commit b35bee6 into master Sep 2, 2017
@ojarjur ojarjur deleted the ojarjur/fix-auth-race branch August 2, 2019 16:40
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.

3 participants