-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix(plugins): bind macOS ACL root trust to verified UID instead of a record name #6023
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
+16
−1
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
git diff --unified=30 d8b85adc9a5ca52b77148675f51576b0c772c55d b8ab3a9fe9aa09a4821a1b7efd300cd00e202d3d -- src/plugins/loader.ts tests/lib/plugin-loader.test.ts rg -n 'macAclListingTrustError|user:root|ACL|directory record|UID|UUID' src/plugins tests/libRepository: lidge-jun/opencodex
Length of output: 14500
🌐 Web query:
macOS ACL ls -le resolved user name root directory service record UID 0 guarantee💡 Result:
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 41874
🤖 get_repo_knowledge executed:
get_repo_knowledge lidge-jun/opencodex /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732/learnings /tmp/coderabbit-repo-knowledge/lidge-jun-opencodex-7afea732/conventionsLength of output: 19108
🏁 Script executed:
Repository: lidge-jun/opencodex
Length of output: 12060
Do not trust
user:rootby name alone.macOS ACL output resolves a principal to a directory-record name. It does not prove that the record has UID 0. A non-root record named
rootcan pass this branch with write rights, soloadOcxPluginscan import a plugin from a path that another user can modify.Remove the unconditional
rootexception, or validate the principal's UID or UUID before accepting it.Suggested fix
🤖 Prompt for AI Agents
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks — I checked this against the issue the PR closes.
Issue #6017 names the required split explicitly:
user:0 allow writemust be refused, whileuser:root allow writemust remain trusted, alongside owner/current-user grants and harmless read-only entries. Removing therootexception would go further than the issue asks in the one direction it rules out, and it would regress #6012 in the case that motivated it: a trusted system ancestor such as/carriesuser:rootallow entries, and the recorded-ancestor test (systemParent,1: user:root allow delete_child) expects that path to stay trusted.The narrower point in the finding is right and is what this PR implements: a display name is not identity, so the numeric-looking record name
0no longer confers UID-0 trust. Binding a principal to a verified UID/UUID through directory services would need adscllookup per ACE on the pre-bind plugin path, which is a larger change than this issue's scope and a separate design decision — I've kept the fix to the boundary the issue describes.So I'm deliberately not applying the suggested diff. Happy to take it up as a follow-up if the maintainers want display names fully retired from the ACL parser.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Length of output: 6090
🏁 Script executed:
Length of output: 5248
@codingbooo, I checked#6017andtests/lib/plugin-loader.test.ts. You are right:#6017explicitly requiresuser:rootwrite grants to remain trusted. ThesystemParenttest at Line 121 also depends on that behavior. I withdraw my suggested removal ofroot.The identity concern is separate.
#6017also says effective write authority must belong to actual root, and the check insrc/plugins/loader.tsacceptsuser:rootwithout verifying that identity. I cannot establish from these sources whether a non-root principal can appear asuser:rootin macOS ACL output. I’ll leave that concern open, without asking for a change to this PR. Would you like a follow-up issue to investigate that mapping and define whether UID/UUID validation is needed?You are interacting with an AI system.