From 5bf6526380be70723e90d589acb16b6877e17249 Mon Sep 17 00:00:00 2001 From: David Scott Date: Thu, 20 Jul 2017 10:54:43 +0100 Subject: [PATCH] metadata: avoid printing large chunks of configuration json to the console If the configuration .json has contents like: { "etc": { "ssl": { "certs": { "ca-certificates.crt": { "perm": "0644", "content": "large amount of certificate text" } } } }, ... } then we print a warning because the node "ssl" has no "perm". Previously the warning would include the contents of "ssl", which would be large (and in theory could include secret information). This patch modifies the warning print to only print the key and not the value. Without this patch, I see on the console: 2017/07/20 10:03:04 CDROM: Probe succeeded 2017/07/20 10:03:04 No permission provided ssl:map[certs:map[ca-certificates.crt:map[perm:0644 content:large amount of certificate text]]] - 000-metadata With this patch, I see on the console: 2017/07/20 09:54:18 CDROM: Probe succeeded 2017/07/20 09:54:18 No permission provided ssl - 000-metadata Signed-off-by: David Scott --- pkg/metadata/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/metadata/main.go b/pkg/metadata/main.go index f447b2eda..b151137f0 100644 --- a/pkg/metadata/main.go +++ b/pkg/metadata/main.go @@ -173,11 +173,11 @@ func processUserData(data []byte) error { switch fi := i.(type) { case map[string]interface{}: if _, ok := fi["perm"]; !ok { - log.Printf("No permission provided %s:%s", f, fi) + log.Printf("No permission provided %s", f) continue } if _, ok := fi["content"]; !ok { - log.Printf("No content provided %s:%s", f, fi) + log.Printf("No content provided %s", f) continue } c = fi["content"].(string)