Skip to content

security: structured logging + opaque error IDs (stop leaking str(e) in 500s)#115

Merged
imran31415 merged 1 commit into
imran31415:mainfrom
lzt0513:fix/security-structured-logging-error-ids
Jun 16, 2026
Merged

security: structured logging + opaque error IDs (stop leaking str(e) in 500s)#115
imran31415 merged 1 commit into
imran31415:mainfrom
lzt0513:fix/security-structured-logging-error-ids

Conversation

@lzt0513

@lzt0513 lzt0513 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Closes #110

Changes

  • \send_error_response\ now returns JSON with an opaque \error_id\ instead of \ ext/plain\ with leaked exception text
  • Full tracebacks are printed server-side, indexed by \error_id\ for log correlation
  • Added \send_client_error\ for 4xx responses (returns JSON without error_id)
  • \do_POST\ now catches \ValueError\ separately as 400 instead of 500
  • Other exception handlers use the updated \send_error_response\ which does not leak details

Acceptance criteria covered

  • 500 responses no longer leak str(e)/internal detail; they carry an error_id
  • The matching traceback is findable in logs by error_id
  • Client-input errors return 4xx, not 500

@imran31415

Copy link
Copy Markdown
Owner

Lgtm

@imran31415 imran31415 merged commit 902e819 into imran31415:main Jun 16, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(server): structured logging + opaque error IDs (stop leaking str(e) in 500s)

2 participants