You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
4.`sandbox::apply(policy, workdir)`: Landlock then seccomp
1284
+
4. Disable core dumps with `setrlimit(RLIMIT_CORE, 0)` on Unix
1285
+
5. Set `prctl(PR_SET_DUMPABLE, 0)` on Linux
1286
+
6.`sandbox::apply(policy, workdir)`: Landlock then seccomp
1285
1287
1286
1288
### `drop_privileges()`
1287
1289
@@ -1297,6 +1299,8 @@ The ordering is significant: `initgroups`/`setgid` must happen before `setuid` b
1297
1299
1298
1300
Steps 3, 5, and 6 are defense-in-depth post-condition checks (CWE-250 / CERT POS37-C). All three syscalls (`geteuid`, `getegid`, `setuid`) are async-signal-safe, so they are safe to call in the `pre_exec` context. The checks add negligible overhead while guarding against hypothetical kernel-level defects that could cause `setuid`/`setgid` to return success without actually changing the effective IDs.
1299
1301
1302
+
After the privilege drop, the child process also disables core dumps before Landlock and seccomp are applied. On all Unix targets it sets `RLIMIT_CORE=0`; on Linux it additionally sets `PR_SET_DUMPABLE=0`. This prevents crash artifacts from containing provider credentials, request payloads, or other sensitive in-memory data.
1303
+
1300
1304
### `ProcessStatus`
1301
1305
1302
1306
Exit code is `code` if the process exited normally, or `128 + signal` if killed by a signal (standard Unix convention). Returns `-1` if neither is available.
Copy file name to clipboardExpand all lines: docs/security/best-practices.mdx
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -185,7 +185,7 @@ The sandbox process runs as a non-root user after explicit privilege dropping.
185
185
186
186
| Aspect | Detail |
187
187
|---|---|
188
-
| Default |`run_as_user: sandbox`, `run_as_group: sandbox`. The supervisor calls `setuid()`/`setgid()` with post-condition verification: confirms the effective UID/GID match the target and that `setuid(0)` fails (root cannot be re-acquired). |
188
+
| Default |`run_as_user: sandbox`, `run_as_group: sandbox`. The supervisor calls `setuid()`/`setgid()` with post-condition verification, disables core dumps with `RLIMIT_CORE=0`, and on Linux sets `PR_SET_DUMPABLE=0`. |
189
189
| What you can change | Set `run_as_user` and `run_as_group` in the `process` section. Validation rejects root (`root` or `0`). |
190
190
| Risk if relaxed | Running as a higher-privilege user increases the impact of container escape vulnerabilities. |
191
191
| Recommendation | Keep the `sandbox` user. Do not attempt to set root. |
@@ -208,8 +208,9 @@ This ordering is intentional: privilege dropping needs `/etc/group` and `/etc/pa
208
208
209
209
1. Network namespace entry (`setns`).
210
210
2. Privilege drop (`initgroups` + `setgid` + `setuid`).
211
-
3. Landlock filesystem restrictions.
212
-
4. Seccomp socket domain filters.
211
+
3. Core-dump hardening (`RLIMIT_CORE=0`, plus `PR_SET_DUMPABLE=0` on Linux).
0 commit comments