feat(learn): add macOS learn mode via Seatbelt report-mode#171
feat(learn): add macOS learn mode via Seatbelt report-mode#171kipz wants to merge 1 commit intoalways-further:mainfrom
Conversation
d018fff to
9d1af24
Compare
Summary of ChangesHello @kipz, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces macOS support to the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a learn mode for macOS using Seatbelt's report-mode, which is a great addition. The refactoring of the existing Linux learn mode to share common code is well-executed and improves the project's structure. I've found one important safety issue in the new macOS implementation regarding the use of std::process::exit in the forked child process, which I've detailed in a review comment.
Converts learn.rs into a learn/ module and adds macOS support using Seatbelt report-mode + log stream. How it works: - Parent starts `log stream` filtered to kernel Sandbox events - Forks child, which applies `(allow (with report) default)` then exec()s the target — allows all ops but logs each to the kernel log - Parent drains log events via mpsc channel while polling waitpid - Seatbelt sandbox is inherited across exec(), so all child processes are traced including SIP-protected binaries Architecture: - learn/mod.rs: shared types (FileAccess, NetworkAccess, LearnResult), cross-platform helpers (process_accesses, process_network_accesses, expand_home, resolve_*_dns), platform dispatcher, cross-platform tests - learn/linux.rs: strace implementation (moved from learn.rs unchanged) - learn/macos.rs: new Seatbelt implementation with log line parser and full test coverage Other changes: - policy.rs: remove #[cfg(target_os = "linux")] from get_system_read_paths - Cargo.toml: add dns-lookup = "2" to macOS dependencies - cli.rs: remove "(Linux only)" from Learn command description - main.rs: add admin privilege note for macOS learn mode Signed-off-by: James Carnegie <james.carnegie@datadoghq.com>
9d1af24 to
3a17ccd
Compare
|
thanks @kipz , going to take a look today, added an initial thoughts in the issue. |
This is kind of gross, but seems work work for me. Not sure if it fits with your goals for the project - as mentioned in #170, maybe
dylibis a better approach?log streamfiltered to kernel Sandbox events(allow (with report) default)then exec()s the target — allows all ops but logs each to the kernel log