Skip to content

[Audit] Sanitize Error.message in API error responses #447

Description

@RaminNietzsche

Background

Error responses leak implementation detail.

Problem

Multiple handlers return raw Error.message to clients (K8s discovery, OPA/policy, jobs, tenants, SBOM) — exposing cluster URLs, kube errors, driver strings.

Proposed solution

  • Shared toPublicError(err) mapping to stable codes + generic messages
  • Log full error server-side only
  • Audit handlers for err.message passthrough

Acceptance criteria

  • 5xx/502 bodies lack stack/host/path internals
  • Tests assert sanitized messages for representative handlers

Priority

P1 / Medium

Complexity

Small

Evidence

server/handlers/k8sDiscoveryHandlers.ts, policyHandlers.ts, jobHandlers.ts, tenantHandlers.ts, sbomHandlers.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    backendbugSomething isn't workingsecuritySecurity hardening

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions