-
Notifications
You must be signed in to change notification settings - Fork 65
LCORE-598: RBAC E2E tests #1017
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
base: main
Are you sure you want to change the base?
LCORE-598: RBAC E2E tests #1017
Conversation
WalkthroughAdds RBAC end-to-end tests and supporting infra: a mock JWKS server (container, Dockerfile, server, token generator), RBAC configs for library/server modes, BDD feature/step files to fetch/use test tokens, docker-compose changes (service, network, volume), and test hooks to swap/restore RBAC configs. Changes
Sequence Diagram(s)sequenceDiagram
actor Test
participant JWKS as Mock JWKS Server
participant Stack as Lightspeed Stack
participant DB as Storage/Config
Test->>JWKS: GET /tokens
JWKS-->>Test: {role: token, ...}
Test->>Test: Set Authorization: Bearer <token>
Test->>Stack: HTTP request (e.g., POST /query) with Authorization
Stack->>Stack: Parse Authorization header
Stack->>JWKS: GET /.well-known/jwks.json
JWKS-->>Stack: JWKS {keys: [...]}
Stack->>Stack: Verify signature, extract claims, resolve role
Stack->>DB: Enforce authorization & process request
DB-->>Stack: Result or error
alt allowed
Stack-->>Test: 200 OK (result)
else denied
Stack-->>Test: 403 Forbidden
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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 |
d2fa06e to
d608577
Compare
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.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@docker-compose-library.yaml`:
- Around line 66-70: The healthcheck block currently uses curl (test key) which
isn't available in the python:3.12-slim image; update the healthcheck "test" to
invoke Python (python -c) and use the stdlib urllib.request.urlopen to GET
/health so the command succeeds on HTTP 200 and fails (non-zero exit) on errors,
replacing the curl-based invocation in the healthcheck test entry.
🧹 Nitpick comments (2)
tests/e2e/mock_jwks_server/generate_tokens.py (1)
14-20:default_backend()is deprecated in recent cryptography versions.Since cryptography 3.x,
default_backend()is no longer needed—the backend parameter can be omitted entirely. This is a minor issue for a one-time utility script.🔧 Suggested simplification
-from cryptography.hazmat.backends import default_backend # Generate RSA key pair private_key = rsa.generate_private_key( - public_exponent=65537, key_size=2048, backend=default_backend() + public_exponent=65537, key_size=2048 )tests/e2e/features/steps/rbac.py (1)
12-33: Consider usinglogginginstead ofPer coding guidelines, modules should use
logger = logging.getLogger(__name__)pattern. However, for BDD step definitions that run in behave's context,
Description
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit
New Features
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.