You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(security): replace str(e) and user-input echoes in HTTP responses with static messages (#5918)
* test: add security tests for stack-trace exposure and reflective-xss patterns
Covers all three antipatterns: static message enforcement for str(e) in
HttpResponse* bodies (Pattern 1), no echo of user-supplied values in 4xx
bodies (Pattern 2), and static strings in change errors lists (Pattern 3).
Also includes tests for channel and user viewset error list staticness.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): replace str(e) and user-input echo in views/internal.py response bodies
Replaces all Pattern 1 (str(e) in HttpResponse* bodies) and Pattern 2
(user-input formatted into HttpResponse* bodies) antipatterns across all
affected handlers in views/internal.py. Static messages replace dynamic
content; handle_server_error or logger.warning/exception retains diagnostic
detail server-side. Also converts one raise HttpResponseBadRequest to return.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): add content_type=text/plain and remove user-input echo from views/base, views/users, views/nodes
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): replace str(e) in viewsets/base.py change error lists and JSON error body with static messages (patterns 1+3)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): replace str(e) in viewsets/contentnode.py, channel.py, user.py error lists with static messages (pattern 3)
Fixes Pattern 3 across all remaining viewsets. Also chains ValidationError
with from e in validate_completion_criteria, and normalises the
_handle_relationship_changes error value to a list for consistency.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): drop str(exc) from pagination NotFound message to prevent exception text leakage
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(security): propagate ValidationError detail in publish_next_from_changes
ValidationError messages like "Channel is not ready to be published" are
intentional user-facing validation messages, not internal exception details.
Split the except clause so ValidationError propagates e.detail while generic
Exception still returns a static "Internal server error".
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
* fix(review): address rtibbles feedback — remove tests, fix pagination, improve IntegrityError message
- Remove added test classes: reviewer notes CodeQL alert review makes them
redundant
- pagination.py: restore self.invalid_page_message template usage, replace
str(exc) with static "Invalid page", chain with raise...from exc
- contentnode.py: use specific "Relationship already exists" message for
IntegrityError in _handle_relationship_changes instead of generic
"Internal server error"
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments