Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
fix(policy): abort sandbox startup when hard_requirement has no files…
…ystem paths

Signed-off-by: Artem Lytvyn <[email protected]>
  • Loading branch information
letv1nnn committed Jul 29, 2026
commit 49a6eecb584b206efe6843da601211235396969b
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ fn prepare_with_path_open_mode(
}

if read_only.is_empty() && read_write.is_empty() {
if matches!(
policy.landlock.compatibility,
LandlockCompatibility::HardRequirement
) {
miette::bail!(
"landlock.compatibility is hard_requirement but no filesystem paths are configured"
);
}
return Ok(None);
}

Expand Down
10 changes: 5 additions & 5 deletions docs/reference/policy-schema.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ Configures [Landlock LSM](https://docs.kernel.org/security/landlock.html) enforc

**Compatibility modes:**

| Value | Kernel ABI unavailable | Individual path inaccessible | All paths inaccessible |
|---|---|---|---|
| `best_effort` | Warns and continues without Landlock. | Skips the path, applies remaining rules. | Warns and continues without Landlock (refuses to apply an empty ruleset). |
| `hard_requirement` | Aborts sandbox startup. | Aborts sandbox startup. | Aborts sandbox startup. |
| Value | No paths configured | Kernel ABI unavailable | Individual path inaccessible | All paths inaccessible |
|---|---|---|---|---|
| `best_effort` | Landlock skipped (no-op). | Warns and continues without Landlock. | Skips the path, applies remaining rules. | Warns and continues without Landlock (refuses to apply an empty ruleset). |
| `hard_requirement` | Aborts sandbox startup. | Aborts sandbox startup. | Aborts sandbox startup. | Aborts sandbox startup. |

`best_effort` (the default) is appropriate for most deployments. It handles missing paths gracefully. For example, `/app` might not exist in every container image but is included in the baseline path set for containers that do have it. Individual missing paths are skipped while the remaining filesystem rules are still enforced.

`hard_requirement` is for environments where any gap in filesystem isolation is unacceptable. If a listed path cannot be opened for any reason (missing, permission denied, symlink loop), sandbox startup fails immediately rather than running with reduced protection.
`hard_requirement` is for environments where any gap in filesystem isolation is unacceptable. If a listed path cannot be opened for any reason (missing, permission denied, symlink loop), sandbox startup fails immediately rather than running with reduced protection. Configuring `hard_requirement` with no filesystem paths is also a startup error.

When a path is skipped under `best_effort`, the sandbox logs a warning that includes the path, the specific error, and a human-readable reason (for example, "path does not exist" or "permission denied").

Expand Down
Loading