after logout the access token is still valid #22004

Open
opened 2026-02-21 20:15:13 -05:00 by yindo · 1 comment
Owner

Originally created by @fatelei on GitHub (Jan 31, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.11.4

Cloud or Self Hosted

Cloud, Self Hosted (Docker)

Steps to reproduce

  1. logout from dify
  2. use the access token to visit api
  3. it worked

✔️ Expected Behavior

after logout, the access token is invalid

Actual Behavior

after logout, the access token is still valid

Originally created by @fatelei on GitHub (Jan 31, 2026). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.11.4 ### Cloud or Self Hosted Cloud, Self Hosted (Docker) ### Steps to reproduce 1. logout from dify 2. use the access token to visit api 3. it worked ### ✔️ Expected Behavior after logout, the access token is invalid ### ❌ Actual Behavior after logout, the access token is still valid
yindo added the 🐞 bug label 2026-02-21 20:15:13 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Jan 31, 2026):

This is a known security issue in Dify v1.11.4: logging out only clears the access token from the browser (cookie or local storage), but does not invalidate or revoke the token on the server. As a result, any access token issued before logout remains valid until it expires, and can still be used to access the API if intercepted or reused elsewhere. This behavior is confirmed in the codebase and is not the intended secure behavior—there is no server-side token revocation or blacklist for general access tokens after logout. Only email-code login tokens have explicit revocation logic. See the relevant implementation and discussion here.

Until a fix is implemented, the only mitigation is to reduce the access token lifetime by lowering the ACCESS_TOKEN_EXPIRE_MINUTES setting in your environment configuration, so tokens expire more quickly if leaked or reused after logout. There is currently no built-in way to force server-side invalidation of access tokens on logout in Dify v1.11.4.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Jan 31, 2026): <!-- Answer --> This is a known security issue in Dify v1.11.4: logging out only clears the access token from the browser (cookie or local storage), but does not invalidate or revoke the token on the server. As a result, any access token issued before logout remains valid until it expires, and can still be used to access the API if intercepted or reused elsewhere. This behavior is confirmed in the codebase and is not the intended secure behavior—there is no server-side token revocation or blacklist for general access tokens after logout. Only email-code login tokens have explicit revocation logic. See the relevant implementation and discussion [here](https://github.com/langgenius/dify/blob/b8cb5f5ea250ca6d14c46b80d497d6aa30bacab2/api/controllers/web/login.py#L59-L161). Until a fix is implemented, the only mitigation is to reduce the access token lifetime by lowering the `ACCESS_TOKEN_EXPIRE_MINUTES` setting in your environment configuration, so tokens expire more quickly if leaked or reused after logout. There is currently no built-in way to force server-side invalidation of access tokens on logout in Dify v1.11.4. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/cfcad318-c4c3-4abd-9d9e-ff0b9bb5a38c?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=This%20is%20a%20known%20security%20issue%20in%20Dify%20v1.11.4%3A%20logging%20out%20only%20clears%20the%20access%20token%20from%20the%20browser%20%28cookie%20or%20local%20storage%29%2C%20but%20does%20not%20invalidate%20or%20revoke%20the%20token%20on%20the%20server.%20As%20a%20result%2C%20any%20access%20token%20issued%20before%20logout%20remains%20valid%20until%20it%20expires%2C%20and%20can%20still%20be%20used%20to%20access%20the%20API%20if%20intercepted%20or%20reused%20elsewhere.%20This%20behavior%20is%20confirmed%20in%20the%20codebase%20and%20is%20not%20the%20intended%20secure%20behavior%E2%80%94there%20is%20no%20server-side%20token%20revocation%20or%20blacklist%20for%20general%20access%20tokens%20after%20logout.%20Only%20email-code%20login%20tokens%20have%20explicit%20revocation%20logic.%20See%20the%20relevant%20implementation%20and%20discussion%20%5Bhere%5D%28https%3A//github.com/langgenius/dify/blob/b8cb5f5ea250ca6d14c46b80d497d6aa30bacab2/api/controllers/web/login.py%23L59-L161%29.%0A%0AUntil%20a%20fix%20is%20implemented%2C%20the%20only%20mitigation%20is%20to%20reduce%20the%20access%20token%20lifetime%20by%20lowering%20the%20%60ACCESS_TOKEN_EXPIRE_MINUTES%60%20setting%20in%20your%20environment%20configuration%2C%20so%20tokens%20expire%20more%20quickly%20if%20leaked%20or%20reused%20after%20logout.%20There%20is%20currently%20no%20built-in%20way%20to%20force%20server-side%20invalidation%20of%20access%20tokens%20on%20logout%20in%20Dify%20v1.11.4.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/31793)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#22004