components/openstack/swift/patches/02-CVE-2014-0006.patch
branchs11-update
changeset 3178 77584387a894
parent 3175 1ff833d174d4
child 3179 07c03b663108
--- a/components/openstack/swift/patches/02-CVE-2014-0006.patch	Wed Jun 11 05:34:04 2014 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-From c0eed792a22865b280f99cbb79076fa7ad19fcbb Mon Sep 17 00:00:00 2001
-From: Samuel Merritt <[email protected]>
-Date: Thu, 16 Jan 2014 12:45:52 +0000
-Subject: Use constant time comparison in tempURL
-
-Use constant time comparison when evaluating tempURL to avoid timing
-attacks (CVE-2014-0006). This is the grizzly backport of the master
-patch.
-
-Fixes bug 1265665
-
-Change-Id: I11e4ad83cc4077e52adf54a0bd0f9749294b2a48
----
-diff --git a/swift/common/middleware/tempurl.py b/swift/common/middleware/tempurl.py
-index 5a05de7..8a2517e 100644
---- a/swift/common/middleware/tempurl.py
-+++ b/swift/common/middleware/tempurl.py
-@@ -98,6 +98,7 @@ from urlparse import parse_qs
- 
- from swift.common.wsgi import make_pre_authed_env
- from swift.common.http import HTTP_UNAUTHORIZED
-+from swift.common.utils import streq_const_time
- 
- 
- #: Default headers to remove from incoming requests. Simply a whitespace
-@@ -248,14 +249,14 @@ class TempURL(object):
-         if env['REQUEST_METHOD'] == 'HEAD':
-             hmac_val = self._get_hmac(env, temp_url_expires, key,
-                                       request_method='GET')
--            if temp_url_sig != hmac_val:
-+            if not streq_const_time(temp_url_sig, hmac_val):
-                 hmac_val = self._get_hmac(env, temp_url_expires, key,
-                                           request_method='PUT')
--                if temp_url_sig != hmac_val:
-+                if not streq_const_time(temp_url_sig, hmac_val):
-                     return self._invalid(env, start_response)
-         else:
-             hmac_val = self._get_hmac(env, temp_url_expires, key)
--            if temp_url_sig != hmac_val:
-+            if not streq_const_time(temp_url_sig, hmac_val):
-                 return self._invalid(env, start_response)
-         self._clean_incoming_headers(env)
-         env['swift.authorize'] = lambda req: None