🐛 Sanitize error responses in kc-agent HTTP handlers#13395
Conversation
Replace raw err.Error() strings in pkg/agent HTTP responses with generic messages to prevent leaking internal cluster state. Add sanitizeAgentError() for consistent classification across handlers and keep detailed errors in server-side slog output. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: Copilot <223556219+Copilot@users.noreply.github.com>
✅ Deploy Preview for kubestellarconsole canceled.
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
👋 Hey @kubestellar-hive[bot] — thanks for opening this PR!
This is an automated message. |
|
Thank you for your contribution! Your PR has been merged. Check out what's new:
Stay connected: Slack #kubestellar-dev | Multi-Cluster Survey |
|
Post-merge build verification passed ✅ Both Go and frontend builds compiled successfully against merge commit |
✅ Post-Merge Verification: passedCommit: |
Fixes #13394
Summary
Replace raw
err.Error()strings inpkg/agent/HTTP responses with generic messages to prevent leaking internal cluster state (API server URLs, kubeconfig paths, resource names, RBAC details).Changes
pkg/agent/error_sanitizer.go—sanitizeAgentError()helper that classifies k8s errors into safe categories (connection issues, RBAC, not-found, conflict, validation, generic)pkg/agent/— replaced rawerr.Error()and similar client-facing error details with sanitized messagesslog.Error()/existing logs for debuggingError Classification