Skip to content

Commit

Permalink
feat: add feature to skip body verifiction (dfinity#21)
Browse files Browse the repository at this point in the history
For now we want to skip body verification.
  • Loading branch information
Daniel-Bloom-dfinity authored Feb 27, 2022
1 parent 5967469 commit f478258
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Release

on:
workflow_dispatch:
push:
branches:
- main
Expand Down Expand Up @@ -55,14 +56,14 @@ jobs:
cargo install cargo-deb --target x86_64-unknown-linux-musl
echo "1.55.0" >./rust-toolchain
rustup target add x86_64-unknown-linux-musl
RUSTFLAGS="--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" cargo deb --target x86_64-unknown-linux-musl -- --locked
RUSTFLAGS="--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" cargo deb --target x86_64-unknown-linux-musl -- --locked --features=skip_body_verification
if: contains(matrix.target, 'linux-musl')

- name: Linux build (gnu)
env:
RUSTFLAGS: --remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity
run: |
cargo build --locked --release --target x86_64-unknown-linux-gnu
cargo build --locked --release --target x86_64-unknown-linux-gnu --features=skip_body_verification
cd ${{ matrix.binary_path }}
ldd icx-proxy
if: contains(matrix.target, 'linux-gnu')
Expand All @@ -71,7 +72,7 @@ jobs:
env:
RUSTFLAGS: --remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity
run: |
cargo build --locked --release
cargo build --locked --release --features=skip_body_verification
cd target/release
otool -L icx-proxy
if: contains(matrix.os, 'macos')
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ slog = { version = "2.7.0", features = ["max_level_trace"] }
slog-async = "2.7.0"
slog-term = "2.8.0"
url = "2.2.1"

[features]
skip_body_verification = []
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,8 @@ async fn forward_request(
// Canisters don't have to provide certified variables
(None, None) => true,
};
if !body_valid {

if !body_valid && !cfg!(feature = "skip_body_verification") {
return Ok(Response::builder()
.status(StatusCode::INTERNAL_SERVER_ERROR)
.body("Body does not pass verification".into())
Expand Down

0 comments on commit f478258

Please sign in to comment.