-
Notifications
You must be signed in to change notification settings - Fork 186
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
Error parsing base64 (for non-WAFFLE authentication header) #164
Comments
Internal base64 was switched to guava. I'll take a deep look at this tonight. Do you have the entire data stream that was being processed that you can add here? --- Original Message --- From: "Trejkaz (pen name)" notifications@github.com I was trying out Milton which appears to have its own authentication enabled by default (something I will be desperately trying to rip out). So my browser was sending a header which looks like this:
On WAFFLE 1.5, this gives the error:
On WAFFLE 1.7, you get a different error:
Caused by: com.google.common.io.BaseEncoding$DecodingException: Expected padding character but found '"' at index 10 I assume that WAFFLE is making some assumption that the string it receives will be in a particular format and then when it isn't, is just barfing on it when it should be ignoring it and letting a later filter or servlet handle the header. Reply to this email directly or view it on GitHub: |
Yeah, although I don't think it adds much:
|
Can you post the entire stack trace as it is given? I think that is going to help out a lot more. I want to walk all the way back. I have taken your use case and setup a junit test which does produce the same error. In this case, guava did produce a more appropriate message so no bug there. Now as far as waffle just ignoring and moving on that does not seem right to me. If we capture the request, we need to handle it in the filter otherwise it seems like a security defect would occur. So if we don't like the authorization, I think we would want to raise a security error in general. I read up on this type of digest as I'm not familiar with using it. It seems that it might be possible to build out support for it as it is somewhat closely related to ntlm. @dblock Any thoughts on this? |
I think very specifically Digest authorization is not supported by Waffle. It would be helpful to get the entire HTTP conversation because I bet the server is challenging the client with Digest and that's wrong and should be disabled (but it's not coming from Waffle). |
Regarding providing the "entire conversation", there was only one request/response. I omitted the response because it was just the one from WAFFLE throwing an exception back. If the server has challenged me for Digest auth in the past, and it would have been Milton which did that, which I already mentioned right back at the initial report, then that would have been on an earlier request which I obviously can't provide because I don't have a time machine. If you provide me a time machine, though, I'll happily go back in time and tell myself to start Wireshark before evaluating Milton. (Although, frankly, I would rather use that time to tell myself not to waste the day trying to integrate Milton in the first place.) Despite the trigger obviously being Milton, it still seems odd to me that WAFFLE is behaving like this. You say that Digest authentication is "not supported". Should WAFFLE not, then, immediately see that it is Digest authentication (it's a simple check on the prefix of the value) and return some sensible 4xx error? Why is it bothering to parse Base64 which isn't Base64? (And if people are going to talk about security defects as an excuse for not fixing this, surely "not validating shit passed to you" is one of the biggest security defects around...) |
Fair enough, waffle's AuthorizationHeader class should handle this. Open an On Sunday, November 9, 2014, Trejkaz (pen name) notifications@github.com
dB. | Moscow - Geneva - Seattle - New York |
I mean this is already an issue :) |
How might we handle this? 4xx error condition? My thing on this is that we don't support this digest. It is full of base64 and would need parsed differently. By security issue I was referring to ignoring it as that would likely allow it to simply work. I'm not really clear on why waffle is being used in this context. Milton has its own authentication so where is value of using waffle? Plus a full stack trace should show me the full path waffle took as there are multiple ways to get to this. I'd like to make a quick fix and later look at building this out to support this digest. It is closely related to ntlm so in theory should not be too difficult to implement. --- Original Message --- From: "Daniel Doubrovkine (dB.) @dblockdotorg" notifications@github.com I mean this is already an issue :) Reply to this email directly or view it on GitHub: |
It was never my intent to layer two kinds of authentication with each other. Our application already uses WAFFLE at the top-level, filtering authenticate anything in the server, regardless of what it is. I was trying out Milton as one possible option for providing WebDAV and had no idea that it was trying to implement the full stack... :( Stack trace (I wasn't at work when making the last reply so I wasn't able to grab it): This is apparently a slightly different one because the index is different, but oh well. The logs from that day are enormous.
It's a bit of a tower of nested filters... There is a second stack trace where we were calling AuthorizationHeader directly as a utility class, which I can probably patch around on our end by checking the content before constructing it. |
Thanks @trejkaz It will be tomorrow evening before I can get a change to look further at this. |
@hazendaz All I am saying is that Conceptually, |
Sorry for the delay here, got busy with the paying job. The second stack trace provided appears to be from waffle-jna 1.5 but was useful in seeing that the negotiate filter was turned on. I have a quick fix to try around this base encoding and if it fails to throw a runtime exception that states the authentication header is bad. This will not solve the key issue related to how waffle and milton are trying to be used together. It will however do a better job of indicating the core issue which should assist others with debugging authentication issues. I also looked at other locations the base encoding is being performed and do not think a patch is needed elsewhere. This one because of how it is coded is harder to otherwise check before hand easily so just letting the try catch it here should work. I will submit a pull request soon. |
Please see #166 for the try catch only. If that is sufficient to help on this condition, can we close out this issue? |
@trejkaz Snapshot version of waffle-jna 1.7.1 is available here -> https://oss.sonatype.org/content/repositories/snapshots/com/github/dblock/waffle/waffle-jna/1.7.1-SNAPSHOT/ Please give this a try and let me know if it solves the issues you are experiencing. If it does, I expect to have this released tomorrow evening. This fix will only send back a new error condition that better highlights the issue. |
Lets close this. Reopen if the issue persists. |
I was trying out Milton which appears to have its own authentication enabled by default (something I will be desperately trying to rip out). So my browser was sending a header which looks like this:
On WAFFLE 1.5, this gives the error:
On WAFFLE 1.7, you get a different error:
I assume that WAFFLE is making some assumption that the string it receives will be in a particular format and then when it isn't, is just barfing on it when it should be ignoring it and letting a later filter or servlet handle the header.
The text was updated successfully, but these errors were encountered: