Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(787)

Issue 1720044: shindig.saferRandom() implementation (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
15 years, 9 months ago by johnfargo
Modified:
15 years, 8 months ago
Reviewers:
Paul Lindner, evn, dev-remailer
Base URL:
http://svn.apache.org/repos/asf/shindig/trunk/
Visibility:
Public.

Description

SHA1 JS impl: syntax/format updates for Shindig * Changed goog.crypt to shindig namespace. * Changed from prototype-style to closure-style impl. Implementation of a random-number "generator" seeded w/ mouse movement (quite unpredictible) and screen real estate (sometimes hard-ish to detect). The idea is to build a pure-JS random() method that is much less predictible than Math.random(), which is known to be fairly easily cracked. This has benefits for gadgets.rpc and other Shindig functionality which rely on a combination of random numbers and same-domain policy for security.

Patch Set 1 #

Patch Set 2 : Posting actual saferRandom() impl. #

Patch Set 3 : Small, but significant, JS fix. #

Patch Set 4 : Renaming method saferRandom() to random(); adding features/NOTICE line. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+272 lines, -175 lines) Patch
features/NOTICE View 1 chunk +1 line, -0 lines 0 comments Download
features/src/main/javascript/features/features.txt View 1 chunk +1 line, -0 lines 0 comments Download
features/src/main/javascript/features/shindig.random/feature.xml View 1 1 chunk +29 lines, -0 lines 0 comments Download
features/src/main/javascript/features/shindig.random/random.js View 1 chunk +72 lines, -0 lines 0 comments Download
features/src/main/javascript/features/shindig.random/sha1.js View 1 2 3 3 chunks +169 lines, -175 lines 0 comments Download

Messages

Total messages: 11
johnfargo
15 years, 9 months ago (2010-06-29 00:05:15 UTC) #1
johnfargo
Posting actual saferRandom() impl.
15 years, 9 months ago (2010-06-29 00:33:55 UTC) #2
johnfargo
FYI: Just posted this and added dev-remailer@shindig.apache.org. Thoughts welcome. On 2010/06/29 00:33:55, johnfargo wrote: > ...
15 years, 9 months ago (2010-06-29 00:35:58 UTC) #3
johnfargo
Small, but significant, JS fix.
15 years, 9 months ago (2010-06-29 00:50:14 UTC) #4
Paul Lindner
I'd prefer that the name of the feature match the name of the javascript namespace ...
15 years, 9 months ago (2010-06-29 00:59:13 UTC) #5
johnfargo
Renaming method saferRandom() to random(); adding features/NOTICE line.
15 years, 9 months ago (2010-06-29 01:06:57 UTC) #6
Paul Lindner
seems fine. For bonus points we might want to support: http://msdn.microsoft.com/en-us/library/system.security.cryptography.rngcryptoserviceprovider(v=VS.71).aspx (for IE) and window.crypto.random(10) ...
15 years, 9 months ago (2010-06-29 10:13:50 UTC) #7
johnfargo
Sounds like a good set of additions to me -- I'll add 'em in a ...
15 years, 9 months ago (2010-06-29 20:18:46 UTC) #8
evn
Hey guys! I'm the author of the saferRandom function.. and found a bug on it. ...
15 years, 9 months ago (2010-07-01 18:12:08 UTC) #9
Paul Lindner
So replace var ac = (e.screenX ^ e.clientX) << 16; ac += (e.screenY ^ e.clientY); ...
15 years, 9 months ago (2010-07-02 09:38:31 UTC) #10
evn
15 years, 9 months ago (2010-07-02 17:52:08 UTC) #11
On 2010/07/02 09:38:31, Paul Lindner wrote:
> So replace
> 
>     var ac = (e.screenX ^ e.clientX) << 16;
>     ac += (e.screenY ^ e.clientY);
> 
> with 
> 
>     var ac = (e.screenX + e.clientX) << 16;
>     ac += (e.screenY + e.clientY);
> 
> ???

Yes, the idea is that the attacker shouldn't be able to calculate the frame
position and the relative screen coords at the same time. In the case when the
gadget is loaded fullscreen the entropy disappears because screenX and clientX
are the same, so their XOR is 0.

Greetz
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b