summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch')
-rw-r--r--meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch59
1 files changed, 0 insertions, 59 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch b/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch
deleted file mode 100644
index a284b5b..0000000
--- a/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch
+++ /dev/null
@@ -1,59 +0,0 @@
1From b2c61375b3255486adb2900922a894dc7dad3c6d Mon Sep 17 00:00:00 2001
2From: Samuel Merritt <sam@swiftstack.com>
3Date: Thu, 16 Jan 2014 13:44:23 +0100
4Subject: Use constant time comparison in tempURL
5
6Use constant time comparison when evaluating tempURL to avoid timing
7attacks (CVE-2014-0006). This is the havana backport of the master
8patch.
9
10Fixes bug 1265665
11
12Change-Id: I11e4ad83cc4077e52adf54a0bd0f9749294b2a48
13
14diff --git a/swift/common/middleware/tempurl.py b/swift/common/middleware/tempurl.py
15index ffc1431..ae2f4a1 100644
16--- a/swift/common/middleware/tempurl.py
17+++ b/swift/common/middleware/tempurl.py
18@@ -98,7 +98,7 @@ from urlparse import parse_qs
19
20 from swift.proxy.controllers.base import get_account_info
21 from swift.common.swob import HeaderKeyDict
22-from swift.common.utils import split_path
23+from swift.common.utils import split_path, streq_const_time
24
25
26 #: Default headers to remove from incoming requests. Simply a whitespace
27@@ -267,17 +267,20 @@ class TempURL(object):
28 if not keys:
29 return self._invalid(env, start_response)
30 if env['REQUEST_METHOD'] == 'HEAD':
31- hmac_vals = self._get_hmacs(env, temp_url_expires, keys,
32- request_method='GET')
33- if temp_url_sig not in hmac_vals:
34- hmac_vals = self._get_hmacs(env, temp_url_expires, keys,
35- request_method='PUT')
36- if temp_url_sig not in hmac_vals:
37- return self._invalid(env, start_response)
38+ hmac_vals = (self._get_hmacs(env, temp_url_expires, keys,
39+ request_method='GET') +
40+ self._get_hmacs(env, temp_url_expires, keys,
41+ request_method='PUT'))
42 else:
43 hmac_vals = self._get_hmacs(env, temp_url_expires, keys)
44- if temp_url_sig not in hmac_vals:
45- return self._invalid(env, start_response)
46+
47+ # While it's true that any() will short-circuit, this doesn't affect
48+ # the timing-attack resistance since the only way this will
49+ # short-circuit is when a valid signature is passed in.
50+ is_valid_hmac = any(streq_const_time(temp_url_sig, h)
51+ for h in hmac_vals)
52+ if not is_valid_hmac:
53+ return self._invalid(env, start_response)
54 self._clean_incoming_headers(env)
55 env['swift.authorize'] = lambda req: None
56 env['swift.authorize_override'] = True
57--
58cgit v0.10.1
59