Skip to content

fix(landlock): derive paths from wildcard-op policy rules + add MAKE_SOCK#209

Merged
erans merged 3 commits intomainfrom
fix/landlock-wildcard-derive
Apr 10, 2026
Merged

fix(landlock): derive paths from wildcard-op policy rules + add MAKE_SOCK#209
erans merged 3 commits intomainfrom
fix/landlock-wildcard-derive

Conversation

@erans
Copy link
Copy Markdown
Collaborator

@erans erans commented Apr 10, 2026

Summary

  • Wildcard operation bug: DeriveReadPathsFromPolicy and DeriveWritePathsFromPolicy silently dropped policy rules using operations: ["*"]. This meant allow-tmp, allow-package-caches, and similar rules never fed their paths into the Landlock ruleset — causing Permission denied for any filesystem access outside the workspace mount.
  • Missing MAKE_SOCK: The write access mask granted to write-allowed paths was missing LANDLOCK_ACCESS_FS_MAKE_SOCK, blocking Unix domain socket creation (e.g., bind() in /tmp) even when the path was explicitly allowed.

Fixes #190agentsh wrap -- emdash (Electron) fails with Permission denied on /tmp/scoped_dir.../SingletonSocket.

Test plan

  • TestDeriveReadPaths_WildcardOps — verifies /tmp derived from operations: ["*"]
  • TestDeriveWritePaths_WildcardOps — same for write derivation
  • TestRulesetBuilder_WriteAccessMask_IncludesMakeSock — verifies MAKE_SOCK bit present
  • All 87 packages pass (go test ./...)
  • Windows cross-compilation clean (GOOS=windows go build ./...)
  • Manual verification with Electron app under agentsh wrap (needs reporter confirmation)

🤖 Generated with Claude Code

erans and others added 3 commits April 10, 2026 08:55
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…s + add MAKE_SOCK

DeriveReadPathsFromPolicy and DeriveWritePathsFromPolicy silently
dropped file_rules that used operations: ["*"] (the wildcard). This
meant policy rules like allow-tmp, allow-workspace, and
allow-package-caches never fed their paths into the Landlock ruleset,
causing "Permission denied" for any filesystem access outside the
workspace mount (e.g., Electron apps binding Unix sockets in /tmp).

Additionally, the write access mask was missing MAKE_SOCK, so even
paths in the write list couldn't have Unix domain sockets created in
them — only the workspace could.

Fixes: #190

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@erans erans merged commit d2e9d1a into main Apr 10, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: register external PID into session for full policy enforcement (GUI/Electron agent support)

1 participant