Skip to content

[mirror] fix(security): enforce document set access in search filters (#10602) to release v3.3#6

Open
yashwant86 wants to merge 1 commit intomm-base-10612from
mm-pr-10612
Open

[mirror] fix(security): enforce document set access in search filters (#10602) to release v3.3#6
yashwant86 wants to merge 1 commit intomm-base-10612from
mm-pr-10612

Conversation

@yashwant86
Copy link
Copy Markdown

@yashwant86 yashwant86 commented Apr 26, 2026

Mirror of upstream onyx-dot-app#10612 for benchmark. Do not merge.


Summary by MergeMonkey

  • Patched Up:
    • Enforce document set access control in search filters to prevent users from bypassing persona-configured document sets via API-layer override.

…t-app#10602)

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@bot-mergemonkey
Copy link
Copy Markdown

bot-mergemonkey Bot commented Apr 26, 2026

Risk AssessmentCRITICAL · ~15 min review

Focus areas: Document set access validation logic · Dual enforcement points (chat + pipeline) · Error propagation to streaming handler

Assessment: Fixes security bypass allowing users to override persona document set restrictions via API.

Walkthrough

User sends a chat message with internal_search_filters.document_set names. The system validates each name against the user's accessible document sets before setup or tool invocation. If any name is unauthorized or non-existent, an OnyxError is raised with INSUFFICIENT_PERMISSIONS, propagating to the streaming error handler. This prevents users from overriding persona-configured document sets.

Changes

Files Summary
Document Set Access Enforcement
backend/onyx/chat/process_message.py
backend/onyx/context/search/pipeline.py
backend/onyx/db/document_set.py
Adds document set access validation at two enforcement points: in chat message processing before tool invocation, and in search pipeline filter building. New helper function filters document set names by user view access, raising OnyxError if unauthorized names are detected.
Integration Tests
backend/tests/integration/tests/chat/test_chat_document_set_access.py
Adds comprehensive integration tests covering document set access enforcement: blocks unauthorized names, allows authorized names, permits public document sets, and rejects non-existent names to prevent enumeration.

Sequence Diagram

sequenceDiagram
    participant User
    participant ChatAPI as Chat API
    participant Validator as Access Validator
    participant DB as Database
    participant SearchPipeline as Search Pipeline
    User->>ChatAPI: send-chat-message with document_set filter
    ChatAPI->>Validator: _stream_chat_turn (check filters)
    Validator->>DB: filter_document_set_names_by_user_access
    DB-->>Validator: accessible_names
    alt Unauthorized names found
        Validator-->>ChatAPI: raise OnyxError (INSUFFICIENT_PERMISSIONS)
        ChatAPI-->>User: StreamingError in response
    else All names authorized
        ChatAPI->>SearchPipeline: _build_index_filters
        SearchPipeline->>DB: filter_document_set_names_by_user_access (second check)
        DB-->>SearchPipeline: accessible_names
        SearchPipeline-->>ChatAPI: validated filters
        ChatAPI-->>User: proceed with search
    end
Loading

Dig Deeper With Commands

  • /review <file-path> <function-optional>
  • /chat <file-path> "<question>"
  • /roast <file-path>

Runs only when explicitly triggered.

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