forked from adobe/webkit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crypto.getRandomValues should throw an exception when given a big array
https://bugs.webkit.org/show_bug.cgi?id=95269 Reviewed by Eric Seidel. Source/WebCore: The W3C Web Cryptography Working Group has taken up specifying window.crypto. The latest draft calls for getRandomValues to throw an exception when given an array that's large. Test: security/crypto-random-values-limits.html * page/Crypto.cpp: (WebCore::Crypto::getRandomValues): LayoutTests: * security/crypto-random-values-limits-expected.txt: Added. * security/crypto-random-values-limits.html: Added. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@126953 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
62a8781
commit b71b45b
Showing
5 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
2012-08-28 Adam Barth <[email protected]> | ||
|
||
crypto.getRandomValues should throw an exception when given a big array | ||
https://bugs.webkit.org/show_bug.cgi?id=95269 | ||
|
||
Reviewed by Eric Seidel. | ||
|
||
* security/crypto-random-values-limits-expected.txt: Added. | ||
* security/crypto-random-values-limits.html: Added. | ||
|
||
2012-08-28 Tom Sepez <[email protected]> | ||
|
||
CSP doesn't turn off eval, etc. in Web Workers | ||
|
12 changes: 12 additions & 0 deletions
12
LayoutTests/security/crypto-random-values-limits-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Tests the limits of crypto.randomValues. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS 'crypto' in window is true | ||
PASS 'getRandomValues' in window.crypto is true | ||
PASS crypto.getRandomValues(largeArray) threw exception Error: QUOTA_EXCEEDED_ERR: DOM Exception 22. | ||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<script src="../fast/js/resources/js-test-pre.js"></script> | ||
<script src="resources/utilities.js"></script> | ||
</head> | ||
<body> | ||
<p id="description"></p> | ||
<div id="console"></div> | ||
<script> | ||
description("Tests the limits of crypto.randomValues."); | ||
|
||
if (!window.ArrayBuffer) | ||
debug("This test requres ArrayBuffers to run!"); | ||
|
||
shouldBe("'crypto' in window", "true"); | ||
shouldBe("'getRandomValues' in window.crypto", "true"); | ||
|
||
try { | ||
var largeArray = new Uint8Array(66000); | ||
|
||
shouldThrow("crypto.getRandomValues(largeArray)"); | ||
} catch(ex) { | ||
debug(ex); | ||
} | ||
|
||
</script> | ||
<script src="../fast/js/resources/js-test-post.js"></script> | ||
</body> | ||
</html> | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
2012-08-28 Adam Barth <[email protected]> | ||
|
||
crypto.getRandomValues should throw an exception when given a big array | ||
https://bugs.webkit.org/show_bug.cgi?id=95269 | ||
|
||
Reviewed by Eric Seidel. | ||
|
||
The W3C Web Cryptography Working Group has taken up specifying | ||
window.crypto. The latest draft calls for getRandomValues to throw an | ||
exception when given an array that's large. | ||
|
||
Test: security/crypto-random-values-limits.html | ||
|
||
* page/Crypto.cpp: | ||
(WebCore::Crypto::getRandomValues): | ||
|
||
2012-08-28 Tom Sepez <[email protected]> | ||
|
||
CSP doesn't turn off eval, etc. in Web Workers | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters