Implement ns lookup allowlist (#1420)
The ns-lookup accepts domain names as well as suffixes, e.g.: ``` --allow-resolve=* # allow all domain names --allow-resolve=example.com # only allow example.com name resolution --allow-resolve=example.com --allow-resolve=*.example.com # allow example.com and its subdomains' name resolution ```
This commit is contained in:
@ -363,6 +363,8 @@ typedef struct WASIContext {
|
||||
struct fd_prestats *prestats;
|
||||
struct argv_environ_values *argv_environ;
|
||||
struct addr_pool *addr_pool;
|
||||
char *ns_lookup_buf;
|
||||
char **ns_lookup_list;
|
||||
char *argv_buf;
|
||||
char **argv_list;
|
||||
char *env_buf;
|
||||
@ -770,6 +772,7 @@ wasm_runtime_init_wasi(WASMModuleInstanceCommon *module_inst,
|
||||
const char *map_dir_list[], uint32 map_dir_count,
|
||||
const char *env[], uint32 env_count,
|
||||
const char *addr_pool[], uint32 addr_pool_size,
|
||||
const char *ns_lookup_pool[], uint32 ns_lookup_pool_size,
|
||||
char *argv[], uint32 argc, int stdinfd, int stdoutfd,
|
||||
int stderrfd, char *error_buf, uint32 error_buf_size);
|
||||
|
||||
@ -786,6 +789,11 @@ wasm_runtime_get_wasi_ctx(WASMModuleInstanceCommon *module_inst);
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_wasi_addr_pool(wasm_module_t module, const char *addr_pool[],
|
||||
uint32 addr_pool_size);
|
||||
|
||||
WASM_RUNTIME_API_EXTERN void
|
||||
wasm_runtime_set_wasi_ns_lookup_pool(wasm_module_t module,
|
||||
const char *ns_lookup_pool[],
|
||||
uint32 ns_lookup_pool_size);
|
||||
#endif /* end of WASM_ENABLE_LIBC_WASI */
|
||||
|
||||
#if WASM_ENABLE_REF_TYPES != 0
|
||||
|
||||
Reference in New Issue
Block a user