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 strict_base64 for shared strings #5985

Merged
merged 1 commit into from Dec 3, 2019
Merged

fix strict_base64 for shared strings #5985

merged 1 commit into from Dec 3, 2019

Conversation

ahorek
Copy link
Contributor

@ahorek ahorek commented Nov 28, 2019

it fails for shared strings if begin != 0

require 'base64'
url = "data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFob3kuanMiXSwibmFtZXMiOlsiaGVsbG8iLCJ3b3JsZCJdLCJtYXBwaW5ncyI6IkFBQU0sU0FBU0EsUUFDUCxTQUFTQyxJQUNQLE9BQU8sRUFHVCxPQUFPQSxJQUFVQSIsInNvdXJjZXNDb250ZW50IjpbIiAgICAgIGZ1bmN0aW9uIGhlbGxvICgpIHtcbiAgICAgICAgZnVuY3Rpb24gd29ybGQgKCkge1xuICAgICAgICAgIHJldHVybiAyO1xuICAgICAgICB9O1xuXG4gICAgICAgIHJldHVybiB3b3JsZCgpICsgd29ybGQoKTtcbiAgICAgIH07XG4iXX0="

base = url.split(",").last
Base64.strict_decode64(base)

refs #5961

@kares kares merged commit af24ff7 into jruby:master Dec 3, 2019
5 checks passed
@kares kares added this to the JRuby 9.2.10.0 milestone Dec 3, 2019
@enebo
Copy link
Member

@enebo enebo commented Dec 3, 2019

@ahorek thanks for this fix. I noticed right before rubyconf something was not properly decoding CSRF tags but when I quickly looked we were decoding properly (which of course was because my new string was not shared and begin == 0). The number of times this lack of abstract has hurt us is a bloody affair.

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.

None yet

3 participants