Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.
Go agentagenticaichatbotdsh-pluginembeddingsevaluationgenerative-aigolangknowledge-basellmmulti-tenantollamaopenaiquestion-answeringragrerankingsemantic-searchvector-searchwiki
feat(auth): clear session resource caches on logout to prevent data leakage
wizardchen90f8e8b390da
diff --git a/frontend/src/stores/auth.ts b/frontend/src/stores/auth.tsindex 4170911be..4e2d0d091 100644--- a/frontend/src/stores/auth.ts+++ b/frontend/src/stores/auth.ts@@ -8,6 +8,16 @@ import { reloadFontFromStorage } from '@/composables/useFont'import { reloadThemeFromStorage } from '@/composables/useTheme'import { resetMigrationLatch } from '@/composables/preferenceStorage'import { BUILTIN_QUICK_ANSWER_ID } from '@/api/agent'+import { useChatResourcesStore } from '@/stores/chatResources'+import { useEditorResourcesStore } from '@/stores/editorResources'+import { useOrganizationStore } from '@/stores/organization'++/** 登出时丢弃 Pinia 内的租户级资源缓存,避免 SPA 重登复用上一账号数据。 */+function clearSessionResourceCaches() {+ useChatResourcesStore().invalidate()+ useEditorResourcesStore().invalidate()+ useOrganizationStore().clearState()+}// Per-user UI preferences are namespaced by user id in localStorage.// Reload them whenever the active user changes.@@ -380,6 +390,7 @@ export const useAuthStore = defineStore('auth', () => {allTenants.value = []memberships.value = []pendingInvitationCount.value = 0+ clearSessionResourceCaches()// 清空localStoragelocalStorage.removeItem('weknora_user')diff --git a/frontend/src/stores/editorResources.ts b/frontend/src/stores/editorResources.tsindex 4ea5a741c..ee9b02937 100644--- a/frontend/src/stores/editorResources.ts+++ b/frontend/src/stores/editorResources.ts@@ -170,9 +170,13 @@ export const useEditorResourcesStore = defineStore('editorResources', () => {tenantRetrievalConfig.value = nullparserEngines.value = []systemInfo.value = null+ inflight.clear()return}- keys.forEach((k) => delete loadedAt.value[k])+ keys.forEach((k) => {+ delete loadedAt.value[k]+ inflight.delete(k)+ })}return {