[Python-modules-commits] [m2crypto] 04/05: add securely-mangle-changed-strings.patch

Daniel Stender stender at moszumanska.debian.org
Tue Nov 14 21:52:35 UTC 2017


This is an automated email from the git hooks/post-receive script.

stender pushed a commit to branch debian/master
in repository m2crypto.

commit 8e7610662907b42c1102bd119c8b50429ca07fd6
Author: Daniel Stender <stender at debian.org>
Date:   Tue Nov 14 21:52:12 2017 +0100

    add securely-mangle-changed-strings.patch
---
 debian/changelog                                   |  3 +-
 .../patches/securely-mangle-changed-strings.patch  | 53 ++++++++++++++++++++++
 debian/patches/series                              |  1 +
 3 files changed, 56 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index a20dd80..8792b87 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,9 +2,10 @@ m2crypto (0.27.0-4) UNRELEASED; urgency=medium
 
   * deb/rules: temporarily disable test_HTTPSConnection_SNI_support on
     ppc-s (Closes: #881652).
+  * add securely-mangle-changed-strings.patch.
   * deb/source/options: complete modified files for extend-diff-ignore.
 
- -- Daniel Stender <stender at debian.org>  Tue, 14 Nov 2017 10:30:37 +0100
+ -- Daniel Stender <stender at debian.org>  Tue, 14 Nov 2017 21:51:43 +0100
 
 m2crypto (0.27.0-3) unstable; urgency=medium
 
diff --git a/debian/patches/securely-mangle-changed-strings.patch b/debian/patches/securely-mangle-changed-strings.patch
new file mode 100644
index 0000000..159bf04
--- /dev/null
+++ b/debian/patches/securely-mangle-changed-strings.patch
@@ -0,0 +1,53 @@
+Description: secure mangling of changed strings in test_authcookie.py
+ Fixes flaky failure of test_cookie_str_changed_mac, e.g. 0.27.0-3 on alpha,
+ 0.27.0-2 on mips, and others.
+Origin: https://gitlab.com/m2crypto/m2crypto/commit/8365272
+Bug: https://gitlab.com/m2crypto/m2crypto/issues/138
+
+--- a/tests/test_authcookie.py
++++ b/tests/test_authcookie.py
+@@ -31,6 +31,17 @@
+     def tearDown(self):
+         pass
+ 
++    def _corrupt_part_str(self, s, fr, to):
++        # type: (str, int, int) -> str
++        out = s[:fr] + ''.join([chr(ord(x) + 13) for x in s[fr:to]]) + s[to:]
++        self.assertNotEqual(s, out)
++        return out
++
++    def test_encode_part_str(self):
++        a_str = 'a1b2c3d4e5f6h7i8j9'
++        self.assertEqual(self._corrupt_part_str(a_str, 3, 5),
++                         'a1b?p3d4e5f6h7i8j9')
++
+     def test_mix_unmix(self):
+         dough = mix(self.exp, self.data)
+         exp, data = unmix(dough)
+@@ -131,7 +142,7 @@
+     def test_cookie_str_changed_exp(self):
+         c = self.jar.makeCookie(self.exp, self.data)
+         cout = c.output()
+-        cout_str = cout[:26] + '2' + cout[27:]
++        cout_str = self._corrupt_part_str(cout, 26, 28)
+         s = SimpleCookie()
+         s.load(cout_str)
+         self.assertFalse(self.jar.isGoodCookieString(s.output()))
+@@ -139,7 +150,7 @@
+     def test_cookie_str_changed_data(self):
+         c = self.jar.makeCookie(self.exp, self.data)
+         cout = c.output()
+-        cout_str = cout[:36] + 'X' + cout[37:]
++        cout_str = self._corrupt_part_str(cout, 36, 38)
+         s = SimpleCookie()
+         s.load(cout_str)
+         self.assertFalse(self.jar.isGoodCookieString(s.output()))
+@@ -147,7 +158,7 @@
+     def test_cookie_str_changed_mac(self):
+         c = self.jar.makeCookie(self.exp, self.data)
+         cout = c.output()
+-        cout_str = cout[:76] + 'X' + cout[77:]
++        cout_str = self._corrupt_part_str(cout, 76, 78)
+         s = SimpleCookie()
+         s.load(cout_str)
+         observed = self.jar.isGoodCookieString(s.output(), _debug=True)
diff --git a/debian/patches/series b/debian/patches/series
index efb28e1..43e3870 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,2 +1,3 @@
 0001-import-inspect-in-urllib-2.patch
 sni-test-race.patch
+securely-mangle-changed-strings.patch

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/m2crypto.git



More information about the Python-modules-commits mailing list