Stop leaking internal error details to API clients #18
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Internal error details (stack traces, SQL errors, file paths) are returned directly to clients:
gin.H{"error": err.Error()}— exposes Go runtime errors to external callersHTTPException(detail=str(e))— exposes SQLAlchemy, psycopg2, and internal service errorsThis aids attackers in fingerprinting the stack and crafting targeted exploits.
Required Actions
main.py:httperr.Writevariant that logs the full error internally and returns a sanitized message externally — thehttperrpackage inai-compliance-sdk/internal/platform/httperr/should be updateddetail=str(e)for domain validation errors (422) where the message is safe and user-facingAcceptance Criteria
curl -X POST /api/v1/controls -d 'invalid'returns{"detail": "Internal server error"}, not a stack tracerequest_idfor correlation