Skip to content

Commit

Permalink
Add subresource integrity
Browse files Browse the repository at this point in the history
  • Loading branch information
coinshot committed Oct 13, 2023
1 parent 4ecf373 commit c78844c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions build_wasm_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ cmake /src \

emmake make

# Add subresource integrity
SRI_HASH=$(cat arrow_wasm.wasm | openssl dgst -sha384 -binary | openssl base64 -A)
sed -i "s/\(fetch([a-zA-Z]\+, { credentials: 'same-origin'\)/\1, integrity: 'sha384-${SRI_HASH}'/g" arrow_wasm.js
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,5 @@ set(ASYNCIFY_CALL_STACK "
")
string(REGEX REPLACE "\n" "" ASYNCIFY_CALL_STACK "${ASYNCIFY_CALL_STACK}")

set_target_properties(arrow_wasm PROPERTIES LINK_FLAGS "--bind -g -Oz -s ENVIRONMENT='web' -s WASM=1 -s INITIAL_MEMORY=32MB -s ALLOW_MEMORY_GROWTH=1 -s ASYNCIFY=1 -s ASYNCIFY_STACK_SIZE=4096 -s ASYNCIFY_ADVISE=0 -s ASYNCIFY_IGNORE_INDIRECT=0 -s ASYNCIFY_ADD=\"[${ASYNCIFY_CALL_STACK}]\" -s FETCH=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ASSERTIONS=1 -s NO_EXIT_RUNTIME=1 -s FORCE_FILESYSTEM=1 -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -s MODULARIZE=1 -s EXPORT_NAME='Arrow' -s EXPORTED_RUNTIME_METHODS=\"['FS']\"")
set_target_properties(arrow_wasm PROPERTIES LINK_FLAGS "--bind -g -Oz -s ENVIRONMENT='web' -s WASM=1 -s INITIAL_MEMORY=32MB -s ALLOW_MEMORY_GROWTH=1 -s NO_DYNAMIC_EXECUTION=1 -s ASYNCIFY=1 -s ASYNCIFY_STACK_SIZE=4096 -s ASYNCIFY_ADVISE=0 -s ASYNCIFY_IGNORE_INDIRECT=0 -s ASYNCIFY_ADD=\"[${ASYNCIFY_CALL_STACK}]\" -s FETCH=1 -s ERROR_ON_UNDEFINED_SYMBOLS=0 -s ASSERTIONS=1 -s NO_EXIT_RUNTIME=1 -s FORCE_FILESYSTEM=1 -s EXPORT_ES6=1 -s USE_ES6_IMPORT_META=0 -s MODULARIZE=1 -s EXPORT_NAME='Arrow' -s EXPORTED_RUNTIME_METHODS=\"['FS']\"")

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"collaborators": [
"PixelCities"
],
"version": "0.1.4",
"version": "0.1.5",
"files": [
"arrow_wasm.wasm",
"arrow_wasm.js",
Expand Down

0 comments on commit c78844c

Please sign in to comment.