Skip to content

Commit 845c015

Browse files
docs: consolidate filesystemPolicy/networkPolicy into single securityPolicy
Replace the two separate policy knobs (filesystemPolicy, networkPolicy) with a single securityPolicy property offering three levels: "none", "local", and "sandboxed". This reflects the underlying DuckDB mechanism where enable_external_access gates both filesystem and network access together. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a30a89c commit 845c015

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

src/documentation/setup/config.malloynb

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ malloy-config-local.json
6969
| `additionalExtensions` | string | Comma-separated DuckDB extensions to load (e.g. `"spatial,fts"`). Built-in: json, httpfs, icu |
7070
| `readOnly` | boolean | Open database read-only |
7171
| `setupSQL` | text | Connection setup SQL ([see below](#setup-sql)) |
72-
| `filesystemPolicy` | string | `"open"` (default) or `"sandboxed"`. See [restricted execution](#restricted-execution) |
73-
| `networkPolicy` | string | `"open"` (default) or `"closed"`. See [restricted execution](#restricted-execution) |
74-
| `allowedDirectories` | json | Array of directories DuckDB may read/write |
72+
| `securityPolicy` | string | `"none"` (default), `"local"`, or `"sandboxed"`. See [restricted execution](#restricted-execution) |
73+
| `allowedDirectories` | json | Array of directories DuckDB may read/write. Enforced when `securityPolicy` is `"sandboxed"` |
7574
| `enableExternalAccess` | boolean | DuckDB's `enable_external_access` setting |
7675
| `lockConfiguration` | boolean | Lock DuckDB config after setup |
7776
| `autoloadKnownExtensions` | boolean | DuckDB `autoload_known_extensions` |
@@ -86,12 +85,17 @@ malloy-config-local.json
8685

8786
#### Restricted execution
8887

89-
For untrusted code, Malloy offers two policy knobs:
88+
For untrusted code, Malloy offers a single `securityPolicy` property with three levels:
9089

91-
- `filesystemPolicy: "sandboxed"` — confines DuckDB to `allowedDirectories` (defaults to `workingDirectory`), keeps `tempDirectory` inside it, locks configuration, encrypts temp files, isolates secrets. POSIX only.
92-
- `networkPolicy: "closed"` — forces `enableExternalAccess=false`, blocks `httpfs` and `INSTALL`, rejects remote `databasePath` and `motherDuckToken`.
90+
- `"none"` — no security policy applied. Ordinary DuckDB behavior. This is the default.
91+
- `"local"` — no network access. DuckDB cannot reach the network, but local filesystem access is not sandboxed to specific directories. Appropriate when the host already provides filesystem isolation (e.g. a container boundary).
92+
- `"sandboxed"` — no network access AND filesystem confined to `allowedDirectories` (defaults to `workingDirectory`). The reviewed strict recipe for untrusted Malloy. POSIX only.
9393

94-
The reviewed strict recipe uses both; each axis can also stand alone when an external boundary covers the other.
94+
Both `"local"` and `"sandboxed"` force `enableExternalAccess=false`, block `httpfs` and `INSTALL`, reject remote `databasePath` and `motherDuckToken`, lock configuration, and encrypt temp files. `"sandboxed"` additionally enforces directory containment and derives a safe `tempDirectory` inside the sandbox.
95+
96+
DuckDB's `enable_external_access` is a single toggle that gates both filesystem reach and network reach. `allowed_directories` only takes effect when external access is disabled. This is why `securityPolicy` is a single axis — the underlying DuckDB mechanism does not support independent filesystem and network control.
97+
98+
The reviewed strict recipe:
9599

96100
```json
97101
{
@@ -100,14 +104,13 @@ The reviewed strict recipe uses both; each axis can also stand alone when an ext
100104
"is": "duckdb",
101105
"databasePath": "data/app.duckdb",
102106
"workingDirectory": {"config": "rootDirectory"},
103-
"filesystemPolicy": "sandboxed",
104-
"networkPolicy": "closed"
107+
"securityPolicy": "sandboxed"
105108
}
106109
}
107110
}
108111
```
109112

110-
Policies set a floor, not a ceiling. `allowedDirectories` and `tempDirectory` can be set explicitly to customize the sandbox. Other policy-controlled settings accept matching values but reject weaker ones — connection creation fails closed. `setupSQL`, `additionalExtensions`, `motherDuckToken`, and remote `databasePath` are incompatible with a restricted policy; to use any of them, drop the policy and configure DuckDB directly. Policies do not set resource limits — configure `threads`, `memoryLimit`, timeouts, and host quotas separately.
113+
Policies set a floor, not a ceiling. `allowedDirectories` and `tempDirectory` can be set explicitly to customize the sandbox. Other policy-controlled settings accept matching values but reject weaker ones — connection creation fails closed. `setupSQL`, `additionalExtensions`, `motherDuckToken`, and remote `databasePath` are incompatible with any restricted policy; to use them, keep `securityPolicy` at `"none"` and configure DuckDB directly. Policies do not set resource limits — configure `threads`, `memoryLimit`, timeouts, and host quotas separately.
111114

112115
### `bigquery` — Google BigQuery
113116

0 commit comments

Comments
 (0)