mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-06 10:58:17 -05:00
[PR #19946] [CLOSED] feat: client-side chat encryption at rest + encrypted share links #64262
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/19946
Author: @dennishenry
Created: 12/14/2025
Status: ❌ Closed
Base:
dev← Head:add_encrypted_chats📝 Commits (9)
fe6783cMerge pull request #19030 from open-webui/devfc05e0aMerge pull request #19405 from open-webui/deve3faec6Merge pull request #19416 from open-webui/dev9899293Merge pull request #19448 from open-webui/dev140605eMerge pull request #19462 from open-webui/dev6f1486fMerge pull request #19466 from open-webui/dev84e10f9feat: client-side chat encryption at rest + encrypted share links4b4cca0Merge branch 'dev' into add_encrypted_chatsd66a7e9Update README.md📊 Changes
99 files changed (+4736 additions, -587 deletions)
View changed files
📝
.env.example(+8 -1)📝
backend/open_webui/env.py(+12 -0)📝
backend/open_webui/main.py(+10 -0)📝
backend/open_webui/models/chats.py(+120 -28)📝
backend/open_webui/models/users.py(+3 -1)📝
backend/open_webui/routers/auths.py(+14 -3)📝
backend/open_webui/routers/chats.py(+102 -4)➕
backend/open_webui/routers/encryption.py(+28 -0)📝
backend/open_webui/routers/users.py(+2 -0)📝
backend/open_webui/test/apps/webui/routers/test_auths.py(+29 -15)📝
backend/open_webui/test/apps/webui/routers/test_chats.py(+113 -2)➕
backend/open_webui/test/apps/webui/routers/test_encryption.py(+27 -0)📝
backend/open_webui/test/apps/webui/routers/test_models.py(+37 -20)📝
backend/open_webui/test/apps/webui/routers/test_prompts.py(+9 -9)📝
backend/open_webui/test/apps/webui/routers/test_users.py(+38 -25)📝
backend/open_webui/test/apps/webui/storage/test_provider.py(+206 -323)➕
backend/open_webui/test/conftest.py(+121 -0)📝
backend/open_webui/test/util/abstract_integration_test.py(+30 -8)📝
backend/open_webui/test/util/mock_user.py(+1 -1)📝
backend/open_webui/test/util/test_redis.py(+4 -4)...and 79 more files
📄 Description
Pull Request Checklist
devbranch. Not targeting thedevbranch will lead to immediate closure of the PR.Changelog Entry
Description
Implements chat encryption wherein chat content is encrypted in the browser and stored as ciphertext on the server/database. It's important to note that prompts are still sent in plaintext to the backend for model inference.
Added
GET /api/v1/encryption/policyendpoint:WEBUI_CHAT_ENCRYPTION_DEFAULTWEBUI_CHAT_ENCRYPTION_REQUIREDWEBUI_CHAT_ENCRYPTION_ALLOW_LEGACY_READis_encrypted_chat()helper and treat encrypted chats as opaque server-side (no message parsing/decryption); derive title/id frommeta{ enc, meta }payloads for chat create/import/update and enforce REQUIRED mode by rejecting plaintext writes with 409; optionally block legacy reads when REQUIRED and legacy reads are disabled{share, meta}) to be stored without server-side decryptionnew_passwordMAX_RETRY_COUNTfor testschatEncryptionEnabled,chatEncryptionUmkFingerprint)/s/<id>#k=...); share page decrypts via the fragment key and provides missing/invalid-key UX; cloning encrypted shares/chats happens client-side (decrypt → clone → re-encrypt as needed)conftest.py(opt-out viaOPEN_WEBUI_TEST_USE_EXISTING_DATABASE_URL=true)Changed
docs/chat-encryption.md,.env.example) and link from docs READMEformat:backendtoblack backend/to avoid formatting non-backend filesAdditional Information
Screenshots or Videos
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.