From faa778ec9d830f5ae92a74980b7662b56c64aa72 Mon Sep 17 00:00:00 2001 From: Job Bautista Date: Mon, 25 Jul 2022 18:56:46 +0800 Subject: [PATCH] Issue #1975 - Implement Origin header CSRF mitigation. Backported from Mozilla bug 446344. --- modules/libpref/init/all.js | 4 ++ netwerk/protocol/http/HttpBaseChannel.cpp | 36 ++++++++------- netwerk/protocol/http/HttpBaseChannel.h | 2 + netwerk/protocol/http/nsHttpAtomList.h | 1 + netwerk/protocol/http/nsHttpChannel.cpp | 53 +++++++++++++++++++++++ netwerk/protocol/http/nsHttpChannel.h | 1 + 6 files changed, 82 insertions(+), 15 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 12c23fbb3e..e0709a477e 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1491,6 +1491,10 @@ pref("network.http.referer.XOriginTrimmingPolicy", 0); // 0=always send, 1=send iff base domains match, 2=send iff hosts match pref("network.http.referer.XOriginPolicy", 0); +// Include an origin header on non-GET and non-HEAD requests regardless of CORS +// 0=never send, 1=send when same-origin only, 2=always send +pref("network.http.sendOriginHeader", 0); + // Controls whether referrer attributes in , , ,