Harden PII and credential leakage across picker, chat, GitLab, bell, /clear - #1510
Open
daiv-agent[bot] wants to merge 1 commit into
Open
Harden PII and credential leakage across picker, chat, GitLab, bell, /clear#1510daiv-agent[bot] wants to merge 1 commit into
daiv-agent[bot] wants to merge 1 commit into
Conversation
…ay, GitLab uploads, bell dropdown, and /clear DAIV-Session: https://daivagent.com/dashboard/sessions/06af37a3-b34b-46b3-a5ef-edfa473f48c0/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This change hardens several surfaces against leaking PII or credentials. The user picker stops returning email addresses to any authenticated member; the chat relay sanitizes RUN_ERROR event messages before they are yielded (not just before persistence); the GitLab upload download validates and URL-encodes the attacker-influenced path so the PRIVATE-TOKEN cannot be sent to a traversed path or another host; the notifications bell only marks notifications read on HTMX requests; and the
/clearslash command no longer echoes raw exception text into the issue thread.Key Changes:
accounts/views.py,_user_picker_list.html,_avatar.html): droppedemailfrom the.only(...)queryset, removed theemail:field from theaddUser(...)click payload, and switched the avatar label toowner_label|default:user.name|default:user.emailwith the picker passingowner_label=u.username; the row's secondary line now showsu.usernameinstead ofu.email. Email is still matched on for search but never rendered.chat/api/streaming.py): the upstreamRunErrorEventis now rewritten to a sanitizedRunErrorEventcarryingRUN_FAILED_MESSAGEbefore it is yielded, so a reader that rejoins the run via the relay never receives the raw exception text (previously only the persistedRun.error_messagewas sanitized).codebase/clients/gitlab/client.py): added_safe_gitlab_upload_path, which rejects control characters, schemes/netlocs (absolute or protocol-relative URLs), non-/uploads/prefixes, and..segments, and URL-encodes each segment so encoded traversal (%2e%2e) stays literal.get_project_uploaded_filenow uses the safe path and returnsNone(with a warning) when unsafe.notifications/views.py):Notification.mark_all_read_fornow runs only when the request carries theHX-Requestheader (is_htmx), so a plain GET (prefetch, top-level navigation, crawler) no longer silently clears the unread badge./clearexception handling (slash_commands/actions/clear.py): the failure reply is now a fixed generic message instead of interpolating the raw exception text, which could embed host- or credential-bearing URLs.test_picker_view.py,test_streaming.py,test_client.py(parametrized_safe_gitlab_upload_pathcases plus async download tests),test_nav_publishers.py,test_views_bell.py, andtest_clear.pyasserting the raw values never leak.💡 Instructions for the reviewer: