Skip to content

Fixed connection leak in basic and digest authenticators if 401 response has content#3859

Closed
agherardi wants to merge 9 commits into
eclipse-ee4j:masterfrom
agherardi:basicAuthLeak
Closed

Fixed connection leak in basic and digest authenticators if 401 response has content#3859
agherardi wants to merge 9 commits into
eclipse-ee4j:masterfrom
agherardi:basicAuthLeak

Conversation

@agherardi

Copy link
Copy Markdown
Contributor

return bytesToHex(bytes);
}

private static void discardInputAndClose(InputStream is) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to consume the stream before it is closed?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually yes.. because otherwise this leads to leak or deadlock...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consuming the stream makes it possible for the connection to be reused (unless the server closes the connection, of course).

}
return false;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This discardInputAndClose is once again in HttpAuthenticationFilter in PR3860. Can you put it to the AuthenticationUtil as discussed in PR 3862?

@agherardi
agherardi force-pushed the basicAuthLeak branch 2 times, most recently from 68962a1 to 7cbc9bb Compare June 20, 2018 15:09
…nse has content

Signed-off-by: agherardi <alessandro.gherardi@yahoo.com>
Signed-off-by: agherardi <alessandro.gherardi@yahoo.com>
Signed-off-by: agherardi <alessandro.gherardi@yahoo.com>
@agherardi

Copy link
Copy Markdown
Contributor Author

Hi - Any updates?

@jansupol

jansupol commented Jul 4, 2018

Copy link
Copy Markdown
Contributor

There is class AuthenticationUtil #discardInputAndClose already from the previous PR. Can you please rebase and resolve conflicts?

@agherardi

Copy link
Copy Markdown
Contributor Author

Conflict resolved. There is a test error. Looking into it.

@agherardi

agherardi commented Jul 4, 2018

Copy link
Copy Markdown
Contributor Author

The test issue is caused by a missing "@get" in front of this https://github.com/eclipse-ee4j/jersey/blob/master/connectors/apache-connector/src/test/java/org/glassfish/jersey/apache/connector/AuthTest.java#L157 test method, due to a merge conflict with https://github.com/eclipse-ee4j/jersey/pull/3858/files.

I re-added the "@get" with this merge request. Otherwise, please feel free to back out #3858, I'll re-submit with the fixed test. Or you can approve #3875 .

@agherardi

Copy link
Copy Markdown
Contributor Author

Thanks. This merge request should be ready to be merged now.

@jansupol
jansupol requested a review from tomas-langer July 9, 2018 13:29
Signed-off-by: agherardi <alessandro.gherardi@yahoo.com>
@agherardi

Copy link
Copy Markdown
Contributor Author

The IP validation check is failing. Apparently, a couple of merge commits don't have either the author or the signed-off line in the commit message.

I'm assuming the changes can still be merged since the "important" commit has both author and signed-off. If that's not the case, please let me know - I'll open a new pull request. Thanks.

@jansupol

jansupol commented Jul 9, 2018

Copy link
Copy Markdown
Contributor

There seems to be some discrepancy in the sign-off/commit users alessandro.gherardi[at]yahoo.com vs alessandro.gherardi[at]schneider-electric.com. Not sure where it took the latter user. Can you please better create a new PR? Thanks

@agherardi

Copy link
Copy Markdown
Contributor Author

Changed re-submitted as #3878 . Closing this request.

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.

4 participants