这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@timothycarambat
Copy link
Member

Pull Request Type

  • ✨ feat
  • 🐛 fix
  • ♻️ refactor
  • 💄 style
  • 🔨 chore
  • 📝 docs

Relevant Issues

resolves #xxx

What is in this change?

As a convenience, we have always just included the plaintext password in the JWT so we can quickly compare with requests on the backend. While this does work and is mostly safe, if for whatever reason, the JWT was taken from the user's browser, then it could be used to directly login to the instance without needing to do a JWT replay.

This is very unlikely and only applies to single-user instances that are using simple password protection.

Now, we encrypt and decrypt this p value in the JWT, as a consequence any currently logged-in sessions under these conditions will be logged out as their previous token will not pass validation. All that needs to be done is for the user to log back in to get a compliant token.

@timothycarambat timothycarambat marked this pull request as ready for review August 14, 2024 00:54
@timothycarambat timothycarambat merged commit 4430ddb into master Aug 14, 2024
@timothycarambat timothycarambat deleted the encrypt-jwt-value branch August 14, 2024 00:54
cabwds pushed a commit to cabwds/anything-llm that referenced this pull request Jul 3, 2025
* wip encrypting jwt value

* Encrypt/Decrypt pass in JWT value for verification in single-user password mode
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