diff --git a/.circleci/config.yml b/.circleci/config.yml index d964c8da..a35a8a23 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -22,25 +22,7 @@ jobs: cargo fmt --all -- --check --color always cargo +nightly check -v --all-features - - cd ./examples/call_parameters/ - ./build.sh - - cd ../greeting/ - ./build.sh - - cd ../ipfs-node/ - ./build.sh - - cd ../records/ - ./build.sh - - cd ../url-downloader/ - ./build.sh - - cd ../../fluence-faas/tests/wasm_tests/ - - cd ../../ + (cd ./examples; ./build.sh) cargo +nightly test --release -v --all-features cargo +nightly clippy -v diff --git a/.github/workflows/rust_audit.yml b/.github/workflows/rust_audit.yml new file mode 100644 index 00000000..2da1ee54 --- /dev/null +++ b/.github/workflows/rust_audit.yml @@ -0,0 +1,16 @@ +name: Security audit +on: + push: + paths: + - '**/Cargo.toml' + - '**/Cargo.lock' + workflow_dispatch: +jobs: + security_audit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - uses: actions-rs/audit-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + diff --git a/Cargo.lock b/Cargo.lock index 5edc83ec..53426878 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -735,7 +735,7 @@ dependencies = [ [[package]] name = "fluence" version = "0.2.11" -source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" +source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c" dependencies = [ "fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", "fluence-sdk-main 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", @@ -791,7 +791,7 @@ dependencies = [ [[package]] name = "fluence-sdk-macro" version = "0.2.11" -source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" +source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c" dependencies = [ "fluence-sdk-wit 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", ] @@ -810,7 +810,7 @@ dependencies = [ [[package]] name = "fluence-sdk-main" version = "0.2.11" -source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" +source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c" dependencies = [ "fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", "log", @@ -834,7 +834,7 @@ dependencies = [ [[package]] name = "fluence-sdk-wit" version = "0.2.11" -source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" +source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c" dependencies = [ "proc-macro2", "quote", diff --git a/aquamarine-vm/src/aquamarine_stepper_vm.rs b/aquamarine-vm/src/aquamarine_stepper_vm.rs index bdc3a7a4..76cc7a00 100644 --- a/aquamarine-vm/src/aquamarine_stepper_vm.rs +++ b/aquamarine-vm/src/aquamarine_stepper_vm.rs @@ -137,7 +137,7 @@ fn make_faas_config( aquamarine_wasm_file: &str, call_service: HostImportDescriptor, current_peer_id: String, - logging_mask: i64, + logging_mask: i32, ) -> FaaSConfig { use fluence_faas::FaaSModuleConfig; use maplit::hashmap; diff --git a/aquamarine-vm/src/config.rs b/aquamarine-vm/src/config.rs index d7b1f098..cede41d4 100644 --- a/aquamarine-vm/src/config.rs +++ b/aquamarine-vm/src/config.rs @@ -33,5 +33,5 @@ pub struct AquamarineVMConfig { pub particle_data_store: PathBuf, /// Mask used to filter logs, for details see `log_utf8_string` in fluence-faas. - pub logging_mask: i64, + pub logging_mask: i32, } diff --git a/examples/build.sh b/examples/build.sh new file mode 100755 index 00000000..b6bf34eb --- /dev/null +++ b/examples/build.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -euo pipefail + +for dir in ./*; do + # skip non-directory entries + [ -d "$dir" ] || continue + + # skip if there's no build.sh in the directory + [ -e "$dir/build.sh" ] || continue + + (cd "$dir"; ./build.sh) +done + diff --git a/examples/call_parameters/artifacts/call_parameters.wasm b/examples/call_parameters/artifacts/call_parameters.wasm index 530f08f2..cd312333 100755 Binary files a/examples/call_parameters/artifacts/call_parameters.wasm and b/examples/call_parameters/artifacts/call_parameters.wasm differ diff --git a/examples/greeting/Cargo.toml b/examples/greeting/Cargo.toml index 65fba386..8f7b7b3c 100644 --- a/examples/greeting/Cargo.toml +++ b/examples/greeting/Cargo.toml @@ -9,4 +9,4 @@ name = "greeting" path = "src/main.rs" [dependencies] -fluence = { git = "https://github.com/fluencelabs/rust-sdk", features = ["debug"] } +fluence = { git = "https://github.com/fluencelabs/rust-sdk" } diff --git a/examples/greeting/Config.toml b/examples/greeting/Config.toml index 65225fb7..2e740e3d 100644 --- a/examples/greeting/Config.toml +++ b/examples/greeting/Config.toml @@ -3,4 +3,4 @@ modules_dir = "artifacts/" [[module]] name = "greeting" mem_pages_count = 1 - logger_enabled = true + logger_enabled = false diff --git a/examples/greeting/artifacts/greeting.wasm b/examples/greeting/artifacts/greeting.wasm index e1a8e90f..1d864704 100755 Binary files a/examples/greeting/artifacts/greeting.wasm and b/examples/greeting/artifacts/greeting.wasm differ diff --git a/examples/ipfs-node/artifacts/ipfs_effector.wasm b/examples/ipfs-node/artifacts/ipfs_effector.wasm index 65a6fca9..f5c0ca6e 100755 Binary files a/examples/ipfs-node/artifacts/ipfs_effector.wasm and b/examples/ipfs-node/artifacts/ipfs_effector.wasm differ diff --git a/examples/ipfs-node/artifacts/ipfs_pure.wasm b/examples/ipfs-node/artifacts/ipfs_pure.wasm index 45bab743..f7ef504b 100755 Binary files a/examples/ipfs-node/artifacts/ipfs_pure.wasm and b/examples/ipfs-node/artifacts/ipfs_pure.wasm differ diff --git a/examples/records/artifacts/records_effector.wasm b/examples/records/artifacts/records_effector.wasm index fadf955b..645a3a78 100755 Binary files a/examples/records/artifacts/records_effector.wasm and b/examples/records/artifacts/records_effector.wasm differ diff --git a/examples/records/artifacts/records_pure.wasm b/examples/records/artifacts/records_pure.wasm index 8f924273..2a6e6a34 100755 Binary files a/examples/records/artifacts/records_pure.wasm and b/examples/records/artifacts/records_pure.wasm differ diff --git a/examples/sqlite/artifacts/sqlite_test.wasm b/examples/sqlite/artifacts/sqlite_test.wasm index e17e9c51..e3504cbe 100755 Binary files a/examples/sqlite/artifacts/sqlite_test.wasm and b/examples/sqlite/artifacts/sqlite_test.wasm differ diff --git a/examples/url-downloader/artifacts/curl_adapter.wasm b/examples/url-downloader/artifacts/curl_adapter.wasm index cd150ea8..8983439d 100755 Binary files a/examples/url-downloader/artifacts/curl_adapter.wasm and b/examples/url-downloader/artifacts/curl_adapter.wasm differ diff --git a/examples/url-downloader/artifacts/facade.wasm b/examples/url-downloader/artifacts/facade.wasm index 866cdfcf..ded2a35d 100755 Binary files a/examples/url-downloader/artifacts/facade.wasm and b/examples/url-downloader/artifacts/facade.wasm differ diff --git a/examples/url-downloader/artifacts/local_storage.wasm b/examples/url-downloader/artifacts/local_storage.wasm index 5d95d5cf..e9a1d9a0 100755 Binary files a/examples/url-downloader/artifacts/local_storage.wasm and b/examples/url-downloader/artifacts/local_storage.wasm differ diff --git a/fluence-faas/src/config.rs b/fluence-faas/src/config.rs index 1982c22c..4dd727e0 100644 --- a/fluence-faas/src/config.rs +++ b/fluence-faas/src/config.rs @@ -49,7 +49,7 @@ pub struct FaaSModuleConfig { pub wasi: Option, /// Mask used to filter logs, for details see `log_utf8_string` - pub logging_mask: i64, + pub logging_mask: i32, } impl FaaSModuleConfig { diff --git a/fluence-faas/src/logger/log_utf8_string_impl.rs b/fluence-faas/src/logger/log_utf8_string_impl.rs index 02b992c8..b1f4181b 100644 --- a/fluence-faas/src/logger/log_utf8_string_impl.rs +++ b/fluence-faas/src/logger/log_utf8_string_impl.rs @@ -18,9 +18,9 @@ use wasmer_core::vm::Ctx; use wasmer_core::memory::ptr::{Array, WasmPtr}; pub(crate) fn log_utf8_string_closure( - logging_mask: i64, + logging_mask: i32, module: String, -) -> impl Fn(&mut Ctx, i32, i64, i32, i32) { +) -> impl Fn(&mut Ctx, i32, i32, i32, i32) { move |ctx, level, target, msg_offset, msg_size| { if target == 0 || target & logging_mask != 0 { log_utf8_string(&module, ctx, level, msg_offset, msg_size) diff --git a/fluence-faas/src/raw_toml_config.rs b/fluence-faas/src/raw_toml_config.rs index 5cd8ee9f..6fdc9579 100644 --- a/fluence-faas/src/raw_toml_config.rs +++ b/fluence-faas/src/raw_toml_config.rs @@ -115,7 +115,7 @@ pub struct TomlFaaSModuleConfig { pub logger_enabled: Option, pub wasi: Option, pub mounted_binaries: Option, - pub logging_mask: Option, + pub logging_mask: Option, } impl TomlFaaSNamedModuleConfig { @@ -182,7 +182,7 @@ pub fn from_toml_module_config(config: TomlFaaSModuleConfig) -> Result