-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat(xsnap): Base64 C bindings' #3817
Conversation
security considerations += expands the scope of the upcoming memory safety audit (#2466). @jessysaurusrex In that scoping meeting, I said we use only the xs interpreter code and not the modules. But we started pulling in modules with #3797 . We plan to use sha512 (#3512 ) as well. |
@@ -50,6 +51,61 @@ test('simple TextEncoder / TextDecoder are available', async t => { | |||
t.deepEqual(opts.messages, ['"Hello! 😊"', '"A\\u0000A"']); | |||
}); | |||
|
|||
test('Base64.encode', async t => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for the other FFI bindings, we test that they are only available in the start compartment.
When adding Base64, we should probably refactor those tests to just handle a list of things.
b057b0d
to
5d00dd3
Compare
nit: for the 2 submodule updates, I suggest Only "Add Base64 C bindings" is a feat that I would expect to see in the xsnap release notes. |
fb97ee1
to
5d242b6
Compare
9a4e51f
to
492c3e5
Compare
492c3e5
to
8a17a77
Compare
refs: #2682
Description
This change adds a Base64 namespace with encode and decode functions.
A pure JavaScript Base 64 codec performs very poorly on XS.
Decoding 400KB is a common load for a Base 64 encoded Agoric zip archive source bundle,
and takes about an hour to decode in
xsnap
.This change surfaces XSnap bindings for Base 64 based on Moddables existing module.
agoric-labs/xsnap-pub#4
Security Considerations
XSnap does not harden the Base64 namespace object.
It should be hardened before introduction to a compartment as an endowment.
Documentation Considerations
This should be transparent to users.
Subsequent work in
@endo/base64
will harness this API if it is present on theglobal object and work around one known defect by having a fast path for empty
input.
Testing Considerations
This change adds the new Base64 and existing TextEncoder and TextDecoder to the
XSnap REPL so reviewers can fiddle with it using
yarn repl
in thexsnap
package.
This includes a failing test, where an empty command buffer, Base64 encoded,
then UTF-8 encoded, effects a detached buffer error.
We can work-around this in
@endo/base64
for now.