-
-
Notifications
You must be signed in to change notification settings - Fork 283
feat(lib): Add optional restrictions for JWT based on a specific header value #697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(lib): Add optional restrictions for JWT based on a specific header value #697
Conversation
I think this should be on by default and set to X-Real-Ip. |
Thanks, what an honor you think this should be set by default. |
…able after resolved conflicts
Is that not already done? Line 86 in 226cf36
|
Signed-off-by: Jason Cameron <[email protected]>
Do you mean something like that in the current main branch, @JasonLovesDoggo ? Not really unfortunately. This means that currently it is not possible to restrict the token to a specific attribute (e.g. SRC IP) and botnets could use this to their advantage. Nothing is easier than calling the website manually one and roll a cookie out on thousands of their bots. With the default vault of |
Due to the fact that it would be possible for a botnet to generate the JWT once and then roll it out on many bots, it would be nice if one can restrict the JWT to specific criteria.
With this change, one can define the
JWT_RESTRICTION_HEADER
setting which allows the token to only be valid if a specific header value is the same as it was during the creation of the token. Setting it toX-Real-IP
e.g. would restrict the token only to be valid for this one IP address.One can also add custom header using a reverse-proxy using a combined values of SRC-IP, User-Agent, TLS-Fingerprint etc to restrict the token even further. E.g. in HAProxy:
And then setting
JWT_RESTRICTION_HEADER=X-Custom-Anubis-Restriction
in Anubis.This may result in having to re-calculate the token when changing SRC-IPs for the user, but it might be necessary when dealing with an intelligent botnet.
SHA256 is being used as potentially sensitive information might be used for restrictions.
This is not a breaking change. If the setting is empty, then the behavior is as normal.
Checklist:
[Unreleased]
section of docs/docs/CHANGELOG.mdnpm run test:integration
(unsupported on Windows, please use WSL)