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(picky-wasm): [SECURITY] remove wee_alloc dependency #176

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 10 additions & 57 deletions ffi/wasm/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions ffi/wasm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "picky"
version = "0.4.0"
version = "0.4.1"
authors = ["Benoît CORTIER <bcortier@proton.me>"]
edition = "2021"
publish = false
Expand Down Expand Up @@ -35,13 +35,6 @@ serde_json = "1.0.82"
# code size when deploying.
console_error_panic_hook = { version = "0.1.7", optional = true }

# `wee_alloc` is a tiny allocator for wasm that is only ~1K in code size
# compared to the default allocator's ~10K. It is slower than the default
# allocator, however.
#
# Unfortunately, `wee_alloc` requires nightly Rust when targeting wasm for now.
wee_alloc = { version = "0.4.5", optional = true }

getrandom = { version = "0.2.7", features = ["js"] }

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions ffi/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This should be run in the CI.
2. Build the package:

```
$ wasm-pack build --target web --scope devolutions --out-name picky --features wee_alloc
$ wasm-pack build --target web --scope devolutions --out-name picky
```

3. Rename `@devolutions/picky-wasm` to `@devolutions/picky` in `pkg/package.json`.
Expand All @@ -34,7 +34,7 @@ Other tests are run using `nodejs` and the `ava` testing framework.
For these, you need to build the npm package targeting `nodejs`:

```
$ wasm-pack build --target nodejs --scope @devolutions --out-name picky --features wee_alloc
$ wasm-pack build --target nodejs --scope @devolutions --out-name picky
```

Rename `@devolutions/picky-wasm` to `@devolutions/picky` in `pkg/package.json`.
Expand Down
2 changes: 1 addition & 1 deletion ffi/wasm/publish.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

$ErrorActionPreference = "Stop"

wasm-pack build --target bundler --scope devolutions --out-name picky --features wee_alloc
wasm-pack build --target bundler --scope devolutions --out-name picky

if ($LastExitCode -ne 0)
{
Expand Down
6 changes: 0 additions & 6 deletions ffi/wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ pub mod pem;

use wasm_bindgen::prelude::*;

// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(festure = "wee_alloc")]
#[global_allocator]
static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;

#[wasm_bindgen(start)]
pub fn init_picky() -> Result<(), JsValue> {
// When the `console_error_panic_hook` feature is enabled, we can call the
Expand Down