Re: Control character in cookie value or attribute

2011-05-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Chuck, On 5/24/2011 5:28 PM, Caldarale, Charles R wrote: >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >> Subject: Re: Control character in cookie value or attribute > >> On 5/24/2011 5:09 PM

Re: Control character in cookie value or attribute

2011-05-24 Thread Dan Checkoway
Hope you don't mind...I opened a ticket for this: https://issues.apache.org/bugzilla/show_bug.cgi?id=51260 Dan On Tue, May 24, 2011 at 5:28 PM, Caldarale, Charles R wrote: >> From: Christopher Schultz [mailto:ch...@christopherschultz.net] >> Subject: Re: Control character i

RE: Control character in cookie value or attribute

2011-05-24 Thread Caldarale, Charles R
> From: Christopher Schultz [mailto:ch...@christopherschultz.net] > Subject: Re: Control character in cookie value or attribute > On 5/24/2011 5:09 PM, Dan Checkoway wrote: > > -} else if (CookieSupport.isHttpToken(value) && > > -!CookieSuppor

Re: Control character in cookie value or attribute

2011-05-24 Thread Dan Checkoway
I wasn't gonna say anything about that, but I did consult my "operator precedence" reference while looking at it... :-) +1 on parens! Dan On Tue, May 24, 2011 at 5:21 PM, Christopher Schultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Dan, > > On 5/24/2011 5:09 PM, Dan Checkow

Re: Control character in cookie value or attribute

2011-05-24 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Dan, On 5/24/2011 5:09 PM, Dan Checkoway wrote: > -} else if (CookieSupport.isHttpToken(value) && > -!CookieSupport.ALLOW_HTTP_SEPARATORS_IN_V0 || > -CookieSupport.isV0Token(value) && > -CookieSu

Re: Control character in cookie value or attribute

2011-05-24 Thread Dan Checkoway
Ah, thanks! I see now that setting ALLOW_HTTP_SEPARATORS_IN_V0=true bypasses that check in a few spots. Probably what Chuck was alluding to in his reply... The one spot it wouldn't bypass is line 292 in ServerCookie.java. You guys could switch the order of the logical checks in there, i.e.: -

Re: Control character in cookie value or attribute

2011-05-24 Thread Mark Thomas
On 24/05/2011 21:25, Dan Checkoway wrote: > This is super low priority, since I assume somebody is passing junk in a > Set-Cookie header, but I'd love to get to the bottom of it (I'm of the "no > request left behind" mindset), and I'm still in the dark about what Tomcat > doesn't like about what it

Re: Control character in cookie value or attribute

2011-05-24 Thread Dan Checkoway
This is super low priority, since I assume somebody is passing junk in a Set-Cookie header, but I'd love to get to the bottom of it (I'm of the "no request left behind" mindset), and I'm still in the dark about what Tomcat doesn't like about what it's being passed. Can you guys shed any light on w

Re: Control character in cookie value or attribute

2011-05-20 Thread Dan Checkoway
Ah, thanks! To be honest I'm not sure which of those properties would work around the "Control character in cookie value or attribute" exception. Maybe org.apache.tomcat.util.http. ServerCookie.FWD_SLASH_IS_SEPARATOR? I can't tell if "Control character" means a literal non-printable character (i

RE: Control character in cookie value or attribute

2011-05-20 Thread Caldarale, Charles R
> From: Dan Checkoway [mailto:dchecko...@gmail.com] > Subject: Control character in cookie value or attribute > I honestly have no idea if it's related to the tomcat version > or some legitimately wacked out Set-Cookie header coming in. Both, actually. Tomcat 7 is bit more picky about what it

Re: Control character in cookie value

2009-12-09 Thread David Fisher
Christopher Schultz wrote: I'm surprised that nobody else has noticed that the control characters in question were already posted by Itay... it's just that nobody bothered to read the error message properly :) And we are quite flabbergasted that you did not peruse the thread carefully, or y

Re: Control character in cookie value

2009-12-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 12/9/2009 1:35 PM, André Warnier wrote: > Chris, > > Christopher Schultz wrote: >> >> I'm surprised that nobody else has noticed that the control characters >> in question were already posted by Itay... it's just that nobody >> bothered to

Re: Control character in cookie value

2009-12-09 Thread André Warnier
Chris, Christopher Schultz wrote: I'm surprised that nobody else has noticed that the control characters in question were already posted by Itay... it's just that nobody bothered to read the error message properly :) And we are quite flabbergasted that you did not peruse the thread carefully

Re: Control character in cookie value

2009-12-09 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 André, On 12/8/2009 6:28 PM, André Warnier wrote: > So now I can go to sleep peacefully, knowing that these parts of the > cookie do not in effect contain control characters. I'm surprised that nobody else has noticed that the control characters in q

Re: Control character in cookie value

2009-12-08 Thread André Warnier
Itay, you seem to ignore selective parts of the answers and tips which you are given, and then rediscover them selectively 3 posts later. itay sahar wrote: Andre, I'm not sure why you worry about the other cookie value. Thank you for your concern, but I don't worry too much. It is not my

Re: Control character in cookie value

2009-12-08 Thread itay sahar
Andre, I'm not sure why you worry about the other cookie value. let me show you an example maybe then you may see something that i'm missing. getCookieMaxAge() is 31536000 cookiePathis /jboss-seam-jpa What can be wrong here ? It works! Are you worry about special character on cookiePath.

Re: Control character in cookie value

