From 9cbf0289d8cb03a3c50b21e7c918da11dda70f9d Mon Sep 17 00:00:00 2001 From: "stuart.warren" Date: Mon, 15 May 2017 11:20:04 +0100 Subject: [PATCH 1/2] fix(npc): create ipsets with only valid xml characters Why: * xml output of ipset is invalid because ipset itself doesn't appear to escape invalid chars * fixes #2958 --- npc/shortname.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/npc/shortname.go b/npc/shortname.go index c0704bfb..c33ab834 100644 --- a/npc/shortname.go +++ b/npc/shortname.go @@ -7,12 +7,13 @@ import ( const ( // This array: - // * Must include only printable UTF8 characters that are represented with a single byte + // * Must include only printable UTF8 characters that are represented with a single byte (http://www.utf8-chartable.de/) // * Must be at least of length 85 (`len("weave-") + l(2^160)/l(85)` equals 31, the maximum ipset name length) // * Must not include commas as those are treated specially by `ipset add` when adding a named set to a list:set // * Should not include space for readability + // * Should not include invalid chars for XML `<>&"'` // * Should not include single quote or backslash to be nice to shell users - ShortNameSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789(){}[]<>_$%^&*|/?.;:@#~" + ShortNameSymbols = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789(){}[]+=_$%^!*|/?.;:@#~" ) // sha1 hash an arbitrary string and represent it using the full range of From 6bbd8d7a4cba40ecfa4518a5ca7a8fde471ba48a Mon Sep 17 00:00:00 2001 From: Marc CARRE Date: Mon, 15 May 2017 12:36:55 +0100 Subject: [PATCH 2/2] Escape $ in sed expression. This fixes new error raised by latest version of shfmt, leading to build failures. --- test/run-integration-tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/run-integration-tests.sh b/test/run-integration-tests.sh index f2d74b7e..97c8e9d1 100755 --- a/test/run-integration-tests.sh +++ b/test/run-integration-tests.sh @@ -284,7 +284,7 @@ function configure() { local inventory_file=$(mktemp /tmp/ansible_inventory_XXXXX) echo "[all]" >"$inventory_file" # shellcheck disable=SC2001 - echo "$2" | sed "s/$/:$3/" >>"$inventory_file" + echo "$2" | sed "s/\$/:$3/" >>"$inventory_file" # Configure the provisioned machines using Ansible, allowing up to 3 retries upon failure (e.g. APT connectivity issues, etc.): for i in $(seq 3); do