Skip to content

Commit bd8b9a3

Browse files
committed
fix(router): use klog.Warningf for session target mismatch logs
Security-relevant events (missing metadata, session target mismatch) must be visible in production logs at all times. Promote both log lines from klog.V(2).InfoS (verbose/debug) to klog.Warningf so they are captured without enabling verbose logging. Addresses code review feedback from gemini-code-assist. Signed-off-by: KinshukSS2 <kinshuk380@gmail.com>
1 parent 7b5430b commit bd8b9a3

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

pkg/router/session_manager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,11 @@ func sessionTargetMatches(sandbox *types.SandboxInfo, sessionID, namespace, name
131131
missingFields = append(missingFields, "sandboxNamespace")
132132
}
133133
if len(missingFields) > 0 {
134-
klog.V(2).InfoS("Session target metadata missing", "sessionID", sessionID, "requestedNamespace", namespace, "requestedName", name, "requestedKind", kind, "missingFields", strings.Join(missingFields, ","))
134+
klog.Warningf("Session target metadata missing for sessionID=%s: missing fields [%s] (requested namespace=%s name=%s kind=%s)", sessionID, strings.Join(missingFields, ","), namespace, name, kind)
135135
return false
136136
}
137137
if sandbox.WorkloadKind != kind || sandbox.WorkloadName != name || sandbox.SandboxNamespace != namespace {
138-
klog.V(2).InfoS("Session target mismatch", "sessionID", sessionID, "requestedNamespace", namespace, "requestedName", name, "requestedKind", kind, "actualNamespace", sandbox.SandboxNamespace, "actualWorkloadName", sandbox.WorkloadName, "actualWorkloadKind", sandbox.WorkloadKind)
138+
klog.Warningf("Session target mismatch for sessionID=%s: requested namespace=%s name=%s kind=%s but session belongs to namespace=%s name=%s kind=%s", sessionID, namespace, name, kind, sandbox.SandboxNamespace, sandbox.WorkloadName, sandbox.WorkloadKind)
139139
return false
140140
}
141141
return true

0 commit comments

Comments
 (0)