Skip to content
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

Buddy JWT doesn't support the NONE algorithm #90

Open
vincentjames501 opened this issue Jun 19, 2023 · 0 comments
Open

Buddy JWT doesn't support the NONE algorithm #90

vincentjames501 opened this issue Jun 19, 2023 · 0 comments

Comments

@vincentjames501
Copy link

It would be nice if buddy supported the NONE algorithm to just implement the spec. I fully understand closing this since use of the NONE algorithm is discouraged and can lead to vulnerabilities if not careful though but I don't think the way buddy is currently implemented that it would be problematic as someone would explicitly need to pass {:alg :none} into the options for both signing and "unsigning".

(-> {:foo "bar"}
    (jwt/sign nil {:alg :none})
    (jwt/unsign nil {:alg :none}))
=> {:foo "bar"}

Example workaround:

(extend-protocol buddy.sign.util/IKeyProvider
  nil
  (resolve-key [key header] nil))

(alter-var-root #'buddy.sign.jws/+signers-map+
                (constantly (assoc buddy.sign.jws/+signers-map+
                              :none
                              {:signer   (constantly (byte-array 0))
                               :verifier (fn [_authdata sig _key] (= (count sig) 0))})))
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

No branches or pull requests

1 participant