Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Cai <jcai@gitlab.com>2020-01-17 20:19:54 +0300
committerjramsay <jcai@gitlab.com>2020-01-22 22:22:25 +0300
commit06f8cb585669a2e9178903777fedac473d878ec6 (patch)
tree53cf8f3b35b09f536a2fd67bbfb6da56301736e3
parentfb7ee29052b8aa202e37c1026f6fff02d0b5aa42 (diff)
Do not log entire node struct because it includes tokens
-rw-r--r--changelogs/unreleased/jc-do-not-leak-tokens-in-replicator.yml5
-rw-r--r--internal/praefect/models/node.go9
2 files changed, 14 insertions, 0 deletions
diff --git a/changelogs/unreleased/jc-do-not-leak-tokens-in-replicator.yml b/changelogs/unreleased/jc-do-not-leak-tokens-in-replicator.yml
new file mode 100644
index 000000000..cc3c3c587
--- /dev/null
+++ b/changelogs/unreleased/jc-do-not-leak-tokens-in-replicator.yml
@@ -0,0 +1,5 @@
+---
+title: Do not log entire node struct because it includes tokens
+merge_request: 1766
+author:
+type: security
diff --git a/internal/praefect/models/node.go b/internal/praefect/models/node.go
index 5dfaf3667..f59a24734 100644
--- a/internal/praefect/models/node.go
+++ b/internal/praefect/models/node.go
@@ -1,5 +1,9 @@
package models
+import (
+ "fmt"
+)
+
// Node describes an address that serves a storage
type Node struct {
Storage string `toml:"storage"`
@@ -8,6 +12,11 @@ type Node struct {
DefaultPrimary bool `toml:"primary"`
}
+// String prints out the node attributes but hiding the token
+func (n Node) String() string {
+ return fmt.Sprintf("storage_name: %s, address: %s, primary: %v", n.Storage, n.Address, n.DefaultPrimary)
+}
+
// Repository describes a repository's relative path and its primary and list of secondaries
type Repository struct {
RelativePath string