mirror of
https://github.com/linuxkit/linuxkit.git
synced 2025-07-19 17:26:28 +00:00
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 <dave.scott@docker.com>
This commit is contained in:
parent
de11ea12ac
commit
5bf6526380
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user