-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[TT-15671] Add tests for mixed AND/OR legacy mode and empty OAS compliant scenarios #7370
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
This commit introduces two new test cases in `mw_auth_or_wrapper_test.go`: 1. `TestVendorExtension_MixedANDOR_LegacyMode`: Tests the behavior of the vendor extension in mixed AND/OR legacy mode, ensuring proper session management and API specification handling. 2. `TestEmptyOASCompliant`: Validates the handling of empty OAS compliant requests, checking for correct responses when no API key or invalid keys are provided. These tests enhance coverage for the new features related to vendor extensions and OAS compliance, ensuring robust functionality in various scenarios.
Let's make that PR title a 💯 shall we? 💪 Your PR title and story title look slightly different. Just checking in to know if it was intentional!
Check out this guide to learn more about PR best-practices. |
This PR is too huge for one to review 💔
Consider breaking it down into multiple small PRs. Check out this guide to learn more about PR best-practices. |
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
API Changes no api changes detected |
PR Code Suggestions ✨Explore these optional code suggestions:
|
🔍 Code Analysis ResultsThis is an excellent pull request that adds crucial test coverage for complex authentication scenarios within the Tyk Gateway. Here is a detailed analysis of the changes. 1. Change Impact AnalysisWhat this PR accomplishesThis pull request significantly enhances the test suite for the Tyk Gateway's authentication middleware. It introduces a comprehensive set of tests for APIs defined using OpenAPI Specifications (OAS) that utilize the The primary goal is to validate the behavior of the
The new tests cover complex logical combinations of security schemes (e.g., Key Technical ChangesThe PR introduces 1009 lines of new test code within a single file,
Each test function meticulously sets up a specific scenario by:
Affected System Components
Since this PR only adds test code, it has no direct impact on the production runtime but greatly improves the project's quality and maintainability. 2. Architecture VisualizationThe changes in this PR test the conditional logic within the authentication middleware, which branches based on the graph TD
A[Incoming Request] --> B{API uses OAS?};
B -- No --> C[Standard Tyk Auth];
B -- Yes --> D{"Read securityProcessingMode"};
D -- "compliant" --> E[Compliant Mode];
D -- "legacy (or not set)" --> F[Legacy Mode];
subgraph Compliant Mode
E --> G{"Is global security defined in OAS?"};
G -- Yes --> H["Enforce security schemes from<br>standard OAS security section"];
G -- No --> I["Fallback: Enforce security schemes from<br>x-tyk-api-gateway extension"];
end
subgraph Legacy Mode
F --> J["Enforce security schemes from<br>x-tyk-api-gateway extension"];
end
H --> K{Request Authorized?};
I --> K;
J --> K;
C --> K;
K -- Yes --> L[Proxy to Upstream];
K -- No --> M["Reject Request (401/403)"];
Diagram Explanation:
The tests added in this PR are critical for validating both the Powered by Visor from Probelabs Last updated: 2025-09-23T17:09:49.307Z | Triggered by: opened | Commit: 92f93dd |
🔍 Code Analysis Results✅ Security Check PassedNo security issues found – changes LGTM. Performance Issues (1)
Quality Issues (2)
Style Issues (3)
Dependency Issues (1)
✅ Connectivity Check PassedNo connectivity issues found – changes LGTM. Powered by Visor from Probelabs Last updated: 2025-09-23T17:09:50.101Z | Triggered by: opened | Commit: 92f93dd |
|
User description
TT-15671
This commit introduces two new test cases in
mw_auth_or_wrapper_test.go
:TestVendorExtension_MixedANDOR_LegacyMode
: Tests the behavior of the vendor extension in mixed AND/OR legacy mode, ensuring proper session management and API specification handling.TestEmptyOASCompliant
: Validates the handling of empty OAS compliant requests, checking for correct responses when no API key or invalid keys are provided.These tests enhance coverage for the new features related to vendor extensions and OAS compliance, ensuring robust functionality in various scenarios.
PR Type
Tests
Description
Add mixed AND/OR auth mode tests
Cover legacy vs compliant behaviors
Validate empty OAS security handling
Include HMAC, JWT, API key paths
Diagram Walkthrough
File Walkthrough
mw_auth_or_wrapper_test.go
Add mixed/compliant and empty OAS security tests
gateway/mw_auth_or_wrapper_test.go