summaryrefslogtreecommitdiffstats
path: root/netwerk/test/unit
diff options
context:
space:
mode:
authorGaming4JC <g4jc@bulletmail.org>2018-09-25 23:03:28 -0400
committerGaming4JC <g4jc@bulletmail.org>2018-09-25 23:03:28 -0400
commitc5c9445e3adf6b65c98f6810551d7c3d64133134 (patch)
treecf7aa42302515fe1792fd9c3230c6fd7ae3325fc /netwerk/test/unit
parente3508f55bed8a463d298021633dbc7d079c9d764 (diff)
downloadUXP-c5c9445e3adf6b65c98f6810551d7c3d64133134.tar
UXP-c5c9445e3adf6b65c98f6810551d7c3d64133134.tar.gz
UXP-c5c9445e3adf6b65c98f6810551d7c3d64133134.tar.lz
UXP-c5c9445e3adf6b65c98f6810551d7c3d64133134.tar.xz
UXP-c5c9445e3adf6b65c98f6810551d7c3d64133134.zip
backport mozbug 1334776 - CVE-2017-7797 Header name interning leaks across origins
Potential attack: session supercookie. [Moz Notes](https://bugzilla.mozilla.org/show_bug.cgi?id=1334776#c5): "The problem is that for unknown header names we store the first one we see and then later we case-insensitively match against that name *globally*. That means you can track if a user agent has already seen a certain header name used (by using a different casing and observing whether it gets normalized). This would allow you to see if a user has used a sensitive service that uses custom header names, or allows you to track a user across sites, by teaching the browser about a certain header case once and then observing if different casings get normalized to that. What we should do instead is only store the casing for a header name for each header list and not globally. That way it only leaks where it's expected (and necessary) to leak." [Moz fix note](https://bugzilla.mozilla.org/show_bug.cgi?id=1334776#c8): "nsHttpAtom now holds the old nsHttpAtom and a string that is case sensitive (only for not standard headers). So nsHttpAtom holds a pointer to a header name. (header names are store on a static structure). This is how it used to be. I left that part the same but added a nsCString which holds a string that was used to resoled the header name. So when we parse headers we call ResolveHeader with a char*. If it is a new header name the char* will be stored in a HttpHeapAtom, nsHttpAtom::_val will point to HttpHeapAtom::value and the same strings will be stored in mLocalCaseSensitiveHeader. For the first resolve request they will be the same but for the following maybe not. At the end this nsHttpAtom will be stored in nsHttpHeaderArray. For all operation we will used the old char* except when we are returning it to a script using VisitHeaders."
Diffstat (limited to 'netwerk/test/unit')
-rw-r--r--netwerk/test/unit/test_bug1064258.js2
-rw-r--r--netwerk/test/unit/test_original_sent_received_head.js18
2 files changed, 10 insertions, 10 deletions
diff --git a/netwerk/test/unit/test_bug1064258.js b/netwerk/test/unit/test_bug1064258.js
index 3f76837ae..da982c2d6 100644
--- a/netwerk/test/unit/test_bug1064258.js
+++ b/netwerk/test/unit/test_bug1064258.js
@@ -133,7 +133,7 @@ function cacheCheck2(status, entry)
do_check_eq(entry.dataSize, 0);
try {
do_check_neq(entry.getMetaDataElement("response-head"), null);
- do_check_true(entry.getMetaDataElement("response-head").match('Etag: testetag'));
+ do_check_true(entry.getMetaDataElement("response-head").match('etag: testetag'));
}
catch (ex) {
do_throw("Missing response head");
diff --git a/netwerk/test/unit/test_original_sent_received_head.js b/netwerk/test/unit/test_original_sent_received_head.js
index c4d02d5d2..d668abf59 100644
--- a/netwerk/test/unit/test_original_sent_received_head.js
+++ b/netwerk/test/unit/test_original_sent_received_head.js
@@ -114,11 +114,11 @@ function checkResponse(request, data, context) {
var locationHeaderFound = 0;
request.visitResponseHeaders({
visitHeader: function visit(aName, aValue) {
- if (aName == "Link") {
+ if (aName == "link") {
linkHeaderFound++;
do_check_eq(aValue, "value1, value2");
}
- if (aName == "Location") {
+ if (aName == "location") {
locationHeaderFound++;
do_check_eq(aValue, "loc");
}
@@ -132,7 +132,7 @@ function checkResponse(request, data, context) {
var locationOrgHeaderFound = 0;
request.visitOriginalResponseHeaders({
visitHeader: function visitOrg(aName, aValue) {
- if (aName == "Link") {
+ if (aName == "link") {
if (linkOrgHeaderFound == 0) {
do_check_eq(aValue, "");
} else if (linkOrgHeaderFound == 1 ) {
@@ -142,7 +142,7 @@ function checkResponse(request, data, context) {
}
linkOrgHeaderFound++;
}
- if (aName == "Location") {
+ if (aName == "location") {
locationOrgHeaderFound++;
do_check_eq(aValue, "loc");
}
@@ -160,10 +160,10 @@ function checkResponse(request, data, context) {
var locationHeaderFound2 = 0;
request.visitResponseHeaders({
visitHeader: function visit(aName, aValue) {
- if (aName == "Link") {
+ if (aName == "link") {
linkHeaderFound2 = true;
}
- if (aName == "Location") {
+ if (aName == "location") {
locationHeaderFound2 = true;
}
}
@@ -176,7 +176,7 @@ function checkResponse(request, data, context) {
var locationOrgHeaderFound2 = 0;
request.visitOriginalResponseHeaders({
visitHeader: function visitOrg(aName, aValue) {
- if (aName == "Link") {
+ if (aName == "link") {
if (linkOrgHeaderFound2 == 0) {
do_check_eq(aValue, "");
} else if (linkOrgHeaderFound2 == 1 ) {
@@ -186,7 +186,7 @@ function checkResponse(request, data, context) {
}
linkOrgHeaderFound2++;
}
- if (aName == "Location") {
+ if (aName == "location") {
locationOrgHeaderFound2++;
do_check_eq(aValue, "loc");
}
@@ -199,7 +199,7 @@ function checkResponse(request, data, context) {
if (dbg) { print("============== Test GetResponseHeader"); }
var linkOrgHeaderFound3 = 0;
- request.getOriginalResponseHeader("Link",{
+ request.getOriginalResponseHeader("link",{
visitHeader: function visitOrg(aName, aValue) {
if (linkOrgHeaderFound3 == 0) {
do_check_eq(aValue, "");