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

fix: use bitwise comparison for jwt validation errors #633

Merged
merged 2 commits into from
Nov 13, 2021

Conversation

narg95
Copy link
Contributor

@narg95 narg95 commented Oct 22, 2021

Issue

Reported by @mitar here

Description

Use bitwise comparison for validation errors instead of ==.

A JWT validation error can encode multiple errors in one instance, therefore a simple == is only effective on single errors, but not with multiple. A proper comparison must use bit masking if ( _ & _ ) != 0.
This PR finds and fixes the places where this comparison occurs.

Checklist

  • [x ] I have read the contributing guidelines
    and signed the CLA.
  • [x ] I have read the security policy.
  • [x ] I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got green light (please contact
    security@ory.sh) from the maintainers to push
    the changes.
  • [x ] I have added tests that prove my fix is effective or that my feature
    works.
  • [x ] I have added necessary documentation within the code base (if
    appropriate).

@narg95 narg95 requested a review from aeneasr as a code owner October 22, 2021 17:19
@narg95 narg95 changed the title use bitwise comparison for jwt validation errors fix: use bitwise comparison for jwt validation errors Oct 22, 2021
@narg95
Copy link
Contributor Author

narg95 commented Oct 22, 2021

@aeneasr gobuffalo/packr@1.22.0 package is reporting a vulnerability and the tests are failing see:

pkg:golang/github.com/gobuffalo/packr@1.22.0
1 known vulnerabilities affecting installed version

@james-d-elliott
Copy link
Contributor

@aeneasr gobuffalo/packr@1.22.0 package is reporting a vulnerability and the tests are failing see:

pkg:golang/github.com/gobuffalo/packr@1.22.0
1 known vulnerabilities affecting installed version

Looks like this was fixed in v2.3.2 / v1.30.0 / v1.26.0: gobuffalo/packr@f58136c

@aeneasr aeneasr merged commit 52ee93f into ory:master Nov 13, 2021
@aeneasr
Copy link
Member

aeneasr commented Nov 13, 2021

🙏

@mitar
Copy link
Contributor

mitar commented Nov 14, 2021

Thanks for doing a followup!

@narg95
Copy link
Contributor Author

narg95 commented Nov 15, 2021

You are welcome!

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.

4 participants