Skip to content
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: [TT-12865] Rename config parameter, update usage, support mux params on legacy (#6506) #6507

Merged

Conversation

buger
Copy link
Member

@buger buger commented Sep 12, 2024

User description

TT-12865 Rename config parameter, update usage, support mux params on legacy (#6506)

PR Type

enhancement


Description

  • Renamed configuration fields EnablePrefixMatching and
    EnableSuffixMatching to EnablePathPrefixMatching and
    EnablePathSuffixMatching respectively, across multiple files.
  • Updated comments and documentation to reflect the new naming
    conventions.
  • Modified test cases to use the updated configuration fields.
  • Refactored middleware and session manager logic to accommodate the new
    path matching configuration.

Changes walkthrough 📝

Relevant files
Enhancement
config.go
Rename configuration fields for path matching options       

config/config.go

  • Renamed EnablePrefixMatching to EnablePathPrefixMatching.
  • Renamed EnableSuffixMatching to EnablePathSuffixMatching.
  • Updated comments to reflect the new naming conventions.
  • +12/-12 
    api_definition.go
    Update API definition to use new path matching config       

    gateway/api_definition.go

  • Updated variable names to use new path matching configuration fields.
  • +2/-2     
    mw_granular_access.go
    Refactor middleware to use updated path matching config   

    gateway/mw_granular_access.go

  • Updated variable names to use new path matching configuration fields.
  • Refactored pattern preparation using PreparePathRegexp.
  • +3/-9     
    session_manager.go
    Update session manager for new path matching config           

    gateway/session_manager.go

  • Updated variable names to use new path matching configuration fields.
  • +2/-2     
    schema.json
    Update JSON schema for path matching configuration             

    cli/linter/schema.json

    • Renamed JSON schema fields for path matching options.
    +2/-2     
    Tests
    api_definition_test.go
    Update test configuration for path prefix matching             

    gateway/api_definition_test.go

    • Modified test configuration to use EnablePathPrefixMatching.
    +1/-1     
    mw_granular_access_test.go
    Update middleware test for path prefix matching                   

    gateway/mw_granular_access_test.go

    • Modified test configuration to use EnablePathPrefixMatching.
    +1/-1     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools
    and their descriptions


    Co-authored-by: Tit Petric tit@tyk.io


    PR Type

    Enhancement, Tests


    Description

    • Introduced new configuration options EnablePathPrefixMatching and EnablePathSuffixMatching to enhance URL path matching capabilities.
    • Refactored URLSpec and related logic to support the new path matching configuration.
    • Updated middleware and session management to utilize the new path matching options.
    • Added comprehensive tests for the new path matching logic, including regression tests for issue 12865.
    • Improved logging and error handling in path matching processes.

    Changes walkthrough 📝

    Relevant files
    Enhancement
    6 files
    config.go
    Add configuration for path prefix and suffix matching       

    config/config.go

  • Added new configuration fields EnablePathPrefixMatching and
    EnablePathSuffixMatching.
  • Updated comments to explain the new path matching configuration.
  • +43/-0   
    api_definition.go
    Refactor URLSpec and update path matching logic                   

    gateway/api_definition.go

  • Refactored URLSpec to use private fields and methods.
  • Updated path matching logic to support new configuration.
  • Renamed several functions for clarity.
  • +47/-142
    model_apispec.go
    Refactor and deprecate CheckSpecMatchesStatus                       

    gateway/model_apispec.go

  • Moved CheckSpecMatchesStatus to a separate file and deprecated it.
  • Added FindSpecMatchesStatus for improved status checking.
  • +75/-0   
    model_urlspec.go
    Add path and method matching methods to URLSpec                   

    gateway/model_urlspec.go

  • Added new methods to URLSpec for matching paths and methods.
  • Deprecated modeSpecificSpec method.
  • +120/-0 
    mw_granular_access.go
    Update GranularAccessMiddleware for new path matching       

    gateway/mw_granular_access.go

  • Updated middleware to use new path matching configuration.
  • Improved logging and error handling in path matching.
  • +74/-20 
    mux.go
    Refactor path regex preparation and matching                         

    internal/httputil/mux.go

  • Refactored path regex preparation and matching functions.
  • Improved caching and handling of mux-style parameters.
  • +78/-18 
    Tests
    4 files
    api_definition_test.go
    Update and add test cases for path matching logic               

    gateway/api_definition_test.go

  • Updated test cases to reflect changes in path matching logic.
  • Added new test cases for path prefix matching.
  • +12/-12 
    mw_granular_access_test.go
    Add tests for GranularAccessMiddleware path matching         

    gateway/mw_granular_access_test.go

  • Added tests for new path matching logic in GranularAccessMiddleware.
  • Updated existing tests to use new configuration.
  • +50/-28 
    mux_test.go
    Add tests for path regex preparation and matching               

    internal/httputil/mux_test.go

  • Added tests for new path matching functions.
  • Updated existing tests to reflect changes in regex preparation.
  • +112/-14
    issue_12865_test.go
    Add regression tests for issue 12865                                         

    tests/regression/issue_12865_test.go

  • Added regression tests for issue 12865.
  • Tested various configurations of path prefix and suffix matching.
  • +171/-0 
    Configuration changes
    2 files
    test.yml
    Update test task configuration                                                     

    .taskfiles/test.yml

  • Updated test task to exclude the first package in the list.
  • Added a task to merge coverage reports.
  • +2/-1     
    schema.json
    Update schema for new path matching configuration               

    cli/linter/schema.json

    • Added new schema fields for path prefix and suffix matching.
    +6/-0     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    titpetric and others added 3 commits September 12, 2024 08:26
    …ams on legacy (#6506)
    
    enhancement
    
    ___
    
    - Renamed configuration fields `EnablePrefixMatching` and
    `EnableSuffixMatching` to `EnablePathPrefixMatching` and
    `EnablePathSuffixMatching` respectively, across multiple files.
    - Updated comments and documentation to reflect the new naming
    conventions.
    - Modified test cases to use the updated configuration fields.
    - Refactored middleware and session manager logic to accommodate the new
    path matching configuration.
    
    ___
    
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>config.go</strong><dd><code>Rename configuration fields
    for path matching options</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    config/config.go
    
    <li>Renamed <code>EnablePrefixMatching</code> to
    <code>EnablePathPrefixMatching</code>.<br> <li> Renamed
    <code>EnableSuffixMatching</code> to
    <code>EnablePathSuffixMatching</code>.<br> <li> Updated comments to
    reflect the new naming conventions.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-fe44f09c4d5977b5f5eaea29170b6a0748819c9d02271746a20d81a5f3efca17">+12/-12</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>api_definition.go</strong><dd><code>Update API
    definition to use new path matching config</code>&nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-0cf80174bbafb36f6d4f4308ebbd971b2833b76a936bad568220aa1a4ba0ee8b">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access.go</strong><dd><code>Refactor
    middleware to use updated path matching config</code>&nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    gateway/mw_granular_access.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br> <li> Refactored pattern preparation using
    <code>PreparePathRegexp</code>.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-618f7d55751d572562a29506a13beba2da969436e974f8b51df7d9708c925436">+3/-9</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>session_manager.go</strong><dd><code>Update session
    manager for new path matching config</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/session_manager.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-e6b40a285464cd86736e970c4c0b320b44c75b18b363d38c200e9a9d36cdabb6">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>schema.json</strong><dd><code>Update JSON schema for
    path matching configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    cli/linter/schema.json
    
    - Renamed JSON schema fields for path matching options.
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-103cec746d3e61d391c5a67c171963f66fea65d651d704d5540e60aa5d574f46">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definition_test.go</strong><dd><code>Update test
    configuration for path prefix matching</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition_test.go
    
    - Modified test configuration to use `EnablePathPrefixMatching`.
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-2394daab6fdc5f8dc234699c80c0548947ee3d68d2e33858258d73a8b5eb6f44">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access_test.go</strong><dd><code>Update
    middleware test for path prefix matching</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access_test.go
    
    - Modified test configuration to use `EnablePathPrefixMatching`.
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-8e0d7cfef26688edd7d08334d955039dab5deb3caf860d29eff6d09894eaba20">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </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
    
    ---------
    
    Co-authored-by: Tit Petric <tit@tyk.io>
    
    (cherry picked from commit 89bcc57)
    Copy link
    Contributor

    github-actions bot commented Sep 12, 2024

    API Changes

    --- prev.txt	2024-09-12 17:32:03.415738583 +0000
    +++ current.txt	2024-09-12 17:31:59.983726905 +0000
    @@ -5514,6 +5514,49 @@
     	// Regular expressions and parameterized routes will be left alone regardless of this setting.
     	EnableStrictRoutes bool `json:"enable_strict_routes"`
     
    +	// EnablePathPrefixMatching changes the URL matching from wildcard mode to prefix mode.
    +	// For example, `/json` matches `*/json*` by current default behaviour.
    +	// If prefix matching is enabled, the match will be performed as a prefix match (`/json*`).
    +	//
    +	// The `/json` url would be matched as `^/json` against the following paths:
    +	//
    +	// - Full listen path and versioning URL (`/listen-path/v4/json`)
    +	// - Stripped listen path URL (`/v4/json`)
    +	// - Stripped version information (`/json`) - match.
    +	//
    +	// If versioning is disabled then the following URLs are considered:
    +	//
    +	// - Full listen path and endpoint (`/listen-path/json`)
    +	// - Stripped listen path (`/json`) - match.
    +	//
    +	// For inputs that start with `/`, a prefix match is ensured by
    +	// prepending the start of string `^` caret.
    +	//
    +	// For all other cases, the pattern remains unmodified.
    +	//
    +	// Combine this option with `enable_path_suffix_matching` to achieve
    +	// exact url matching with `/json` being evaluated as `^/json$`.
    +	EnablePathPrefixMatching bool `json:"enable_path_prefix_matching"`
    +
    +	// EnablePathSuffixMatching changes the URL matching to match as a suffix.
    +	// For example: `/json` is matched as `/json$` against the following paths:
    +	//
    +	// - Full listen path and versioning URL (`/listen-path/v4/json`)
    +	// - Stripped listen path URL (`/v4/json`)
    +	// - Stripped version information (`/json`) - match.
    +	//
    +	// If versioning is disabled then the following URLs are considered:
    +	//
    +	// - Full listen path and endpoint (`/listen-path/json`)
    +	// - Stripped listen path (`/json`) - match.
    +	//
    +	// If the input pattern already ends with a `$` (`/json$`)
    +	// then the pattern remains unmodified.
    +	//
    +	// Combine this option with `enable_path_prefix_matching` to achieve
    +	// exact url matching with `/json` being evaluated as `^/json$`.
    +	EnablePathSuffixMatching bool `json:"enable_path_suffix_matching"`
    +
     	// Disable TLS verification. Required if you are using self-signed certificates.
     	SSLInsecureSkipVerify bool `json:"ssl_insecure_skip_verify"`
     
    @@ -7424,10 +7467,16 @@
     func CloneAPI(a *APISpec) *APISpec
     
     func (a *APISpec) CheckSpecMatchesStatus(r *http.Request, rxPaths []URLSpec, mode URLStatus) (bool, interface{})
    -    CheckSpecMatchesStatus checks if a url spec has a specific status
    +    CheckSpecMatchesStatus checks if a URL spec has a specific status.
    +    Deprecated: The function doesn't follow go return conventions (T, ok);
    +    use FindSpecMatchesStatus;
     
     func (a *APISpec) Expired() bool
     
    +func (a *APISpec) FindSpecMatchesStatus(r *http.Request, rxPaths []URLSpec, mode URLStatus) (*URLSpec, bool)
    +    FindSpecMatchesStatus checks if a URL spec has a specific status and returns
    +    the URLSpec for it.
    +
     func (s *APISpec) FireEvent(name apidef.TykEvent, meta interface{})
     
     func (a *APISpec) GetSessionLifetimeRespectsKeyExpiration() bool
    @@ -7450,6 +7499,12 @@
     func (a *APISpec) StopSessionManagerPool()
     
     func (a *APISpec) StripListenPath(reqPath string) string
    +    StripListenPath will strip the listen path from the URL, keeping version in
    +    tact.
    +
    +func (a *APISpec) StripVersionPath(reqPath string) string
    +    StripVersionPath will strip the version from the URL. The input URL should
    +    already have listen path stripped.
     
     func (a *APISpec) URLAllowedAndIgnored(r *http.Request, rxPaths []URLSpec, whiteListStatus bool) (RequestStatus, interface{})
         URLAllowedAndIgnored checks if a url is allowed and ignored.
    @@ -10074,7 +10129,6 @@
         system, return an error to have the chain fail
     
     type URLSpec struct {
    -	Spec                      *regexp.Regexp
     	Status                    URLStatus
     	MethodActions             map[string]apidef.EndpointMethodMeta
     	Whitelist                 apidef.EndPointMeta
    @@ -10102,6 +10156,7 @@
     	PersistGraphQL            apidef.PersistGraphQLMeta
     
     	IgnoreCase bool
    +	// Has unexported fields.
     }
         URLSpec represents a flattened specification for URLs, used to check if
         a proxy URL path is on any of the white, black or ignored lists. This is

    @titpetric titpetric changed the title Merging to release-5.3: WIP [TT-12865] Rename config parameter, update usage, support mux params on legacy (#6506) Merging to release-5.3: [TT-12865] Rename config parameter, update usage, support mux params on legacy (#6506) Sep 12, 2024
    @titpetric titpetric marked this pull request as ready for review September 12, 2024 09:13
    @titpetric titpetric requested a review from a team as a code owner September 12, 2024 09:13
    Copy link
    Contributor

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 4 🔵🔵🔵🔵⚪
    🧪 PR contains tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Performance Concern
    The implementation of GranularAccessMiddleware.ProcessRequest may lead to performance issues due to the repeated compilation of regex patterns within a loop (lines 100-105). Consider caching compiled regex patterns to avoid recompilation on every request.

    Error Handling
    The function MatchPaths does not properly handle or log errors when regex matching fails. This could lead to missed debugging information or unhandled exceptions. Consider improving error handling and logging in this function.

    Copy link
    Contributor

    github-actions bot commented Sep 12, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Security
    Handle errors from regex compilation explicitly to avoid security risks

    Ensure that the error from regexp.Compile is not just logged but also handled
    appropriately to prevent potential security issues or incorrect behavior if the
    regex is not compiled correctly.

    gateway/mw_granular_access.go [104-109]

     asRegex, err := regexp.Compile(pattern)
     if err != nil {
       logger.WithError(err).Error("error compiling regex")
    -  continue
    +  return errors.New("regex compilation failed"), http.StatusInternalServerError
     }
     
    Suggestion importance[1-10]: 9

    Why: This suggestion addresses a potential security issue by ensuring that errors from regex compilation are handled explicitly, preventing incorrect behavior or vulnerabilities. It is a significant improvement for robustness.

    9
    Performance
    Precompile regex patterns during initialization to enhance performance

    Use a more efficient approach for matching URL paths by compiling regex patterns
    once during initialization instead of recompiling them for every request, which can
    significantly improve performance.

    gateway/mw_granular_access.go [100-111]

    -pattern := httputil.PreparePathRegexp(accessSpec.URL, isPrefixMatch, isSuffixMatch)
    -asRegex, err := regexp.Compile(pattern)
    +// Assume regex patterns are compiled and stored in accessSpec during initialization
    +match := accessSpec.CompiledRegex.MatchString(urlPath)
     
    Suggestion importance[1-10]: 8

    Why: Precompiling regex patterns can significantly improve performance by avoiding repeated compilation during each request. This is a valuable optimization, especially for high-traffic applications.

    8
    Maintainability
    Replace slices.Contains with a custom method existence check function

    Replace the use of slices.Contains with a custom function to check for method
    existence in accessSpec.Methods. This avoids importing the slices package which is
    not necessary for such a simple operation, improving the maintainability and
    reducing external dependencies.

    gateway/mw_granular_access.go [56-58]

    -if !slices.Contains(accessSpec.Methods, r.Method) {
    +if !methodExists(accessSpec.Methods, r.Method) {
       continue
     }
     
    Suggestion importance[1-10]: 7

    Why: This suggestion improves maintainability by reducing external dependencies, which is beneficial for a simple operation like checking method existence. However, the performance gain is minimal, so it is not crucial.

    7
    Refactor logging logic into a separate function to enhance readability and reduce redundancy

    Refactor the logging logic to a separate function to reduce redundancy and improve
    code readability. This function can handle both debug and error logging based on
    parameters.

    gateway/mw_granular_access.go [69-77]

    -if gwConfig.LogLevel == "debug" || err != nil {
    -  logger = logger.WithError(err).WithField("pattern", pattern).WithField("match", match)
    -  if err != nil {
    -    logger.Error("error matching endpoint")
    -  } else {
    -    logger.Debug("matching endpoint")
    -  }
    -}
    +logEndpointMatching(gwConfig.LogLevel, logger, err, pattern, match)
     
    Suggestion importance[1-10]: 6

    Why: Refactoring the logging logic into a separate function improves code readability and maintainability by reducing redundancy. This is a minor improvement and not critical to the functionality.

    6
    Enhancement
    Optimize conditional logic for pattern manipulation

    Refactor the PreparePathRegexp function to avoid redundant checks and concatenations
    by structuring the conditional logic more efficiently.

    internal/httputil/mux.go [48-57]

    -if prefix && strings.HasPrefix(pattern, "/") {
    -    pattern = "^" + pattern
    +if prefix {
    +    pattern = "^" + strings.TrimLeft(pattern, "^")
     }
    -if suffix && !strings.HasSuffix(pattern, "$") {
    -    pattern = pattern + "$"
    +if suffix {
    +    pattern = strings.TrimRight(pattern, "$") + "$"
     }
     
    Suggestion importance[1-10]: 7

    Why: The suggestion improves the code by reducing redundancy and making the logic for adding prefix and suffix more efficient. This enhances code readability and maintainability without altering functionality. However, it is not a critical change, hence a moderate score.

    7

    @titpetric titpetric force-pushed the merge/release-5.3/89bcc579d7db80944fcd48635fe0a7d1cc802348 branch from f314b4e to 54d19e0 Compare September 12, 2024 11:06
    @titpetric titpetric force-pushed the merge/release-5.3/89bcc579d7db80944fcd48635fe0a7d1cc802348 branch from a370cc3 to 3c3f3ea Compare September 12, 2024 12:47
    This considers some necessary improvements:
    
    - [x] revert test to run e2e-combined (e2e only has some CI specific
    issues when running, not seen on local)
    - [x] add cancellation group to CI tests, new commits on PR cancel old
    CI Tests run
    - [x] pass only the merged .cov file to sonarcloud (not all of them)
    - [x] https://tyktech.atlassian.net/browse/TT-12494 (tests issue,
    deleting caches, defer)
    
    The tests are flaky on account they delete the redis cache. Deleting a
    redis cache from a test interferes with other tests that also read/write
    cache data from redis.
    
    ___
    
    enhancement, tests
    
    ___
    
    - Added concurrency settings to the CI workflow to ensure only one
    runner per PR and commit, canceling old runs on new commits.
    - Updated the test command to `test:e2e-combined` to address CI-specific
    issues.
    - Changed the sonar coverage report path to use a merged `.cov` file
    (`gateway-all.cov`).
    - Simplified the package listing command in the test task configuration.
    
    ___
    
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>ci-tests.yml</strong><dd><code>Enhance CI workflow with
    concurrency and test improvements</code></dd></summary>
    <hr>
    
    .github/workflows/ci-tests.yml
    
    <li>Added concurrency settings to CI tests to cancel old runs on new
    <br>commits.<br> <li> Changed test command to
    <code>test:e2e-combined</code>.<br> <li> Updated sonar coverage report
    path to <code>gateway-all.cov</code>.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6508/files#diff-03609cb60b0c6e92fb771eb8787d6722b8c31ca4c03eabc788e147acd8c6fb43">+11/-2</a>&nbsp;
    &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>test.yml</strong><dd><code>Simplify package listing
    command in test task</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    .taskfiles/test.yml
    
    - Simplified the package listing command in the test task.
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6508/files#diff-f1fbe7f7f14888019b8845634ed008e1c43f6e5a5c0b2707336fc7f8e15a36fb">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </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
    
    ---------
    
    Co-authored-by: Tit Petric <tit@tyk.io>
    Copy link

    sonarcloud bot commented Sep 12, 2024

    Quality Gate Failed Quality Gate failed

    Failed conditions
    74.1% Coverage on New Code (required ≥ 80%)
    C Reliability Rating on New Code (required ≥ A)

    See analysis details on SonarCloud

    Catch issues before they fail your Quality Gate with our IDE extension SonarLint

    @titpetric titpetric merged commit beda3fd into release-5.3 Sep 12, 2024
    27 of 28 checks passed
    @titpetric titpetric deleted the merge/release-5.3/89bcc579d7db80944fcd48635fe0a7d1cc802348 branch September 12, 2024 17:54
    @titpetric
    Copy link
    Contributor

    /release to release-5.3.5

    Copy link

    tykbot bot commented Sep 12, 2024

    Working on it! Note that it can take a few minutes.

    Copy link

    tykbot bot commented Sep 12, 2024

    @titpetric Seems like there is conflict and it require manual merge.

    titpetric added a commit that referenced this pull request Sep 12, 2024
    …age, support mux params on legacy (#6506) (#6507)
    
    [TT-12865] Rename config parameter, update usage, support mux params on
    legacy (#6506)
    
    enhancement
    
    ___
    
    - Renamed configuration fields `EnablePrefixMatching` and
    `EnableSuffixMatching` to `EnablePathPrefixMatching` and
    `EnablePathSuffixMatching` respectively, across multiple files.
    - Updated comments and documentation to reflect the new naming
    conventions.
    - Modified test cases to use the updated configuration fields.
    - Refactored middleware and session manager logic to accommodate the new
    path matching configuration.
    
    ___
    
    <table><thead><tr><th></th><th align="left">Relevant
    
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>config.go</strong><dd><code>Rename configuration fields
    for path matching options</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    config/config.go
    
    <li>Renamed <code>EnablePrefixMatching</code> to
    <code>EnablePathPrefixMatching</code>.<br> <li> Renamed
    <code>EnableSuffixMatching</code> to
    <code>EnablePathSuffixMatching</code>.<br> <li> Updated comments to
    reflect the new naming conventions.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-fe44f09c4d5977b5f5eaea29170b6a0748819c9d02271746a20d81a5f3efca17">+12/-12</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>api_definition.go</strong><dd><code>Update API
    definition to use new path matching config</code>&nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-0cf80174bbafb36f6d4f4308ebbd971b2833b76a936bad568220aa1a4ba0ee8b">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access.go</strong><dd><code>Refactor
    middleware to use updated path matching config</code>&nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    gateway/mw_granular_access.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br> <li> Refactored pattern preparation using
    <code>PreparePathRegexp</code>.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-618f7d55751d572562a29506a13beba2da969436e974f8b51df7d9708c925436">+3/-9</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>session_manager.go</strong><dd><code>Update session
    manager for new path matching config</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/session_manager.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-e6b40a285464cd86736e970c4c0b320b44c75b18b363d38c200e9a9d36cdabb6">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>schema.json</strong><dd><code>Update JSON schema for
    path matching configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    cli/linter/schema.json
    
    - Renamed JSON schema fields for path matching options.
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-103cec746d3e61d391c5a67c171963f66fea65d651d704d5540e60aa5d574f46">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definition_test.go</strong><dd><code>Update test
    configuration for path prefix matching</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition_test.go
    
    - Modified test configuration to use `EnablePathPrefixMatching`.
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-2394daab6fdc5f8dc234699c80c0548947ee3d68d2e33858258d73a8b5eb6f44">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access_test.go</strong><dd><code>Update
    middleware test for path prefix matching</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access_test.go
    
    - Modified test configuration to use `EnablePathPrefixMatching`.
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-8e0d7cfef26688edd7d08334d955039dab5deb3caf860d29eff6d09894eaba20">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </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
    
    ---------
    
    Co-authored-by: Tit Petric <tit@tyk.io>
    
    [TT-12865]:
    https://tyktech.atlassian.net/browse/TT-12865?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    
    ___
    
    Enhancement, Tests
    
    ___
    
    - Introduced new configuration options `EnablePathPrefixMatching` and
    `EnablePathSuffixMatching` to enhance URL path matching capabilities.
    - Refactored URLSpec and related logic to support the new path matching
    configuration.
    - Updated middleware and session management to utilize the new path
    matching options.
    - Added comprehensive tests for the new path matching logic, including
    regression tests for issue 12865.
    - Improved logging and error handling in path matching processes.
    
    ___
    
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6
    files</summary><table>
    <tr>
      <td>
        <details>
    <summary><strong>config.go</strong><dd><code>Add configuration for path
    prefix and suffix matching</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    config/config.go
    
    <li>Added new configuration fields <code>EnablePathPrefixMatching</code>
    and <br><code>EnablePathSuffixMatching</code>.<br> <li> Updated comments
    to explain the new path matching configuration.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-fe44f09c4d5977b5f5eaea29170b6a0748819c9d02271746a20d81a5f3efca17">+43/-0</a>&nbsp;
    &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>api_definition.go</strong><dd><code>Refactor URLSpec
    and update path matching logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition.go
    
    <li>Refactored URLSpec to use private fields and methods.<br> <li>
    Updated path matching logic to support new configuration.<br> <li>
    Renamed several functions for clarity.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-0cf80174bbafb36f6d4f4308ebbd971b2833b76a936bad568220aa1a4ba0ee8b">+47/-142</a></td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>model_apispec.go</strong><dd><code>Refactor and
    deprecate CheckSpecMatchesStatus</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/model_apispec.go
    
    <li>Moved <code>CheckSpecMatchesStatus</code> to a separate file and
    deprecated it.<br> <li> Added <code>FindSpecMatchesStatus</code> for
    improved status checking.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-80c49b9bdb411a3d5a4706ec3ff138ef44154d0306040c19eba1cb5559f199d6">+75/-0</a>&nbsp;
    &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>model_urlspec.go</strong><dd><code>Add path and method
    matching methods to URLSpec</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/model_urlspec.go
    
    <li>Added new methods to URLSpec for matching paths and methods.<br>
    <li> Deprecated <code>modeSpecificSpec</code> method.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-ed766dd1814a557a1943cd3483c6ef511ad1b8febc7bd59982792d0ab7e23cff">+120/-0</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access.go</strong><dd><code>Update
    GranularAccessMiddleware for new path matching</code>&nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access.go
    
    <li>Updated middleware to use new path matching configuration.<br> <li>
    Improved logging and error handling in path matching.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-618f7d55751d572562a29506a13beba2da969436e974f8b51df7d9708c925436">+74/-20</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mux.go</strong><dd><code>Refactor path regex
    preparation and matching</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/httputil/mux.go
    
    <li>Refactored path regex preparation and matching functions.<br> <li>
    Improved caching and handling of mux-style parameters.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-3d9ee5f5e946d72e6f2ae662ff03ee5253bbdc15203d2e4f6e9f46c13011ebf8">+78/-18</a>&nbsp;
    </td>
    
    </tr>
    
    </table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>4
    files</summary><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definition_test.go</strong><dd><code>Update and add
    test cases for path matching logic</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition_test.go
    
    <li>Updated test cases to reflect changes in path matching logic.<br>
    <li> Added new test cases for path prefix matching.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-2394daab6fdc5f8dc234699c80c0548947ee3d68d2e33858258d73a8b5eb6f44">+12/-12</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access_test.go</strong><dd><code>Add tests
    for GranularAccessMiddleware path matching</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access_test.go
    
    <li>Added tests for new path matching logic in
    GranularAccessMiddleware.<br> <li> Updated existing tests to use new
    configuration.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-8e0d7cfef26688edd7d08334d955039dab5deb3caf860d29eff6d09894eaba20">+50/-28</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mux_test.go</strong><dd><code>Add tests for path regex
    preparation and matching</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/httputil/mux_test.go
    
    <li>Added tests for new path matching functions.<br> <li> Updated
    existing tests to reflect changes in regex preparation.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-8f7ce1891e221d7adb9e68f2e951f33edfbde2128187abb6e837ac01952d7888">+112/-14</a></td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>issue_12865_test.go</strong><dd><code>Add regression
    tests for issue 12865</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    tests/regression/issue_12865_test.go
    
    <li>Added regression tests for issue 12865.<br> <li> Tested various
    configurations of path prefix and suffix matching.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-1a4f9c47cb4152844d641098b6e7ca8e5e8739eefdec7178f9437750d11db6ec">+171/-0</a>&nbsp;
    </td>
    
    </tr>
    </table></details></td></tr><tr><td><strong>Configuration
    changes</strong></td><td><details><summary>2 files</summary><table>
    <tr>
      <td>
        <details>
    <summary><strong>test.yml</strong><dd><code>Update test task
    configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    .taskfiles/test.yml
    
    <li>Updated test task to exclude the first package in the list.<br> <li>
    Added a task to merge coverage reports.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-f1fbe7f7f14888019b8845634ed008e1c43f6e5a5c0b2707336fc7f8e15a36fb">+2/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>schema.json</strong><dd><code>Update schema for new
    path matching configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    cli/linter/schema.json
    
    - Added new schema fields for path prefix and suffix matching.
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-103cec746d3e61d391c5a67c171963f66fea65d651d704d5540e60aa5d574f46">+6/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    </table></details></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
    
    ---------
    
    Co-authored-by: Tit Petric <tit.petric@monotek.net>
    Co-authored-by: Tit Petric <tit@tyk.io>
    titpetric added a commit that referenced this pull request Sep 12, 2024
    …age, support mux params on legacy (#6506) (#6507)
    
    [TT-12865] Rename config parameter, update usage, support mux params on
    legacy (#6506)
    
    enhancement
    
    ___
    
    - Renamed configuration fields `EnablePrefixMatching` and
    `EnableSuffixMatching` to `EnablePathPrefixMatching` and
    `EnablePathSuffixMatching` respectively, across multiple files.
    - Updated comments and documentation to reflect the new naming
    conventions.
    - Modified test cases to use the updated configuration fields.
    - Refactored middleware and session manager logic to accommodate the new
    path matching configuration.
    
    ___
    
    <table><thead><tr><th></th><th align="left">Relevant
    
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>config.go</strong><dd><code>Rename configuration fields
    for path matching options</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    config/config.go
    
    <li>Renamed <code>EnablePrefixMatching</code> to
    <code>EnablePathPrefixMatching</code>.<br> <li> Renamed
    <code>EnableSuffixMatching</code> to
    <code>EnablePathSuffixMatching</code>.<br> <li> Updated comments to
    reflect the new naming conventions.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-fe44f09c4d5977b5f5eaea29170b6a0748819c9d02271746a20d81a5f3efca17">+12/-12</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>api_definition.go</strong><dd><code>Update API
    definition to use new path matching config</code>&nbsp; &nbsp; &nbsp;
    &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-0cf80174bbafb36f6d4f4308ebbd971b2833b76a936bad568220aa1a4ba0ee8b">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access.go</strong><dd><code>Refactor
    middleware to use updated path matching config</code>&nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    gateway/mw_granular_access.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br> <li> Refactored pattern preparation using
    <code>PreparePathRegexp</code>.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-618f7d55751d572562a29506a13beba2da969436e974f8b51df7d9708c925436">+3/-9</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>session_manager.go</strong><dd><code>Update session
    manager for new path matching config</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/session_manager.go
    
    <li>Updated variable names to use new path matching configuration
    fields.<br>
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-e6b40a285464cd86736e970c4c0b320b44c75b18b363d38c200e9a9d36cdabb6">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>schema.json</strong><dd><code>Update JSON schema for
    path matching configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    cli/linter/schema.json
    
    - Renamed JSON schema fields for path matching options.
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-103cec746d3e61d391c5a67c171963f66fea65d651d704d5540e60aa5d574f46">+2/-2</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    </table></td></tr><tr><td><strong>Tests</strong></td><td><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definition_test.go</strong><dd><code>Update test
    configuration for path prefix matching</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition_test.go
    
    - Modified test configuration to use `EnablePathPrefixMatching`.
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-2394daab6fdc5f8dc234699c80c0548947ee3d68d2e33858258d73a8b5eb6f44">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access_test.go</strong><dd><code>Update
    middleware test for path prefix matching</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access_test.go
    
    - Modified test configuration to use `EnablePathPrefixMatching`.
    
    </details>
    
      </td>
    <td><a
    
    href="https://github.com/TykTechnologies/tyk/pull/6506/files#diff-8e0d7cfef26688edd7d08334d955039dab5deb3caf860d29eff6d09894eaba20">+1/-1</a>&nbsp;
    &nbsp; &nbsp; </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
    
    ---------
    
    Co-authored-by: Tit Petric <tit@tyk.io>
    
    [TT-12865]:
    https://tyktech.atlassian.net/browse/TT-12865?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ
    
    ___
    
    Enhancement, Tests
    
    ___
    
    - Introduced new configuration options `EnablePathPrefixMatching` and
    `EnablePathSuffixMatching` to enhance URL path matching capabilities.
    - Refactored URLSpec and related logic to support the new path matching
    configuration.
    - Updated middleware and session management to utilize the new path
    matching options.
    - Added comprehensive tests for the new path matching logic, including
    regression tests for issue 12865.
    - Improved logging and error handling in path matching processes.
    
    ___
    
    <table><thead><tr><th></th><th align="left">Relevant
    files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><details><summary>6
    files</summary><table>
    <tr>
      <td>
        <details>
    <summary><strong>config.go</strong><dd><code>Add configuration for path
    prefix and suffix matching</code>&nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    config/config.go
    
    <li>Added new configuration fields <code>EnablePathPrefixMatching</code>
    and <br><code>EnablePathSuffixMatching</code>.<br> <li> Updated comments
    to explain the new path matching configuration.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-fe44f09c4d5977b5f5eaea29170b6a0748819c9d02271746a20d81a5f3efca17">+43/-0</a>&nbsp;
    &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>api_definition.go</strong><dd><code>Refactor URLSpec
    and update path matching logic</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition.go
    
    <li>Refactored URLSpec to use private fields and methods.<br> <li>
    Updated path matching logic to support new configuration.<br> <li>
    Renamed several functions for clarity.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-0cf80174bbafb36f6d4f4308ebbd971b2833b76a936bad568220aa1a4ba0ee8b">+47/-142</a></td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>model_apispec.go</strong><dd><code>Refactor and
    deprecate CheckSpecMatchesStatus</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/model_apispec.go
    
    <li>Moved <code>CheckSpecMatchesStatus</code> to a separate file and
    deprecated it.<br> <li> Added <code>FindSpecMatchesStatus</code> for
    improved status checking.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-80c49b9bdb411a3d5a4706ec3ff138ef44154d0306040c19eba1cb5559f199d6">+75/-0</a>&nbsp;
    &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>model_urlspec.go</strong><dd><code>Add path and method
    matching methods to URLSpec</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/model_urlspec.go
    
    <li>Added new methods to URLSpec for matching paths and methods.<br>
    <li> Deprecated <code>modeSpecificSpec</code> method.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-ed766dd1814a557a1943cd3483c6ef511ad1b8febc7bd59982792d0ab7e23cff">+120/-0</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access.go</strong><dd><code>Update
    GranularAccessMiddleware for new path matching</code>&nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access.go
    
    <li>Updated middleware to use new path matching configuration.<br> <li>
    Improved logging and error handling in path matching.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-618f7d55751d572562a29506a13beba2da969436e974f8b51df7d9708c925436">+74/-20</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mux.go</strong><dd><code>Refactor path regex
    preparation and matching</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/httputil/mux.go
    
    <li>Refactored path regex preparation and matching functions.<br> <li>
    Improved caching and handling of mux-style parameters.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-3d9ee5f5e946d72e6f2ae662ff03ee5253bbdc15203d2e4f6e9f46c13011ebf8">+78/-18</a>&nbsp;
    </td>
    
    </tr>
    
    </table></details></td></tr><tr><td><strong>Tests</strong></td><td><details><summary>4
    files</summary><table>
    <tr>
      <td>
        <details>
    <summary><strong>api_definition_test.go</strong><dd><code>Update and add
    test cases for path matching logic</code>&nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/api_definition_test.go
    
    <li>Updated test cases to reflect changes in path matching logic.<br>
    <li> Added new test cases for path prefix matching.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-2394daab6fdc5f8dc234699c80c0548947ee3d68d2e33858258d73a8b5eb6f44">+12/-12</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mw_granular_access_test.go</strong><dd><code>Add tests
    for GranularAccessMiddleware path matching</code>&nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    gateway/mw_granular_access_test.go
    
    <li>Added tests for new path matching logic in
    GranularAccessMiddleware.<br> <li> Updated existing tests to use new
    configuration.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-8e0d7cfef26688edd7d08334d955039dab5deb3caf860d29eff6d09894eaba20">+50/-28</a>&nbsp;
    </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>mux_test.go</strong><dd><code>Add tests for path regex
    preparation and matching</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; </dd></summary>
    <hr>
    
    internal/httputil/mux_test.go
    
    <li>Added tests for new path matching functions.<br> <li> Updated
    existing tests to reflect changes in regex preparation.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-8f7ce1891e221d7adb9e68f2e951f33edfbde2128187abb6e837ac01952d7888">+112/-14</a></td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>issue_12865_test.go</strong><dd><code>Add regression
    tests for issue 12865</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    tests/regression/issue_12865_test.go
    
    <li>Added regression tests for issue 12865.<br> <li> Tested various
    configurations of path prefix and suffix matching.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-1a4f9c47cb4152844d641098b6e7ca8e5e8739eefdec7178f9437750d11db6ec">+171/-0</a>&nbsp;
    </td>
    
    </tr>
    </table></details></td></tr><tr><td><strong>Configuration
    changes</strong></td><td><details><summary>2 files</summary><table>
    <tr>
      <td>
        <details>
    <summary><strong>test.yml</strong><dd><code>Update test task
    configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    </dd></summary>
    <hr>
    
    .taskfiles/test.yml
    
    <li>Updated test task to exclude the first package in the list.<br> <li>
    Added a task to merge coverage reports.<br>
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-f1fbe7f7f14888019b8845634ed008e1c43f6e5a5c0b2707336fc7f8e15a36fb">+2/-1</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    
    <tr>
      <td>
        <details>
    <summary><strong>schema.json</strong><dd><code>Update schema for new
    path matching configuration</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
    &nbsp; &nbsp; &nbsp; </dd></summary>
    <hr>
    
    cli/linter/schema.json
    
    - Added new schema fields for path prefix and suffix matching.
    
    </details>
    
      </td>
    <td><a
    href="https://github.com/TykTechnologies/tyk/pull/6507/files#diff-103cec746d3e61d391c5a67c171963f66fea65d651d704d5540e60aa5d574f46">+6/-0</a>&nbsp;
    &nbsp; &nbsp; </td>
    
    </tr>
    </table></details></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
    
    ---------
    
    Co-authored-by: Tit Petric <tit.petric@monotek.net>
    Co-authored-by: Tit Petric <tit@tyk.io>
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    3 participants