[MM-39597] Implement ConfigDiffs.Sanitize() (#18855)

* Implement ConfigDiffs.Sanitize()

* Remove possibly sensitive info from logs
Этот коммит содержится в:
Claudio Costa
2021-10-28 14:07:35 +02:00
коммит произвёл GitHub
родитель ceee3f4b5f
Коммит f621989c58
5 изменённых файлов: 552 добавлений и 20 удалений

Просмотреть файл

@@ -165,7 +165,7 @@ func updateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = model.NewAppError("updateConfig", "api.config.update_config.diff.app_error", nil, diffErr.Error(), http.StatusInternalServerError)
return
}
auditRec.AddMeta("diff", diffs)
auditRec.AddMeta("diff", diffs.Sanitize())
newCfg.Sanitize()
@@ -292,7 +292,7 @@ func patchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = model.NewAppError("patchConfig", "api.config.patch_config.diff.app_error", nil, diffErr.Error(), http.StatusInternalServerError)
return
}
auditRec.AddMeta("diff", diffs)
auditRec.AddMeta("diff", diffs.Sanitize())
newCfg.Sanitize()
@@ -400,8 +400,6 @@ func migrateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
}
auditRec := c.MakeAuditRecord("migrateConfig", audit.Fail)
auditRec.AddMeta("from", from)
auditRec.AddMeta("to", to)
defer c.LogAuditRec(auditRec)
if !c.App.SessionHasPermissionTo(*c.AppContext.Session(), model.PermissionManageSystem) {

Просмотреть файл

@@ -73,7 +73,7 @@ func localUpdateConfig(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = model.NewAppError("updateConfig", "api.config.update_config.diff.app_error", nil, diffErr.Error(), http.StatusInternalServerError)
return
}
auditRec.AddMeta("diff", diffs)
auditRec.AddMeta("diff", diffs.Sanitize())
newCfg.Sanitize()
@@ -131,7 +131,7 @@ func localPatchConfig(c *Context, w http.ResponseWriter, r *http.Request) {
c.Err = model.NewAppError("patchConfig", "api.config.patch_config.diff.app_error", nil, diffErr.Error(), http.StatusInternalServerError)
return
}
auditRec.AddMeta("diff", diffs)
auditRec.AddMeta("diff", diffs.Sanitize())
auditRec.Success()