summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python
diff options
context:
space:
mode:
Diffstat (limited to 'meta-openstack/recipes-devtools/python')
-rw-r--r--meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch59
-rw-r--r--meta-openstack/recipes-devtools/python/python-swift_git.bb3
2 files changed, 61 insertions, 1 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
new file mode 100644
index 0000000..a284b5b
--- /dev/null
+++ b/meta-openstack/recipes-devtools/python/python-swift/CVE-2014-0006-swift-1265665.patch
@@ -0,0 +1,59 @@
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
diff --git a/meta-openstack/recipes-devtools/python/python-swift_git.bb b/meta-openstack/recipes-devtools/python/python-swift_git.bb
index 680dbc3..d174517 100644
--- a/meta-openstack/recipes-devtools/python/python-swift_git.bb
+++ b/meta-openstack/recipes-devtools/python/python-swift_git.bb
@@ -4,7 +4,7 @@ SECTION = "devel/python"
4LICENSE = "Apache-2.0" 4LICENSE = "Apache-2.0"
5LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57" 5LIC_FILES_CHKSUM = "file://LICENSE;md5=3b83ef96387f14655fc854ddc3c6bd57"
6 6
7PR = "r0" 7PR = "r1"
8SRCNAME = "swift" 8SRCNAME = "swift"
9 9
10SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \ 10SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \
@@ -14,6 +14,7 @@ SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \
14 file://swift.init \ 14 file://swift.init \
15 file://swift_setup.sh \ 15 file://swift_setup.sh \
16 file://cluster.conf \ 16 file://cluster.conf \
17 file://CVE-2014-0006-swift-1265665.patch \
17" 18"
18 19
19SRCREV="2f3526c559fe53ce904b735a81dee6de46127176" 20SRCREV="2f3526c559fe53ce904b735a81dee6de46127176"