-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Merging to release-5.3.9: [TT-12710]deleting All Partitioned Policies a Key is linked to does not delete the Key (#6473) #6777
Conversation
…ot delete the Key (#6473) TASK: https://tyktech.atlassian.net/browse/TT-12710 Fixed case in which trying to apply a non-existing policy error would be swallowed when having partitioned keys. <!-- Provide a general summary of your changes in the Title above --> <!-- Describe your changes in detail --> <!-- This project only accepts pull requests related to open issues. --> <!-- If suggesting a new feature or change, please discuss it in an issue first. --> <!-- If fixing a bug, there should be an issue describing it with steps to reproduce. --> <!-- OSS: Please link to the issue here. Tyk: please create/link the JIRA ticket. --> <!-- Why is this change required? What problem does it solve? --> <!-- Please describe in detail how you tested your changes --> <!-- Include details of your testing environment, and the tests --> <!-- you ran to see how your change affects other areas of the code, etc. --> <!-- This information is helpful for reviewers and QA. --> <!-- What types of changes does your code introduce? Put an `x` in all the boxes that apply: --> - [ ] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to change) - [ ] Refactoring or add test (improvements in base code or adds test coverage to functionality) <!-- Go over all the following points, and put an `x` in all the boxes that apply --> <!-- If there are no documentation updates required, mark the item as checked. --> <!-- Raise up any additional concerns not covered by the checklist. --> - [ ] I ensured that the documentation is up to date - [ ] I explained why this PR updates go.mod in detail with reasoning why it's required - [ ] I would like a code coverage CI quality gate exception and have explained why ___ Bug fix ___ - Fixed a bug where errors for non-existing policies were ignored if multiple policies were processed, ensuring that an error is returned immediately. - Improved error handling in the `Apply` method of the `Service` to prevent silent failures when policies are missing. ___ <table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Bug fix</strong></td><td><table> <tr> <td> <details> <summary><strong>apply.go</strong><dd><code>Fix error handling for non-existing policies in Apply method</code></dd></summary> <hr> internal/policy/apply.go <li>Removed logic that continued processing policies when a non-existing <br>policy was encountered.<br> <li> Ensured that an error is returned immediately if a policy is not <br>found.<br> </details> </td> <td><a href="https://github.com/TykTechnologies/tyk/pull/6473/files#diff-59b92e9d31f142f1d99b746eb3ff7db4e26bf6c3044c9b87b58034a947ee04d1">+0/-4</a> </td> </tr> </table></td></tr></tr></tbody></table> ___ > 💡 **PR-Agent usage**: >Comment `/help` on the PR to get a list of all available PR-Agent tools and their descriptions (cherry picked from commit 4af6152)
…b79504996256c0903bd772251
…files currently existing in release-5.3 branch
API Changes --- prev.txt 2024-12-17 10:54:59.205331536 +0000
+++ current.txt 2024-12-17 10:54:56.051332550 +0000
@@ -9945,6 +9945,8 @@
func (s *Test) CreateSession(sGen ...func(s *user.SessionState)) (*user.SessionState, string)
+func (s *Test) DeletePolicy(policyID string)
+
func (s *Test) Do(tc test.TestCase) (*http.Response, error)
func (s *Test) EnablePort(port int, protocol string) |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
PR Code Suggestions ✨Explore these optional code suggestions:
|
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
User description
TT-12710
TT-12710deleting All Partitioned Policies a Key is linked to does not delete the Key (#6473)
User description
TASK: https://tyktech.atlassian.net/browse/TT-12710
Fixed case in which trying to apply a non-existing policy error would be
swallowed when having partitioned keys.
Description
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
functionality to change)
coverage to functionality)
Checklist
why it's required
explained why
PR Type
Bug fix
Description
multiple policies were processed, ensuring that an error is returned
immediately.
Apply
method of theService
toprevent silent failures when policies are missing.
Changes walkthrough 📝
apply.go
Fix error handling for non-existing policies in Apply method
internal/policy/apply.go
policy was encountered.
found.
PR Type
Bug fix, Tests
Description
ApplyPolicies
method.Changes walkthrough 📝
api_test.go
Enhanced test coverage for policy deletion and session updates.
gateway/api_test.go
impact on API access.
metadata for better coverage.
applied policies.
multiauth_test.go
Updated multi-auth tests with enhanced policy validation.
gateway/multiauth_test.go
creation.
mw_jwt_test.go
Enhanced JWT session tests with policy validation.
gateway/mw_jwt_test.go
application.
testutil.go
Added policy deletion utility for tests.
gateway/testutil.go
middleware.go
Improved error handling in ApplyPolicies method.
gateway/middleware.go
applied to a session.
server.go
Simplified policy synchronization logic.
gateway/server.go
policiesByID
.