TykTechnologies / tyk

Tyk Open Source API Gateway written in Go, supporting REST, GraphQL, TCP and gRPC protocols
Other
9.75k stars 1.09k forks source link

Merging to release-5.7.0: [TT-13507] Fix for custom domains with substring listen path (#6705) #6724

Closed buger closed 4 days ago

buger commented 4 days ago

User description

TT-13507 Fix for custom domains with substring listen path (#6705)

User description

Actual fix for domain matching edge case related to substring listen paths. Fixed the sorting function for the listen paths and added some unit tests.

Extra: httpbin service not working on macos with apple silicon; now it does

Description

Related Issue

Motivation and Context

How This Has Been Tested

Screenshots (if appropriate)

Types of changes

Checklist


PR Type

Bug fix, Configuration changes


Description


Changes walkthrough ๐Ÿ“

Relevant files
Bug fix
api_loader.go
Fix domain sorting logic in API loader                                     

gateway/api_loader.go
  • Modified sorting logic for API specs by domain.
  • Changed comparison from domain length to lexicographical order.
  • +1/-1     
    Configuration changes
    httpbin.yml
    Specify platform for httpbin service in Docker configuration

    docker/services/httpbin.yml - Added platform specification for httpbin service.
    +1/-0     

    ๐Ÿ’ก PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information


    PR Type

    Bug fix, Configuration changes


    Description


    Changes walkthrough ๐Ÿ“

    Relevant files
    Bug fix
    api_loader.go
    Refactor domain sorting logic in API loader                           

    gateway/api_loader.go
  • Introduced a new function sortSpecsByListenPath to handle sorting.
  • Changed sorting logic to prioritize listen path length over domain
    length.
  • Ensured empty domains are sorted to the end.
  • +15/-8   
    Configuration changes
    httpbin.yml
    Specify platform for httpbin service in Docker configuration

    docker/services/httpbin.yml
  • Added platform specification linux/amd64 for the httpbin service.
  • +1/-0     
    Additional files (token-limit)
    api_loader_test.go
    ...                                                                                                           

    gateway/api_loader_test.go ...
    +8888/-1

    ๐Ÿ’ก PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    github-actions[bot] commented 4 days ago

    PR Reviewer Guide ๐Ÿ”

    Here are some key observations to aid the review process:

    **๐ŸŽซ Ticket compliance analysis ๐Ÿ”ถ** **[6705](https://github.com/TykTechnologies/tyk/issues/6705) - Partially compliant** Fully compliant requirements: - Fix domain matching edge case related to substring listen paths. - Update the sorting function for listen paths. - Address compatibility issues with httpbin service on macOS with Apple Silicon. Not compliant requirements: - Add unit tests for the new sorting logic.
    โฑ๏ธ Estimated effort to review: 2 ๐Ÿ”ต๐Ÿ”ตโšชโšชโšช
    ๐Ÿงช No relevant tests
    ๐Ÿ”’ No security concerns identified
    โšก Recommended focus areas for review

    Sorting Logic
    The new sorting logic for API specs needs to be validated to ensure it correctly prioritizes domains and listen paths as intended.
    github-actions[bot] commented 4 days ago

    PR Code Suggestions โœจ

    No code suggestions found for the PR.

    github-actions[bot] commented 4 days ago

    API Changes

    no api changes detected
    andrei-tyk commented 4 days ago

    /release to release-5.3-lts

    tykbot[bot] commented 4 days ago

    @andrei-tyk Release branch not found

    andrei-tyk commented 4 days ago

    /release to release-5.3

    tykbot[bot] commented 4 days ago

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

    tykbot[bot] commented 4 days ago

    @andrei-tyk Succesfully merged PR