Skip to content

feat: add -dry-run option#25

Merged
Warashi merged 2 commits into
mainfrom
dry-run-option
Jul 17, 2025
Merged

feat: add -dry-run option#25
Warashi merged 2 commits into
mainfrom
dry-run-option

Conversation

@Warashi
Copy link
Copy Markdown
Owner

@Warashi Warashi commented Jul 17, 2025

This pull request introduces a new "dry-run" feature to display the sandbox profile or configuration without executing it. The feature is implemented for macOS, Linux, and other platforms, with platform-specific behavior. Additionally, a new -dry-run flag is added to the CLI to enable this feature.

New "dry-run" feature:

  • macOS support: Added dryrun_darwin.go to implement a showDryRun function that displays the sandbox profile, including rules and raw profile details, specific to macOS.
  • Linux support: Added dryrun_linux.go to implement a showDryRun function that displays the sandbox configuration, including rules and restrictions, specific to Linux using Landlock LSM.
  • Unsupported platforms: Added dryrun_other.go to handle unsupported platforms by displaying an error message indicating the platform is not supported.

CLI enhancements:

  • New -dry-run flag: Added a dryRun field to the flags struct and registered a --dry-run CLI flag to enable the dry-run feature. [1] [2]
  • Flag handling in main: Updated the main function to check for the --dry-run flag and invoke the printDryRunAndExit function if the flag is set.

Warashi and others added 2 commits July 17, 2025 09:25
- Add -dry-run flag to show the generated sandbox profile
- Implement platform-specific dry-run display:
  - macOS: Shows detailed sandbox-exec profile with rules
  - Linux: Shows Landlock LSM restrictions
  - Others: Shows error for unsupported platforms
- Display human-readable rules explaining what paths are allowed
- Show the raw sandbox profile on macOS for debugging

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@Warashi Warashi marked this pull request as ready for review July 17, 2025 00:33
@Warashi Warashi merged commit 84c2641 into main Jul 17, 2025
9 checks passed
@Warashi Warashi deleted the dry-run-option branch July 17, 2025 00:33
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.

1 participant