test(plugins): add end-to-end plugin authorization coverage#3141
test(plugins): add end-to-end plugin authorization coverage#3141adityathebe wants to merge 2 commits into
Conversation
|
Warning Review limit reached
Your plan includes 1 review of capacity. Refill in 5 minutes and 36 seconds. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more review capacity refills, 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 trial, open-source, and free plans. In all cases, review capacity refills continuously over time. 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 (5)
WalkthroughThis PR adds a config read permission check before plugin invocation, implements an end-to-end test plugin and test harness to validate the new authorization flow with multiple users and permission roles across Kubernetes, mission control, and HTTP endpoints. ChangesPlugin Config Read Authorization and E2E Testing
Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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 |
Plugin invocation must enforce both catalog access and plugin operation permissions when targeting a config. Add a full plugin E2E suite that runs Mission Control with real basic auth, envtest Kubernetes API, embedded Postgres, and a real hasher plugin process. The suite applies Plugin and Permission CRDs and verifies /invoke/ and /proxy/ authorization paths. Require config read permission before invoking plugin operations for a specific config.
9f46af5 to
6a85888
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/e2e/plugins/plugins_test.go`:
- Around line 70-72: The test currently asserts that the response is not 200
which can mask errors; change the assertion to explicitly expect a 403 Forbidden
for the missing-config-read case by replacing the negative check on
resp.StatusCode with an explicit equality check to http.StatusForbidden (update
the Expect call that uses resp.StatusCode and resp.Body). Locate the assertion
around ginkgo.By(endpoint.name + " rejects user without config read") and the
doPluginRequest invocation and modify the Expect(...) call to assert
Equal(http.StatusForbidden).
🪄 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: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 43ff70e6-57d4-4882-ba6d-c0a2bdec2d3c
📒 Files selected for processing (4)
plugin/runtime/invoke.gotests/e2e/plugins/plugins_test.gotests/e2e/plugins/suite_test.gotests/e2e/plugins/testdata/plugins/hasher/main.go
resoles: #3126
Plugin invocation needs to enforce both catalog access and plugin operation permissions.
Add a full plugin E2E suite that starts Mission Control with real basic auth, envtest Kubernetes API, embedded Postgres, and a real
hasherplugin process. The test applies Plugin and Permission CRDs, then verifies/invoke/and/proxy/for allowed users, bad credentials, missing plugin invoke permission, and missing config read permission.Also require config read permission before invoking plugin operations for a specific config.
Summary by CodeRabbit
Release Notes
New Features
Tests