From 149f0833acaf57741166fc719e7bed4f48ccd271 Mon Sep 17 00:00:00 2001 From: Chris Capurso <1036769+ccapurso@users.noreply.github.com> Date: Wed, 16 Mar 2022 14:03:49 +0000 Subject: [PATCH 1/3] backport of commit fb51de13b109c538db1db8d479be585913394fdd --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index fbe7cbadcfbac..0d025a52e269c 100644 --- a/go.mod +++ b/go.mod @@ -72,7 +72,7 @@ require ( github.com/hashicorp/go-secure-stdlib/awsutil v0.1.5 github.com/hashicorp/go-secure-stdlib/base62 v0.1.2 github.com/hashicorp/go-secure-stdlib/gatedwriter v0.1.1 - github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.1 + github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.2 github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 github.com/hashicorp/go-secure-stdlib/parseutil v0.1.4 github.com/hashicorp/go-secure-stdlib/password v0.1.1 diff --git a/go.sum b/go.sum index 24c5c0b8120dc..c285d43459ef1 100644 --- a/go.sum +++ b/go.sum @@ -879,6 +879,8 @@ github.com/hashicorp/go-secure-stdlib/gatedwriter v0.1.1 h1:9um9R8i0+HbRHS9d64kd github.com/hashicorp/go-secure-stdlib/gatedwriter v0.1.1/go.mod h1:6RoRTSMDK2H/rKh3P/JIsk1tK8aatKTt3JyvIopi3GQ= github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.1 h1:IJgULbAXuvWxzKFfu+Au1FUmHIJulS6N4F7Hkn+Kck0= github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.1/go.mod h1:rf5JPE13wi+NwjgsmGkbg4b2CgHq8v7Htn/F0nDe/hg= +github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.2 h1:NS6BHieb/pDfx3M9jDdaPpGyyVp+aD4A3DjX3dgRmzs= +github.com/hashicorp/go-secure-stdlib/kv-builder v0.1.2/go.mod h1:rf5JPE13wi+NwjgsmGkbg4b2CgHq8v7Htn/F0nDe/hg= github.com/hashicorp/go-secure-stdlib/mlock v0.1.1/go.mod h1:zq93CJChV6L9QTfGKtfBxKqD7BqqXx5O04A/ns2p5+I= github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 h1:p4AKXPPS24tO8Wc8i1gLvSKdmkiSY5xuju57czJ/IJQ= github.com/hashicorp/go-secure-stdlib/mlock v0.1.2/go.mod h1:zq93CJChV6L9QTfGKtfBxKqD7BqqXx5O04A/ns2p5+I= From eb4478140cb94715fe71393b56aadba7b7142ad5 Mon Sep 17 00:00:00 2001 From: Chris Capurso <1036769+ccapurso@users.noreply.github.com> Date: Wed, 16 Mar 2022 10:15:51 -0400 Subject: [PATCH 2/3] add kv test to ensure single backslash values no longer panic (cherry picked from commit cd61f310f02dd7e3e476900f665fa95307c5824b) --- command/kv_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/command/kv_test.go b/command/kv_test.go index f6f73ebe2b9b4..38cab013e1c98 100644 --- a/command/kv_test.go +++ b/command/kv_test.go @@ -134,6 +134,13 @@ func TestKVPutCommand(t *testing.T) { v2ExpectedFields, 0, }, + + { + "v2_single_value_backslash", + []string{"kv/write/foo", "foo=\\"}, + []string{"created_time"}, + 0, + }, } for _, tc := range cases { @@ -557,7 +564,7 @@ func TestKVMetadataGetCommand(t *testing.T) { { "versions_exist", []string{"kv/foo"}, - append(expectedTopLevelFields, expectedVersionFields[:]...), + append(expectedTopLevelFields, expectedVersionFields[:]...), 0, }, } From 515eb2a5087bb13237840b2d71dfa1e29293ae60 Mon Sep 17 00:00:00 2001 From: Chris Capurso <1036769+ccapurso@users.noreply.github.com> Date: Wed, 16 Mar 2022 10:23:41 -0400 Subject: [PATCH 3/3] add changelog entry (cherry picked from commit d90053515f1aa03e394ad649773521880c597820) --- changelog/14523.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 changelog/14523.txt diff --git a/changelog/14523.txt b/changelog/14523.txt new file mode 100644 index 0000000000000..f3147315f2d5d --- /dev/null +++ b/changelog/14523.txt @@ -0,0 +1,3 @@ +```release-note:bug +cli: Fix panic caused by parsing key=value fields whose value is a single backslash +```