feat: Config Protection Proposal - Bounty #30 ($75)#83
Conversation
|
Warning Rate limit exceeded
Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 57 minutes and 15 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughAdds a proposal document that defines a three-layer protection for UbiquityOS plugin config files affecting financial operations: (1) CODEOWNERS review gates and branch protection for specific config paths, (2) a webhook-driven plugin that detects watched config changes on push, verifies pusher permissions via the GitHub Collaborator API, and automatically rolls back unauthorized changes with admin notifications, and (3) an audit-trail layer that posts change details, writes audit entries, and maintains a SHA-256 hash chain of config states. The proposal includes phased implementation steps and a test plan. 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
proposals/config-protection.md (2)
61-70: Code example incomplete—show how to obtainpreviousTreeSha.The snippet references
previousTreeShabut doesn't demonstrate how to retrieve it. Implementers need to see the tree retrieval step.📚 Suggested enhancement
4. **Rollback mechanism** — If unauthorized: ```typescript + // Get previous commit + const previousCommit = await octokit.git.getCommit({ commit_sha: previousSha }); + const previousTreeSha = previousCommit.data.tree.sha; + // Get previous commit's config content const previousConfig = await octokit.repos.getContent({ ref: previousSha, ... });
96-96: Address force-push race conditions.Force-pushing the branch back could create conflicts if other developers pulled the unauthorized commit. Consider documenting the race condition handling strategy or warning admins to verify no one has pulled the bad commit.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: a7b7c7ac-258c-457f-bc07-bdf2fc9fa6ee
📒 Files selected for processing (1)
proposals/config-protection.md
| On `push` events, a UbiquityOS plugin detects whether config files were modified: | ||
|
|
||
| 1. **Diff Detection:** Compare the config file SHA before and after the push using the GitHub Compare API. | ||
| 2. **Authorization Check:** Verify the pusher has `admin` or `billing_manager` role via the repository collaborator API (`GET /repos/{owner}/{repo}/collaborators/{username}/permission`). |
There was a problem hiding this comment.
🧩 Analysis chain
🌐 Web query:
What are the valid permission levels returned by GitHub's GET /repos/{owner}/{repo}/collaborators/{username}/permission API?
💡 Result:
GET /repos/{owner}/{repo}/collaborators/{username}/permission returns a permission value that is one of the legacy base roles:
adminwritereadnone[1]
(If you need the non-legacy role, use the role_name field, which can include maintain, triage, or a custom repository role name.) [1]
Sources:
[1] GitHub Docs – “Get repository permissions for a user” (REST API: Collaborators) (docs.github.com)
Citations:
GitHub API endpoint doesn't support "billing_manager" role.
The GET /repos/{owner}/{repo}/collaborators/{username}/permission API returns only: admin, write, read, none (or maintain, triage via role_name). Define how authorization checks will identify billing managers—via GitHub team membership or custom metadata instead.
- Add language specifiers to all code blocks (codeowners, text, typescript, json) - Verify CODEOWNERS examples match GitHub docs - Fix code example formatting
|
Superseded by #91 (updated version with CodeRabbit feedback addressed). Closing this duplicate. |
Config Protection
Bounty: #30 | Reward: $75
Addresses configuration protection for UbiquityOS plugins to prevent unauthorized changes.
Proposal Highlights
See
proposals/config-protection.mdfor full details.