-
Notifications
You must be signed in to change notification settings - Fork 1.1k
[TT-11048] Regex on endpoint list issue poc #7266
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: master
Are you sure you want to change the base?
Conversation
PR Reviewer Guide 🔍(Review updated until commit 8a40ed4)Here are some key observations to aid the review process:
|
PR Code Suggestions ✨No code suggestions found for the PR. |
📦 Impact Review Snapshot
## Impact AssessmentThis PR refactors the OAS (OpenAPI Specification) filling functions in the Tyk Gateway to accept an options parameter, introducing a new strategy for handling regex in endpoint paths. The main changes include:
These changes primarily affect how the Tyk Gateway converts classic API definitions to OAS format, particularly for endpoints with regex patterns in their paths. ## Required Updates
## Compatibility ConcernsThe PR introduces a backward-compatible change to the
## Summary & Recommendations
Tip: Mention me again using |
🛡️ Security Snapshot
## Security Impact AnalysisThis PR introduces a refactoring of how regex patterns in endpoint paths are handled when converting between classic API definitions and OpenAPI Specification (OAS) format. The changes add an option-based parameter system to control whether regex patterns should be transformed or ignored during conversion. The default behavior ( The changes are well-contained within the OAS conversion logic and don't modify any security-critical code paths. The PR primarily addresses a functional issue with regex handling in endpoint lists rather than introducing new security features or modifying existing security controls. ## Identified VulnerabilitiesNo security vulnerabilities were identified in this PR. The changes:
The refactoring is focused on the internal representation of paths during OAS conversion and doesn't affect how requests are processed or validated at runtime. ## Security RecommendationsWhile no security issues were identified, I recommend:
## OWASP ComplianceThe changes in this PR don't impact OWASP Top 10 compliance:
## Summary
Tip: Mention me again using |
🚦 Connectivity Review Snapshot
## Connectivity Assessment
## Test Coverage Validation
## Security & Performance Impact
## Summary & Recommendations
Tip: Mention me again using |
🚀 Performance Snapshot
## Performance Impact AnalysisThis PR refactors the OAS filling functions to accept an options parameter, introducing a strategy pattern for regex handling. The key change is the ability to skip regex transformations when not needed, which can improve performance for APIs with complex regex patterns. The option pattern itself adds minimal overhead during initialization but can lead to performance gains during path processing. ## Critical AreasThe most performance-sensitive area affected is the regex path handling in ## Optimization Recommendations
## Summary
Tip: Mention me again using |
Persistent review updated to latest commit 8a40ed4 |
API Changes --- prev.txt 2025-07-30 11:12:00.597623070 +0000
+++ current.txt 2025-07-30 11:11:51.199493189 +0000
@@ -2077,6 +2077,10 @@
acknowledging that some standard Tyk OAS API fields are optional in
templates.
+func WithOmitTranslate() option.Option[fillOptions]
+ WithOmitTranslate omits regex-based endpoints translation during classic to
+ oas translation.
+
TYPES
@@ -2872,6 +2876,9 @@
func (e *ExtractCredentialsFromBody) Fill(api apidef.APIDefinition)
Fill fills *ExtractCredentialsFromBody from apidef.APIDefinition.
+type FillOption = option.Option[fillOptions]
+ FillOption optional parameter for Fill method.
+
type FromOASExamples struct {
// Enabled activates getting a mock response from OAS examples or schemas documented in OAS.
Enabled bool `bson:"enabled" json:"enabled"`
@@ -3577,7 +3584,7 @@
func (s *OAS) ExtractTo(api *apidef.APIDefinition)
ExtractTo extracts *OAS into *apidef.APIDefinition.
-func (s *OAS) Fill(api apidef.APIDefinition)
+func (s *OAS) Fill(api apidef.APIDefinition, opts ...FillOption)
Fill fills *OAS definition from apidef.APIDefinition.
func (s *OAS) GetTykExtension() *XTykAPIGateway
@@ -5516,6 +5523,8 @@
func (o Options[O]) Build(baseVal O) *O
+func (o Options[O]) BuildValue(baseVal O) O
+
# Package: ./config
package config // import "github.com/TykTechnologies/tyk/config" |
PR Code Suggestions ✨No code suggestions found for the PR. |
|
User description
TT-11048
User description
Description
Related Issue
Motivation and Context
How This Has Been Tested
Screenshots (if appropriate)
Types of changes
Checklist
PR Type
enhancement
Description
Refactored OAS filling functions to accept options parameter
Introduced
fillOptions
and transform strategy for regex handlingAdded
ensureOperationId
and related helpers for operation managementUpdated tests and internal calls to use new options-based signatures
Diagram Walkthrough
File Walkthrough
PR Type
Enhancement
Description
Refactored OAS fill methods to accept optional fill options
Introduced fillOptions and FillOption for flexible endpoint transformation
Added strategy to control regex-based endpoint translation
Updated tests and internal logic to use new fillOptions pattern
Diagram Walkthrough
File Walkthrough