Skip to content

fix: handle WebSocket connections in audit log exception handlers (M2-11023) - #2106

Merged
sricharan-varanasi merged 1 commit into
developfrom
fix/audit-fields-websocket-method
Jul 23, 2026
Merged

fix: handle WebSocket connections in audit log exception handlers (M2-11023)#2106
sricharan-varanasi merged 1 commit into
developfrom
fix/audit-fields-websocket-method

Conversation

@sricharan-varanasi

@sricharan-varanasi sricharan-varanasi commented Jul 23, 2026

Copy link
Copy Markdown
Contributor
  • Tests for the changes have been added
  • Related documentation has been added / updated
  • For new features, QA automation engineers have been tagged
  • OSS packages added to Curious open source credit page

📝 Description

🔗 Jira Ticket M2-11023

Fixes a crash in the user:session:invalid audit log handlers when authentication
fails on the /ws/alerts WebSocket.

http_audit_fields read the HTTP-only request.method, which a WebSocket does not
have - so an expired/invalid token on the alerts WebSocket raised AttributeError
inside the exception handler. The audit event was never recorded and the client's 401
was never sent.

Changes include:

  • http_audit_fields now accepts any HTTPConnection and omits http.request.method
    for WebSocket connections (the audit model already allows it to be null).
  • Widened the affected exception handlers to HTTPConnection so the types match what
    they actually receive at runtime.
  • Added a regression test covering the WebSocket auth-failure path.

✏️ Notes

No API/schema changes.

@divbzero divbzero left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Thank you @sricharan-varanasi.

@sricharan-varanasi
sricharan-varanasi force-pushed the fix/audit-fields-websocket-method branch from 9103858 to 017c05e Compare July 23, 2026 21:57
@sricharan-varanasi
sricharan-varanasi merged commit 2a415f3 into develop Jul 23, 2026
5 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.

2 participants