Conversation
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
There was a problem hiding this comment.
Pull request overview
Adds a new security-oriented test suite around server/api_endpoints/api_endpoints.yml so API-only endpoint allowlists cannot silently drift toward self-escalation paths.
Changes:
- Introduces blocklist rules for dangerous catalog entries under user, invite, and role-spec routes.
- Adds a test that fails if the embedded API endpoint catalog contains a forbidden route.
- Adds positive/negative sanity checks for the blocklist matcher.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Caution Review failedFailed to post review comments WalkthroughThis pull request adds a security-focused test suite to Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@server/api_endpoints/api_endpoints_test.go`:
- Around line 99-105: The catalogBlocklistRules array misses PUT as a mutation
method for user and invite modification entries: update the entries that
currently use "PATCH" for the regexp patterns matching
^/api/v1/fleet/users(?:/.*)?$ and ^/api/v1/fleet/invites(?:/.*)?$ to also block
"PUT" (i.e., add a separate rule for "PUT" or change the method field to include
PUT), ensuring the catalogBlocklistRule entries referencing those regexps cover
both PATCH and PUT; also update any related fault-injection examples and the
sanity-check list in the tests to include PUT-based mutation cases so the guard
is exercised for full-resource replacements as well.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ff8d4248-dc76-4577-9f0e-e6dc6006d38e
📒 Files selected for processing (1)
server/api_endpoints/api_endpoints_test.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #44664 +/- ##
=======================================
Coverage 66.68% 66.69%
=======================================
Files 2651 2651
Lines 213493 213525 +32
Branches 9610 9610
=======================================
+ Hits 142367 142404 +37
+ Misses 58160 58159 -1
+ Partials 12966 12962 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
nulmete
left a comment
There was a problem hiding this comment.
LGTM.
Wondering if we want to also include some runtime validation within loadAPIEndpoints (right now we're just checking for duplicate entries, but perhaps we can introduce a similar validation that we have in these tests).
|
@nulmete As long as we catch security issues in PR before merge to |
Related issue: Resolves #42887.
From Claude's audit:
Summary by CodeRabbit