Make log payloads opaque pass-through
This commit is contained in:
@@ -2020,7 +2020,7 @@ func (svc *CoreService) GetDeclaredFileReadSnapshotForSession(sessionID string,
|
||||
PluginID: base.PluginID,
|
||||
Key: base.Key,
|
||||
State: "ready",
|
||||
Content: redactDeclaredFileReadContent(completed.ExecutionResult.Content),
|
||||
Content: completed.ExecutionResult.Content,
|
||||
Version: completed.ExecutionResult.Version,
|
||||
Checksum: completed.ExecutionResult.Checksum,
|
||||
SizeBytes: completed.ExecutionResult.SizeBytes,
|
||||
@@ -2065,29 +2065,6 @@ func jobCompletedAt(job domain.Job) time.Time {
|
||||
}
|
||||
return job.CreatedAt
|
||||
}
|
||||
|
||||
func redactDeclaredFileReadContent(content string) string {
|
||||
lines := strings.Split(content, "\n")
|
||||
for index, line := range lines {
|
||||
key, _, found := strings.Cut(line, "=")
|
||||
if !found || !secretLikeFileAssignmentKey(key) {
|
||||
continue
|
||||
}
|
||||
lines[index] = key + "=<redacted>"
|
||||
}
|
||||
return strings.Join(lines, "\n")
|
||||
}
|
||||
|
||||
func secretLikeFileAssignmentKey(key string) bool {
|
||||
normalized := strings.ToLower(strings.ReplaceAll(strings.ReplaceAll(strings.TrimSpace(key), "_", ""), "-", ""))
|
||||
for _, marker := range []string{"password", "passwd", "secret", "token", "apikey", "accesskey", "privatekey", "rcon"} {
|
||||
if strings.Contains(normalized, marker) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (svc *CoreService) PreviewServerConfigWriteForSession(sessionID string, request domain.ServerConfigDiffRequest) (domain.ServerConfigDiffPreview, error) {
|
||||
if request.Key == "" {
|
||||
request.Key = "server.properties"
|
||||
|
||||
Reference in New Issue
Block a user