Skip to content
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
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -490,7 +490,7 @@ jobs:
- name: Build Wasm module
run: |
cp .github/config/extension_config_wasm.cmake submodules/duckdb/extension/extension_config.cmake
DUCKDB_PLATFORM="wasm_mvp" DUCKDB_WASM_LOADABLE_EXTENSIONS="signed" GEN=ninja ./scripts/wasm_build_lib.sh relsize mvp
DUCKDB_PLATFORM="wasm_mvp" DUCKDB_WASM_LOADABLE_EXTENSIONS=1 GEN=ninja ./scripts/wasm_build_lib.sh relsize mvp

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down Expand Up @@ -533,7 +533,7 @@ jobs:
- name: Build Wasm module
run: |
cp .github/config/extension_config_wasm.cmake submodules/duckdb/extension/extension_config.cmake
DUCKDB_PLATFORM="wasm_eh" DUCKDB_WASM_LOADABLE_EXTENSIONS="signed" GEN=ninja ./scripts/wasm_build_lib.sh relsize eh
DUCKDB_PLATFORM="wasm_eh" DUCKDB_WASM_LOADABLE_EXTENSIONS=1 GEN=ninja ./scripts/wasm_build_lib.sh relsize eh

- name: Upload artifact
uses: actions/upload-artifact@v4
Expand Down
6 changes: 1 addition & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,7 @@ app: wasm wasmpack shell docs js_tests_release

build_loadable:
cp .github/config/extension_config_wasm.cmake submodules/duckdb/extension/extension_config.cmake
DUCKDB_PLATFORM=wasm_${TARGET} DUCKDB_WASM_LOADABLE_EXTENSIONS="signed" GEN=ninja ./scripts/wasm_build_lib.sh relsize ${TARGET}

build_loadable_unsigned:
cp .github/config/extension_config_wasm.cmake submodules/duckdb/extension/extension_config.cmake
DUCKDB_PLATFORM=wasm_${TARGET} DUCKDB_WASM_LOADABLE_EXTENSIONS="unsigned" GEN=ninja ./scripts/wasm_build_lib.sh relsize ${TARGET}
DUCKDB_PLATFORM=wasm_${TARGET} DUCKDB_WASM_LOADABLE_EXTENSIONS=1 GEN=ninja ./scripts/wasm_build_lib.sh relsize ${TARGET}

serve_loadable_base: wasmpack shell docs
yarn workspace @duckdb/duckdb-wasm-app build:release
Expand Down
8 changes: 0 additions & 8 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ignoreMe "${DUCKDB_WASM_VERSION}")

option(DUCKDB_WASM_LOADABLE_EXTENSIONS "Build with loadable extensions" OFF)
option(DUCKDB_WASM_LOADABLE_EXTENSIONS_UNSIGNED "Build with loadable extensions" OFF)

if(DEFINED ENV{DUCKDB_WASM_LOADABLE_EXTENSIONS})
set(DUCKDB_WASM_LOADABLE_EXTENSIONS ON)
if("$ENV{DUCKDB_WASM_LOADABLE_EXTENSIONS}" STREQUAL "unsigned")
set(DUCKDB_WASM_LOADABLE_EXTENSIONS_UNSIGNED ON)
endif()
endif()


Expand All @@ -30,10 +26,6 @@ else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DDISABLE_EXTENSION_LOAD=1")
endif()

if(DUCKDB_WASM_LOADABLE_EXTENSIONS_UNSIGNED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWASM_LOADABLE_EXTENSIONS_UNSIGNED=1")
endif()

if(NOT EMSCRIPTEN)
set(CMAKE_CXX_FLAGS_DEBUG
"${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -fsanitize=undefined")
Expand Down
3 changes: 3 additions & 0 deletions lib/include/duckdb/web/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ struct WebDBConfig {
.s3_session_token = "",
};

/// Whether to allow unsigned extensions
bool allow_unsigned_extensions = false;

/// Read from a document
static WebDBConfig ReadFrom(std::string_view args_json);
};
Expand Down
19 changes: 12 additions & 7 deletions lib/src/config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,15 @@ WebDBConfig WebDBConfig::ReadFrom(std::string_view args_json) {
FileSystemConfig{
.allow_full_http_reads = std::nullopt,
},
.duckdb_config_options = DuckDBConfigOptions{
.s3_region = "",
.s3_endpoint = "",
.s3_access_key_id = "",
.s3_secret_access_key = "",
.s3_session_token = "",
}};
.duckdb_config_options =
DuckDBConfigOptions{
.s3_region = "",
.s3_endpoint = "",
.s3_access_key_id = "",
.s3_secret_access_key = "",
.s3_session_token = "",
},
.allow_unsigned_extensions = false};
rapidjson::Document doc;
rapidjson::ParseResult ok = doc.Parse(args_json.begin(), args_json.size());
if (ok) {
Expand All @@ -69,6 +71,9 @@ WebDBConfig WebDBConfig::ReadFrom(std::string_view args_json) {
if (doc.HasMember("maximumThreads") && doc["maximumThreads"].IsNumber()) {
config.maximum_threads = doc["maximumThreads"].GetInt();
}
if (doc.HasMember("allowUnsignedExtensions") && doc["allowUnsignedExtensions"].IsBool()) {
config.allow_unsigned_extensions = doc["allowUnsignedExtensions"].GetBool();
}
if (doc.HasMember("query") && doc["query"].IsObject()) {
auto q = doc["query"].GetObject();
if (q.HasMember("queryPollingInterval") && q["queryPollingInterval"].IsNumber()) {
Expand Down
4 changes: 1 addition & 3 deletions lib/src/webdb.cc
Original file line number Diff line number Diff line change
Expand Up @@ -812,9 +812,7 @@ arrow::Status WebDB::Open(std::string_view args_json) {

duckdb::DBConfig db_config;
db_config.file_system = std::move(buffered_fs);
#ifdef WASM_LOADABLE_EXTENSIONS_UNSIGNED
db_config.options.allow_unsigned_extensions = true;
#endif
db_config.options.allow_unsigned_extensions = config_->allow_unsigned_extensions;
db_config.options.maximum_threads = config_->maximum_threads;
db_config.options.use_temporary_directory = false;
db_config.options.access_mode = access_mode;
Expand Down
4 changes: 4 additions & 0 deletions packages/duckdb-wasm/src/bindings/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,8 @@ export interface DuckDBConfig {
* The filesystem config
*/
filesystem?: DuckDBFilesystemConfig;
/**
* Whether to allow unsigned extensions
*/
allowUnsignedExtensions?: boolean;
}