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

[5.0 -> main] Fix base64 encoding - take 2 #1893

Merged
merged 7 commits into from
Nov 13, 2023
Merged

Conversation

heifner
Copy link
Member

@heifner heifner commented Nov 13, 2023

#1482 fixed base64 encoding by removing the unneeded extra = that variant added to base64 encoded data. However, it also updated the base64 library with a stricter one. This PR leaves the old base64 encoding/decoding library but does remove the extra = from the base64 encoded data so non-fc base64 decoders will not claim the data is invalid.

This change still breaks backward compatibility with 3.2 & 4.0 cleos/nodeos. PRs to 3.2 (#1889) and 4.0 will be created that will allow them to work with this new base64 encoding (they will no longer expect the invalid = character).

PR #1886 reverts #1482. This PR provided an alternative fix for #1461.

Included in this PR is an optimization to the existing base64_decode to avoid a copy for our use-cases by returning a vector<char> instead of a string.
Included in this PR is a change to the nodeos_run_test.py to keep the keosd running with passed --leaving-running which is useful for local testing. This was used to manually test using 3.2 cleos with 5.0.

Merges release/5.0 into main including #1888

Resolves #1461

@heifner heifner added the OCI Work exclusive to OCI team label Nov 13, 2023
Comment on lines 30 to 31
std::string b64_str(b64.begin(), b64.end());
BOOST_CHECK_EQUAL(expected_output, b64_str);
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, not a required change, just a suggestion for here and the few next instances of the same pattern.

Suggested change
std::string b64_str(b64.begin(), b64.end());
BOOST_CHECK_EQUAL(expected_output, b64_str);
BOOST_CHECK_EQUAL(std::string_view(expected_output), std::string_view(b64.begin(), b64.end()));

@heifner heifner merged commit f4b7ace into main Nov 13, 2023
29 checks passed
@heifner heifner deleted the GH-1461-base64-pad-main branch November 13, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid Base64 padding returned by APIs
3 participants