i64 -> i32 for 'target' in log_utf8_string (#49)

This commit is contained in:
Dima 2020-12-17 18:46:01 +03:00 committed by GitHub
parent 163036e409
commit 11674ee856
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
21 changed files with 44 additions and 32 deletions

View File

@ -22,25 +22,7 @@ jobs:
cargo fmt --all -- --check --color always cargo fmt --all -- --check --color always
cargo +nightly check -v --all-features cargo +nightly check -v --all-features
(cd ./examples; ./build.sh)
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 ../../
cargo +nightly test --release -v --all-features cargo +nightly test --release -v --all-features
cargo +nightly clippy -v cargo +nightly clippy -v

16
.github/workflows/rust_audit.yml vendored Normal file
View File

@ -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 }}

8
Cargo.lock generated
View File

@ -735,7 +735,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence" name = "fluence"
version = "0.2.11" version = "0.2.11"
source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c"
dependencies = [ dependencies = [
"fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", "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)", "fluence-sdk-main 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
@ -791,7 +791,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence-sdk-macro" name = "fluence-sdk-macro"
version = "0.2.11" version = "0.2.11"
source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c"
dependencies = [ dependencies = [
"fluence-sdk-wit 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", "fluence-sdk-wit 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
] ]
@ -810,7 +810,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence-sdk-main" name = "fluence-sdk-main"
version = "0.2.11" version = "0.2.11"
source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c"
dependencies = [ dependencies = [
"fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)", "fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
"log", "log",
@ -834,7 +834,7 @@ dependencies = [
[[package]] [[package]]
name = "fluence-sdk-wit" name = "fluence-sdk-wit"
version = "0.2.11" version = "0.2.11"
source = "git+https://github.com/fluencelabs/rust-sdk#8a2570bbc630b2a519aee146ac6c5a52d5afe6cd" source = "git+https://github.com/fluencelabs/rust-sdk#31dc0a30dfd05144439c63d3fc3aae93636de06c"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",

View File

@ -137,7 +137,7 @@ fn make_faas_config(
aquamarine_wasm_file: &str, aquamarine_wasm_file: &str,
call_service: HostImportDescriptor, call_service: HostImportDescriptor,
current_peer_id: String, current_peer_id: String,
logging_mask: i64, logging_mask: i32,
) -> FaaSConfig { ) -> FaaSConfig {
use fluence_faas::FaaSModuleConfig; use fluence_faas::FaaSModuleConfig;
use maplit::hashmap; use maplit::hashmap;

View File

@ -33,5 +33,5 @@ pub struct AquamarineVMConfig {
pub particle_data_store: PathBuf, pub particle_data_store: PathBuf,
/// Mask used to filter logs, for details see `log_utf8_string` in fluence-faas. /// Mask used to filter logs, for details see `log_utf8_string` in fluence-faas.
pub logging_mask: i64, pub logging_mask: i32,
} }

14
examples/build.sh Executable file
View File

@ -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

View File

@ -9,4 +9,4 @@ name = "greeting"
path = "src/main.rs" path = "src/main.rs"
[dependencies] [dependencies]
fluence = { git = "https://github.com/fluencelabs/rust-sdk", features = ["debug"] } fluence = { git = "https://github.com/fluencelabs/rust-sdk" }

View File

@ -3,4 +3,4 @@ modules_dir = "artifacts/"
[[module]] [[module]]
name = "greeting" name = "greeting"
mem_pages_count = 1 mem_pages_count = 1
logger_enabled = true logger_enabled = false

View File

@ -49,7 +49,7 @@ pub struct FaaSModuleConfig {
pub wasi: Option<FaaSWASIConfig>, pub wasi: Option<FaaSWASIConfig>,
/// Mask used to filter logs, for details see `log_utf8_string` /// Mask used to filter logs, for details see `log_utf8_string`
pub logging_mask: i64, pub logging_mask: i32,
} }
impl FaaSModuleConfig { impl FaaSModuleConfig {

View File

@ -18,9 +18,9 @@ use wasmer_core::vm::Ctx;
use wasmer_core::memory::ptr::{Array, WasmPtr}; use wasmer_core::memory::ptr::{Array, WasmPtr};
pub(crate) fn log_utf8_string_closure( pub(crate) fn log_utf8_string_closure(
logging_mask: i64, logging_mask: i32,
module: String, 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| { move |ctx, level, target, msg_offset, msg_size| {
if target == 0 || target & logging_mask != 0 { if target == 0 || target & logging_mask != 0 {
log_utf8_string(&module, ctx, level, msg_offset, msg_size) log_utf8_string(&module, ctx, level, msg_offset, msg_size)

View File

@ -115,7 +115,7 @@ pub struct TomlFaaSModuleConfig {
pub logger_enabled: Option<bool>, pub logger_enabled: Option<bool>,
pub wasi: Option<TomlWASIConfig>, pub wasi: Option<TomlWASIConfig>,
pub mounted_binaries: Option<toml::value::Table>, pub mounted_binaries: Option<toml::value::Table>,
pub logging_mask: Option<i64>, pub logging_mask: Option<i32>,
} }
impl TomlFaaSNamedModuleConfig { impl TomlFaaSNamedModuleConfig {
@ -182,7 +182,7 @@ pub fn from_toml_module_config(config: TomlFaaSModuleConfig) -> Result<FaaSModul
logger_enabled: config.logger_enabled.unwrap_or(true), logger_enabled: config.logger_enabled.unwrap_or(true),
host_imports: host_cli_imports, host_imports: host_cli_imports,
wasi, wasi,
logging_mask: config.logging_mask.unwrap_or(i64::max_value()), logging_mask: config.logging_mask.unwrap_or(i32::max_value()),
}) })
} }