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

Updating base64 to 0.12 #21

Merged
merged 1 commit into from
Jun 8, 2020
Merged

Updating base64 to 0.12 #21

merged 1 commit into from
Jun 8, 2020

Conversation

mettke
Copy link
Contributor

@mettke mettke commented Jun 7, 2020

I had to split them. I underestimated the changes made to base64.

base64 removed the whitespace stripping. However the
auther provides a code snippet on the RELEASE Page
which fixes that [1]
filter(|b| !b" \n\t\r\x0b\x0c".contains(b).

Unfortunatly that introduces an additional allocation
which, however, also exited before but was inside
base64.

The change to the test is necessary as the error
detection was improved. Now it is necessary that the
invalid signature is made out of valid base64

@mettke
Copy link
Contributor Author

mettke commented Jun 7, 2020

Ok I had a look at the test failures and they only happen sometimes as rp sometimes returns base64 which does not conform to canonical encoding that requires flexible parsing to accept.

I did create an issue upstream openid-certification/oidctest#227 and we may either wait for that to get in or use Config::decode_allow_trailing_bits to get rid of this error and make the base64 decoding a bit more forgiving (as it currently is)

Copy link
Owner

@ramosbugs ramosbugs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for looking into this! my assumption is that if the OIDC certification tests are producing invalid trailing bits, then other libraries and implementations probably will as well. to ensure compatibility, I think we should maintain the current permissive parsing behavior (i.e., decode_allow_trailing_bits with the new version). I don't think there are any security implications from doing that.

src/core/jwk.rs Outdated Show resolved Hide resolved
src/jwt.rs Outdated Show resolved Hide resolved
base64 removed the whitespace stripping. However the
auther provides a code snippet on the RELEASE Page
which fixes that [1]
`filter(|b| !b" \n\t\r\x0b\x0c".contains(b)`.

Unfortunatly that introduces an additional allocation
which, however, also exited before but was inside
base64.

Furthermore forgiving base64 parsing was disabled
upstream by default. Therefore it was necessary to
reenable it
@mettke
Copy link
Contributor Author

mettke commented Jun 8, 2020

I added decode_allow_trailing_bits only to the methods for decoding. The encoding methods don't bother with it anyways

@codecov
Copy link

codecov bot commented Jun 8, 2020

Codecov Report

Merging #21 into master will decrease coverage by 0.00%.
The diff coverage is 78.12%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #21      +/-   ##
==========================================
- Coverage   79.55%   79.55%   -0.01%     
==========================================
  Files          16       16              
  Lines        3512     3531      +19     
==========================================
+ Hits         2794     2809      +15     
- Misses        718      722       +4     
Impacted Files Coverage Δ
src/types.rs 78.02% <40.00%> (+0.09%) ⬆️
src/jwt.rs 87.24% <78.57%> (-1.24%) ⬇️
src/core/jwk.rs 84.28% <90.90%> (+0.15%) ⬆️
src/core/mod.rs 51.13% <100.00%> (+0.44%) ⬆️
src/registration.rs 72.36% <0.00%> (+0.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0ac753f...124d56c. Read the comment docs.

@ramosbugs ramosbugs merged commit c553a69 into ramosbugs:master Jun 8, 2020
@ramosbugs
Copy link
Owner

great work, thanks!

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