ceph: Add comment that sprintf formatting is safe

This commits adds comment for safety of using
sprintf formatting

Closes: https://github.com/rook/rook/issues/4575
Signed-off-by: crombus <pkundra@redhat.com>
This commit is contained in:
crombus committed 2020-02-17 18:04:24 +05:30
1 parent 02ba91cddc
commit ae110fc517
2 files changed
+2

No files matched your search

+1
View File
@@ -63,6 +63,7 @@ func NewMonInfo(name, ip string, port int32) *MonInfo {
func (c *ClusterInfo) Log(logger *capnslog.PackageLogger) {
mons := []string{}
for _, m := range c.Monitors {
// Sprintf formatting is safe as user input isn't being used. Issue https://github.com/rook/rook/issues/4575
mons = append(mons, fmt.Sprintf("{Name: %s, Endpoint: %s}", m.Name, m.Endpoint))
}
monsec := ""
+1
View File
@@ -290,6 +290,7 @@ func (c *cluster) AddLabelsToNode(nodeName string, labels map[string]string) err
tokens = append(tokens, "\""+k+"\":\""+v+"\"")
}
labelString := "{" + strings.Join(tokens, ",") + "}"
// Sprintf formatting is safe as user input isn't being used. Issue https://github.com/rook/rook/issues/4575
patch := fmt.Sprintf(`{"metadata":{"labels":%v}}`, labelString)
var err error
for attempt := 0; attempt < labelingRetries; attempt++ {