-
Notifications
You must be signed in to change notification settings - Fork 17
Change CEL Path Strings to Support Only Major Policy Versions #41
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
Conversation
WalkthroughMultiple policy definition YAML files are updated with version increments (patch-level bumps) and all defaultValue references migrated from Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
policies/token-based-ratelimit/policy-definition.yaml (1)
106-137:⚠️ Potential issue | 🟠 MajorFix config path naming convention mismatch in redis and memory sections.
The sub-key naming in this file uses concatenated lowercase (e.g.,
keyprefix,failuremode,maxentries), while bothadvanced-ratelimitandbasic-ratelimituse snake_case for the sameratelimit_v0config namespace (e.g.,key_prefix,failure_mode,max_entries). Since all three policies resolve against the same configuration, only one convention can be correct — the other will fail at runtime.Affected keys:
This file advanced/basic-ratelimit redis.keyprefixredis.key_prefixredis.failuremoderedis.failure_moderedis.connectiontimeoutredis.connection_timeoutredis.readtimeoutredis.read_timeoutredis.writetimeoutredis.write_timeoutmemory.maxentriesmemory.max_entriesmemory.cleanupintervalmemory.cleanup_intervalUpdate all
wso2/defaultValuepaths to use snake_case to match the other policies:Proposed fix
- "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.keyprefix}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.key_prefix}" - "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.failuremode}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.failure_mode}" - "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.connectiontimeout}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.connection_timeout}" - "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.readtimeout}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.read_timeout}" - "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.writetimeout}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.redis.write_timeout}" - "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.memory.maxentries}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.memory.max_entries}" - "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.memory.cleanupinterval}" + "wso2/defaultValue": "${config.policy_configurations.ratelimit_v0.memory.cleanup_interval}"
renuka-fernando
left a comment
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.
Only failing tests that break the CEL config, hence +1
--- Failed steps:
Scenario: Enforce rate limit on API resource # features/ratelimit.feature:28
Then the response status code should be 429 # features/ratelimit.feature:65
Error: expected status code 429, got 200
Scenario: Multi-quota rate limit headers in IETF format # features/ratelimit.feature:68
And the response header "X-RateLimit-Limit" should exist # features/ratelimit.feature:108
Error: expected header "X-RateLimit-Limit" to exist
Scenario: 429 response includes IETF RateLimit headers for violated quota # features/ratelimit.feature:120
Then the response status code should be 429 # features/ratelimit.feature:163
Error: expected status code 429, got 200
Scenario: Rate limit headers are returned # features/ratelimit.feature:172
And the response header "X-RateLimit-Limit" should be "100" # features/ratelimit.feature:205
Error: expected header "X-RateLimit-Limit" to be "100", got ""
Scenario: Custom rate limit error response # features/ratelimit.feature:209
Then the response status code should be 429 # features/ratelimit.feature:246
Error: expected status code 429, got 200
Scenario: Basic rate limiting without cost extraction # features/ratelimit.feature:251
Then the response status code should be 429 # features/ratelimit.feature:288
Error: expected status code 429, got 200
Scenario: Cost extraction from response body using echo backend # features/ratelimit.feature:290
And the response header "X-RateLimit-Remaining" should be "50" # features/ratelimit.feature:337
Error: expected header "X-RateLimit-Remaining" to be "50", got ""
Scenario: API-level rate limiting with apiname key extraction # features/ratelimit.feature:356
Then the response status code should be 429 # features/ratelimit.feature:419
Error: expected status code 429, got 200
Scenario: Updating API does not reset rate limit state # features/ratelimit.feature:426
Then the response status code should be 429 # features/ratelimit.feature:466
Error: expected status code 429, got 200
Scenario: Multi-dimensional rate limiting with quotas # features/ratelimit.feature:507
Then the response status code should be 429 # features/ratelimit.feature:574
Error: expected status code 429, got 200
Scenario: Per-quota cost extraction with multiplier # features/ratelimit.feature:589
And the response header "X-RateLimit-Remaining" should be "50" # features/ratelimit.feature:636
Error: expected header "X-RateLimit-Remaining" to be "50", got ""
Scenario: Header-based key extraction for per-user rate limiting # features/ratelimit.feature:654
Then the response status code should be 429 # features/ratelimit.feature:694
Error: expected status code 429, got 200
Scenario: Multiple limits per quota - enforces most restrictive limit # features/ratelimit.feature:704
Then the response status code should be 429 # features/ratelimit.feature:751
Error: expected status code 429, got 200
Scenario: Cost extraction from request body # features/ratelimit.feature:801
Scenario: Request with malformed *** is rejected # features/jwt-auth.feature:133
Then the response status code should be 401 # features/jwt-auth.feature:166
Error: expected status code 401, got 200
Scenario: Request with wrong issuer is rejected # features/jwt-auth.feature:168
Then the response status code should be 401 # features/jwt-auth.feature:201
Error: expected status code 401, got 200
Scenario: JWT authentication rejects wrong audience # features/jwt-auth.feature:240
Then the response status code should be 401 # features/jwt-auth.feature:275
Error: expected status code 401, got 200
Scenario: JWT auth does not affect unprotected endpoints # features/jwt-auth.feature:314
Then the response status code should be 401 # features/jwt-auth.feature:351
Error: expected status code 401, got 200
Scenario: Empty *** is rejected # features/jwt-auth.feature:353
Then the response status code should be 401 # features/jwt-auth.feature:386
Error: expected status code 401, got 200
Scenario: Bearer-only without token is rejected # features/jwt-auth.feature:388
Then the response status code should be 401 # features/jwt-auth.feature:421
Error: expected status code 401, got 200
Purpose
This PR adds the modified CEL path strings required for parsing the default values inside the following policies
Summary by CodeRabbit