Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  7 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Laurent Perez  
View profile  
 More options Jan 3 2008, 6:48 am
From: Laurent Perez <hak...@gmail.com>
Date: Thu, 3 Jan 2008 03:48:24 -0800 (PST)
Local: Thurs, Jan 3 2008 6:48 am
Subject: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
Hi

The removal of "fb_sig" parameter from params map will throw an
UnsupportedOperationException when the map comes from
request.getParameterMap(), because it is an immutable map.

Simple test case to reproduce :

MockHttpServletRequest request = new MockHttpServletRequest();
Map<String,CharSequence> rparams = new HashMap<String,
CharSequence>();
rparams.put("foo", "foo".subSequence(0, "foo".length()));
request.addParameters(rparams);
Map<String,CharSequence> testMap = request.getParameterMap();
boolean valid = FacebookSignatureUtil.verifySignature(testMap, secret,
expected); // exception thrown

I fixed this with an ugly one, by creating a new map wrapper like
this :

Map<String,String[]> reqParams = request.getParameterMap();
Map<String,String[]> x = new HashMap<String, String[]>(reqParams);
Map<String, CharSequence> z = new HashMap<String, CharSequence>();
for(Entry<String, String[]> e : x.entrySet()){
       z.put(e.getKey(), e.getValue()[0].subSequence(0, e.getValue()
[0].length()));

} // z is now mutable, fb_sig can be removed

Also, I don't really understand the whole CharSequence or
CharSequence[] constructors/utilities around FacebookSignatureUtil
verifications, given that request.getParameterMap is a
Map<String,String[]> as defined in
http://java.sun.com/javaee/5/docs/api/javax/servlet/ServletRequest.ht...()
, not a CharSequence one.

laurent


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Travis Reeder  
View profile  
 More options Jan 4 2008, 10:47 am
From: "Travis Reeder" <tree...@gmail.com>
Date: Fri, 4 Jan 2008 07:47:19 -0800
Local: Fri, Jan 4 2008 10:47 am
Subject: Re: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))

Off the top of my head (not looking at code), you have to use two methods in
FacebookSignatureUtils, one to convert map and one to verify signature. I
can't remember the method names, but they are there.  There should really be
a single method to do it, but it's not there.

On Jan 3, 2008 3:48 AM, Laurent Perez <hak...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aroth@bigtribe.com  
View profile  
 More options Jan 7 2008, 3:36 am
From: "ar...@bigtribe.com" <some...@gmail.com>
Date: Mon, 7 Jan 2008 00:36:44 -0800 (PST)
Local: Mon, Jan 7 2008 3:36 am
Subject: Re: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
I've added an FacebookSignatureUtil.autoVerifySignature() API call
that will automatically convert the map before trying to modify it.  I
would have modified the existing verifySignature() implementation to
perform the same task, but I noticed that that API call is not meant
to be passed the results of request.getParameterMap() (which as you
noted returns a Map<String,String[]>, while that method was expecting
a Map<String, CharSequence>...the only reason you weren't getting a
ClassCastException when you passed request.getParameterMap() to it was
that the method tries to modify the Map before it reads anythong from
it).  According to the javadoc on it, you are supposed to manually
call extractFacebookNamespaceParams on the map before invoking that
API call.

Anyways, the new FacebookSignatureUtil.autoVerifySignature() call
should now do it all for you.

On Jan 4, 7:47 am, "Travis Reeder" <tree...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cesar Arevalo  
View profile  
 More options Jan 7 2008, 3:49 am
From: Cesar Arevalo <carev...@cakefinancial.com>
Date: Mon, 07 Jan 2008 00:49:54 -0800
Local: Mon, Jan 7 2008 3:49 am
Subject: Re: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
Hi Aroth,

I don't see the changes you mention.

-Cesar


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aroth@bigtribe.com  
View profile  
 More options Jan 7 2008, 4:42 am
From: "ar...@bigtribe.com" <some...@gmail.com>
Date: Mon, 7 Jan 2008 01:42:01 -0800 (PST)
Local: Mon, Jan 7 2008 4:42 am
Subject: Re: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
Not up yet, I'm rolling them in with several other updates.  Should be
up soon.

On Jan 7, 12:49 am, Cesar Arevalo <carev...@cakefinancial.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
aroth@bigtribe.com  
View profile  
 More options Jan 7 2008, 8:09 am
From: "ar...@bigtribe.com" <some...@gmail.com>
Date: Mon, 7 Jan 2008 05:09:01 -0800 (PST)
Local: Mon, Jan 7 2008 8:09 am
Subject: Re: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
Okay, now it's up.

On Jan 7, 12:49 am, Cesar Arevalo <carev...@cakefinancial.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Laurent Perez  
View profile  
 More options Jan 7 2008, 5:34 pm
From: "Laurent Perez" <hak...@gmail.com>
Date: Mon, 7 Jan 2008 23:34:26 +0100
Local: Mon, Jan 7 2008 5:34 pm
Subject: Re: Bug in FacebookSignatureUtil.verifySignature(Map<String, CharSequence> params, secret, (expected))
Thanks aroth, thanks to everyone who contributed to this new release,
much appreciated ! :)

laurent

2008/1/7, ar...@bigtribe.com <some...@gmail.com>:

--
<a href="http://in-pocket.blogspot.com">http://in-pocket.blogspot.com
- Mobile world, technology and more</a>

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »