feat: Add Landlock LSM sandbox for filesystem isolation #11013
+343
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Implements Linux Landlock sandboxing to restrict filesystem access when ComfyUI is running. This provides defense-in-depth against malicious custom nodes or workflows that attempt to access sensitive files.
The sandbox is disabled by default, and (at least at the moment) is likely to cause some problems if enabled, but should work fine in most cases. Any such problems can generally be fixed by adding to the default read or write-access list. Since this is a whitelist, not a blacklist, I kind of expect the flag to be a source of bug reports for a while.
I tested this by writing a custom module that attempts to scrape my bookmarks from Firefox, delete my .bash_history, and launch Nethack. None of it worked.
Limitations:
How it works:
Issues expected:
Write access granted to:
Read access granted to:
Usage:
python main.py --enable-landlock python main.py --enable-landlock --landlock-allow-writable /extra/dir --landlock-allow-readable ~/.cache/huggingface
Requirements:
🤖 Generated with Claude Code