You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by ka...@apache.org on 2018/02/20 21:20:52 UTC

[1/2] mesos git commit: Allowed base64-decoding with whitespaces.

Repository: mesos
Updated Branches:
  refs/heads/1.4.x 638d24dbb -> 2b97ba53b


Allowed base64-decoding with whitespaces.

Most base64 decoders do not fail on encountering whitespace characters
as several encoders embed newlines to enforce line-width in encoded
data.

Review: https://reviews.apache.org/r/65696


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/4eb36052
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/4eb36052
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/4eb36052

Branch: refs/heads/1.4.x
Commit: 4eb360520ac322c69a775c0b91a9cd0303c68767
Parents: 638d24d
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Fri Feb 16 19:25:18 2018 -0500
Committer: Kapil Arya <ka...@mesosphere.io>
Committed: Tue Feb 20 16:20:03 2018 -0500

----------------------------------------------------------------------
 3rdparty/stout/include/stout/base64.hpp | 11 +++++++++++
 3rdparty/stout/tests/base64_tests.cpp   | 11 ++++++++---
 2 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/4eb36052/3rdparty/stout/include/stout/base64.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/include/stout/base64.hpp b/3rdparty/stout/include/stout/base64.hpp
index eabc9b0..9530c68 100644
--- a/3rdparty/stout/include/stout/base64.hpp
+++ b/3rdparty/stout/include/stout/base64.hpp
@@ -107,6 +107,17 @@ inline Try<std::string> decode(const std::string& s, const std::string& chars)
       break; // Reached the padding.
     }
 
+    // The base RFC (https://tools.ietf.org/html/rfc4648#section-3.3) explicitly
+    // asks to reject non-alphabet characters including newlines and
+    // whitespaces. However, other specifications like MIME simply ignore
+    // characters outside the base alphabet ("be liberal in what you accept").
+    // Further, most implementation ignore whiltespace characters when
+    // processing encoded data. This allows tools to delimit encoded with
+    // newlines or other whitespace characters for better readability, etc.
+    if (isspace(c)) {
+      continue;
+    }
+
     if (!isBase64(c)) {
       return Error("Invalid character '" + stringify(c) + "'");
     }

http://git-wip-us.apache.org/repos/asf/mesos/blob/4eb36052/3rdparty/stout/tests/base64_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/stout/tests/base64_tests.cpp b/3rdparty/stout/tests/base64_tests.cpp
index a6837c8..32d32d0 100644
--- a/3rdparty/stout/tests/base64_tests.cpp
+++ b/3rdparty/stout/tests/base64_tests.cpp
@@ -29,9 +29,14 @@ TEST(Base64Test, Decode)
   EXPECT_SOME_EQ("user:password", base64::decode("dXNlcjpwYXNzd29yZA="));
   EXPECT_SOME_EQ("user:password", base64::decode("dXNlcjpwYXNzd29yZA"));
 
-  // Whitespace is not allowed.
-  EXPECT_ERROR(base64::decode("d XNlcjpwYXNzd29yZA=="));
-  EXPECT_ERROR(base64::decode("d\r\nXNlcjpwYXNzd29yZA=="));
+  // Whitespaces are allowed.
+  EXPECT_SOME_EQ("user:password", base64::decode("d XNlcjpwYXNzd29yZA=="));
+  EXPECT_SOME_EQ("user:password", base64::decode("d\tXNlcjpwYXNzd29yZA=="));
+  EXPECT_SOME_EQ("user:password", base64::decode("d\nXNlcjpwYXNzd29yZA=="));
+  EXPECT_SOME_EQ("user:password", base64::decode("d\vXNlcjpwYXNzd29yZA=="));
+  EXPECT_SOME_EQ("user:password", base64::decode("d\fXNlcjpwYXNzd29yZA=="));
+  EXPECT_SOME_EQ("user:password", base64::decode("d\rXNlcjpwYXNzd29yZA=="));
+  EXPECT_SOME_EQ("user:password", base64::decode("d\r\nXNlcjpwYXNzd29yZA=="));
 
   // Invalid characters.
   EXPECT_ERROR(base64::decode("abc("));


[2/2] mesos git commit: Added MESOS-8569 to 1.4.2 changelog.

Posted by ka...@apache.org.
Added MESOS-8569 to 1.4.2 changelog.


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/2b97ba53
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/2b97ba53
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/2b97ba53

Branch: refs/heads/1.4.x
Commit: 2b97ba53b649f03de94f242800602d13747e6d7d
Parents: 4eb3605
Author: Kapil Arya <ka...@mesosphere.io>
Authored: Tue Feb 20 16:19:23 2018 -0500
Committer: Kapil Arya <ka...@mesosphere.io>
Committed: Tue Feb 20 16:20:05 2018 -0500

----------------------------------------------------------------------
 CHANGELOG | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/2b97ba53/CHANGELOG
----------------------------------------------------------------------
diff --git a/CHANGELOG b/CHANGELOG
index 27d403c..2186a72 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -14,6 +14,7 @@ Release Notes - Mesos - Version 1.4.2 (WIP)
  * [MESOS-8411] - Killing a queued task can lead to the command executor never terminating.
  * [MESOS-8480] - Mesos returns high resource usage when killing a Docker task.
  * [MESOS-8552] - CGROUPS_ROOT_PidNamespaceForward and CGROUPS_ROOT_PidNamespaceBackward tests fail.
+ * [MESOS-8569] - Allow newline characters when decoding base64 strings in stout.
 
 
 Release Notes - Mesos - Version 1.4.1