2009-12-08 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Itay, On 12/4/2009 7:41 PM, itay sahar wrote: > I'm using seam on tomcat 6.0.20 and encounter problem in my security module. > > Basically, i try to add cookie with base64 encoding of the username which is > email address. > The encoding works and no

Re: Control character in cookie value

2009-12-07 Thread itay sahar
sure! protected void setCookieValueIfEnabled(String value) { FacesContext ctx = FacesContext.getCurrentInstance(); if ( isCookieEnabled() && ctx != null) { HttpServletResponse response = (HttpServletResponse) ctx.getExternalContext().getResponse(); Cookie co

Re: Control character in cookie value

2009-12-07 Thread André Warnier
itay sahar wrote: sure! protected void clearCookieValue() { Cookie cookie = getCookie(); if ( cookie!=null ) { HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); cookie.setValue(null);

Re: Control character in cookie value

2009-12-07 Thread itay sahar
sure! protected void clearCookieValue() { Cookie cookie = getCookie(); if ( cookie!=null ) { HttpServletResponse response = (HttpServletResponse) FacesContext.getCurrentInstance().getExternalContext().getResponse(); cookie.setValue(null); cookie.setP

Re: Control character in cookie value

2009-12-07 Thread Pid Ster
On 7 Dec 2009, at 19:26, itay sahar wrote: > I add log for the following method: > > protected String encodeToken(String username, String value) > { > StringBuilder sb = new StringBuilder(); > sb.append(username); > sb.append(":"); > sb.append(value); > return Base64.en

Re: Control character in cookie value

2009-12-07 Thread itay sahar
I add log for the following method: protected String encodeToken(String username, String value) { StringBuilder sb = new StringBuilder(); sb.append(username); sb.append(":"); sb.append(value); return Base64.encodeBytes(sb.toString().getBytes()); } *Before encodi

Re: Control character in cookie value

2009-12-07 Thread itay sahar
Thanks André, * * *I agree with you about the doubt you have about the ":" being in C (after encoding).* return Base64.encodeBytes(sb.toString().getBytes()); *I guess you suggest to log somthing like * *(new String(C)).getBytes ? If yes I post it here later. I hope you can then suggest somthing to

Re: Control character in cookie value

2009-12-07 Thread André Warnier
itay sahar wrote: Pid, I'm not using B as the cookie value. A & B go to encode and finally you have *one *value(C). this value is sent to addCookie. C is somthing like: aXRheS5zYWhhckBnbWFpbC5jb206NmRlNWNhNGY6MTI1NGM0NjExMTA6LTdmZWI6OTEzNTQ4NjI0 Ok, let's take this at face value. So yet, you

Re: Control character in cookie value

2009-12-07 Thread itay sahar
Pid, I'm not using B as the cookie value. A & B go to encode and finally you have *one *value(C). this value is sent to addCookie. C is somthing like: aXRheS5zYWhhckBnbWFpbC5jb206NmRlNWNhNGY6MTI1NGM0NjExMTA6LTdmZWI6OTEzNTQ4NjI0 On Mon, Dec 7, 2009 at 12:16 PM, Pid wrote: > On 06/12/2009 21:51,

Re: Control character in cookie value

2009-12-07 Thread Pid
On 06/12/2009 21:51, itay sahar wrote: Hi Andre, please see below input and output of: protected String encodeToken(String username, String value) { StringBuilder sb = new StringBuilder(); sb.append(username); sb.append(":"); sb.append(value); return Base64

Re: Control character in cookie value

2009-12-06 Thread itay sahar
Hi Andre, please see below input and output of: protected String encodeToken(String username, String value) { StringBuilder sb = new StringBuilder(); sb.append(username); sb.append(":"); sb.append(value); return Base64.encodeBytes(sb.toString().getBytes()); } Inpu

Re: Control character in cookie value

2009-12-05 Thread itay sahar
Thanks for reply Mark, So you suggest to change the following method: protected String encodeToken(String username, String value) { StringBuilder sb = new StringBuilder(); sb.append(username); sb.append(":"); sb.append(value); return Base64.encodeBytes(sb.toString

Re: Control character in cookie value

2009-12-05 Thread André Warnier
Mark Thomas wrote: itay sahar wrote: Caused by: java.lang.IllegalArgumentException: Control character in cookie value, consider BASE64 encoding your value at org.apache.tomcat.util.http.ServerCookie.maybeQuote2(ServerCookie.java:396) To cause this, there must be a character in the valu

Re: Control character in cookie value

2009-12-05 Thread Mark Thomas
itay sahar wrote: > Caused by: java.lang.IllegalArgumentException: Control character in cookie > value, consider BASE64 encoding your value > at > org.apache.tomcat.util.http.ServerCookie.maybeQuote2(ServerCookie.java:396) To cause this, there must be a character in the value with an ASCII

Re: Control character in cookie value

2009-12-05 Thread itay sahar
This is not my code. It is seam code. see below the encoding section: protected String encodeToken(String username, String value) { StringBuilder sb = new StringBuilder(); sb.append(username); sb.append(":"); sb.append(value); return Base64.encodeBytes(sb.toString()

Re: Control character in cookie value

2009-12-05 Thread André Warnier
itay sahar wrote: Hi all, I'm using seam on tomcat 6.0.20 and encounter problem in my security module. Basically, i try to add cookie with base64 encoding of the username which is email address. The encoding works and no exception is thrown. But when seam try adding the cookie an exception i