[PR #15458] feat: Add File Decryption Feature with Admin Panel Configuration and Enhanced Upload Workflow #23841

Open
opened 2026-04-20 05:04:29 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/15458
Author: @decent-engineer-decent-datascientist
Created: 7/1/2025
Status: 🔄 Open

Base: devHead: dev-add-encryption


📝 Commits (1)

  • 5788293 updated decryption patch to 0.6.18

📊 Changes

6 files changed (+191 additions, -1 deletions)

View changed files

📝 backend/open_webui/config.py (+22 -0)
📝 backend/open_webui/main.py (+10 -0)
📝 backend/open_webui/routers/retrieval.py (+38 -0)
📝 backend/open_webui/storage/provider.py (+33 -0)
📝 src/lib/components/admin/Settings/Documents.svelte (+68 -0)
📝 src/lib/components/chat/MessageInput.svelte (+20 -1)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources? (Work In Progress)
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

This pull request introduces a new feature that allows for the decryption of uploaded files via an external Azure function endpoint. When enabled, files are decrypted immediately after upload and before being processed by the RAG pipeline. The decrypted content then replaces the original encrypted file. This feature is configurable through new settings in the admin panel. This is a mandatory feature for Open WebUI to be leveraged in organizations that have Microsoft's AIP/MIP enabled. https://learn.microsoft.com/en-us/azure/information-protection/what-is-information-protection

Added

  • File Decryption Feature: Added an optional file decryption step in the file upload process.
  • Azure Decryption Utility: Created a new utility module open_webui/utils/decryption.py to handle the communication with an Azure function for file decryption.
  • Configuration Settings: Introduced new configuration variables for enabling decryption, setting the endpoint URL, API key, and timeout:
    • ENABLE_FILE_DECRYPTION
    • FILE_DECRYPTION_ENDPOINT
    • FILE_DECRYPTION_API_KEY
    • FILE_DECRYPTION_TIMEOUT
  • Admin UI for Decryption: Added a new section in the "Documents" settings page for administrators to configure the file decryption feature.
  • Frontend Notifications: Implemented toasts to notify the user about the decryption process, including loading and error states.

Changed

  • File Upload Workflow: Modified the file upload router (routers/files.py) to include the decryption logic. If enabled, it reads the uploaded file, sends it for decryption, and overwrites the original file with the decrypted content.
  • Error Handling: Enhanced error handling in the file upload process to catch and report decryption-specific failures.
  • API Configuration: Updated the RAG configuration endpoints (routers/retrieval.py) to get and update the new decryption settings.
  • Admin UI: In the Documents settings UI, input fields now have text-right alignment for a consistent look.
  • Frontend Config: The application config now includes a decryption_enabled flag to inform the frontend.
  • User Feedback: The file upload toast message now specifies when a file is being decrypted.

Removed

  • No features were removed in this pull request.

Fixed

  • This pull request does not focus on bug fixes.

Security

  • Sensitive Input: The API key for the decryption service is handled using a SensitiveInput component in the UI to mask its value.
  • Authentication: The decryption request to the Azure function is authenticated using an x-functions-key header.

Breaking Changes

  • No breaking changes are introduced in this pull request.

Additional Information

  • The new dependency requests is used in backend/open_webui/utils/decryption.py for making HTTP requests to the Azure function.
  • The feature requires an external Azure function to be set up. The endpoint and API key for this function must be configured in the Open WebUI admin settings for the feature to work.
  • A custom DecryptionError exception class was created to handle specific decryption-related failures gracefully.

Screenshots or Videos

image image

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/15458 **Author:** [@decent-engineer-decent-datascientist](https://github.com/decent-engineer-decent-datascientist) **Created:** 7/1/2025 **Status:** 🔄 Open **Base:** `dev` ← **Head:** `dev-add-encryption` --- ### 📝 Commits (1) - [`5788293`](https://github.com/open-webui/open-webui/commit/5788293d23ec7cca6cdf95c53b5b097b8c99fbc1) updated decryption patch to 0.6.18 ### 📊 Changes **6 files changed** (+191 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+22 -0) 📝 `backend/open_webui/main.py` (+10 -0) 📝 `backend/open_webui/routers/retrieval.py` (+38 -0) 📝 `backend/open_webui/storage/provider.py` (+33 -0) 📝 `src/lib/components/admin/Settings/Documents.svelte` (+68 -0) 📝 `src/lib/components/chat/MessageInput.svelte` (+20 -1) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. **Before submitting, make sure you've checked the following:** - [x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [x] **Description:** Provide a concise description of the changes made in this pull request. - [x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? _(Work In Progress)_ - [x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [x] **Testing:** Have you written and run sufficient tests to validate the changes? - [x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description This pull request introduces a new feature that allows for the decryption of uploaded files via an external Azure function endpoint. When enabled, files are decrypted immediately after upload and before being processed by the RAG pipeline. The decrypted content then replaces the original encrypted file. This feature is configurable through new settings in the admin panel. This is a mandatory feature for Open WebUI to be leveraged in organizations that have Microsoft's AIP/MIP enabled. https://learn.microsoft.com/en-us/azure/information-protection/what-is-information-protection ### Added - **File Decryption Feature**: Added an optional file decryption step in the file upload process. - **Azure Decryption Utility**: Created a new utility module `open_webui/utils/decryption.py` to handle the communication with an Azure function for file decryption. - **Configuration Settings**: Introduced new configuration variables for enabling decryption, setting the endpoint URL, API key, and timeout: - `ENABLE_FILE_DECRYPTION` - `FILE_DECRYPTION_ENDPOINT` - `FILE_DECRYPTION_API_KEY` - `FILE_DECRYPTION_TIMEOUT` - **Admin UI for Decryption**: Added a new section in the "Documents" settings page for administrators to configure the file decryption feature. - **Frontend Notifications**: Implemented toasts to notify the user about the decryption process, including loading and error states. ### Changed - **File Upload Workflow**: Modified the file upload router (`routers/files.py`) to include the decryption logic. If enabled, it reads the uploaded file, sends it for decryption, and overwrites the original file with the decrypted content. - **Error Handling**: Enhanced error handling in the file upload process to catch and report decryption-specific failures. - **API Configuration**: Updated the RAG configuration endpoints (`routers/retrieval.py`) to get and update the new decryption settings. - **Admin UI**: In the Documents settings UI, input fields now have `text-right` alignment for a consistent look. - **Frontend Config**: The application config now includes a `decryption_enabled` flag to inform the frontend. - **User Feedback**: The file upload toast message now specifies when a file is being decrypted. ### Removed - _No features were removed in this pull request._ ### Fixed - _This pull request does not focus on bug fixes._ ### Security - **Sensitive Input**: The API key for the decryption service is handled using a `SensitiveInput` component in the UI to mask its value. - **Authentication**: The decryption request to the Azure function is authenticated using an `x-functions-key` header. ### Breaking Changes - _No breaking changes are introduced in this pull request._ --- ### Additional Information - The new dependency `requests` is used in `backend/open_webui/utils/decryption.py` for making HTTP requests to the Azure function. - The feature requires an external Azure function to be set up. The endpoint and API key for this function must be configured in the Open WebUI admin settings for the feature to work. - A custom `DecryptionError` exception class was created to handle specific decryption-related failures gracefully. ### Screenshots or Videos - <img width="1295" alt="image" src="https://github.com/user-attachments/assets/0d2947ea-b14e-47c0-bde0-6604ada19880" /> <img width="677" alt="image" src="https://github.com/user-attachments/assets/2e23e9c2-e29e-4fc3-b022-bef73066c9a0" /> ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-20 05:04:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#23841