Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: labstack/echo
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 87a5c22
Choose a base ref
...
head repository: labstack/echo
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5786024
Choose a head ref
  • 20 commits
  • 53 files changed
  • 10 contributors

Commits on May 2, 2026

  1. refactor: use the built-in max/min to simplify the code

    Signed-off-by: criciss <[email protected]>
    criciss committed May 2, 2026
    Configuration menu
    Copy the full SHA
    01b45be View commit details
    Browse the repository at this point in the history
  2. Merge pull request #2966 from criciss/master

    refactor: use the built-in max/min to simplify the code
    aldas authored May 2, 2026
    Configuration menu
    Copy the full SHA
    7d1fed0 View commit details
    Browse the repository at this point in the history

Commits on May 11, 2026

  1. refactor: replace Split in loops with more efficient SplitSeq (#2969)

    * refactor: replace Split in loops with more efficient SplitSeq
    
    Signed-off-by: box4wangjing <[email protected]>
    
    * refactor: replace Split in loops with more efficient SplitSeq
    
    Signed-off-by: box4wangjing <[email protected]>
    
    ---------
    
    Signed-off-by: box4wangjing <[email protected]>
    box4wangjing authored May 11, 2026
    Configuration menu
    Copy the full SHA
    46f2b8b View commit details
    Browse the repository at this point in the history
  2. refactor: modernize code usage using gofix

    Modernizes the codebase using the Go 1.26 gofix tool to adopt newer
    idioms and library features while maintaining compatibility with
    the current toolchain.
    kumapower17 authored and aldas committed May 11, 2026
    Configuration menu
    Copy the full SHA
    03d9298 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    d17c907 View commit details
    Browse the repository at this point in the history

Commits on May 21, 2026

  1. Configuration menu
    Copy the full SHA
    98d99d5 View commit details
    Browse the repository at this point in the history

Commits on May 22, 2026

  1. Fix typos in CSRFConfig comments

    shblue21 authored and aldas committed May 22, 2026
    Configuration menu
    Copy the full SHA
    c08ea0f View commit details
    Browse the repository at this point in the history

Commits on May 28, 2026

  1. fix(binder): MustUnixTime docs say time.Time, not time.Duration

    The non-Must variants (UnixTime, UnixTimeMilli, UnixTimeNano) all say
    "binds parameter to time.Time variable", but the three Must* versions
    copy-pasted the Duration variant's docstring and say time.Duration.
    The function signature on each takes *time.Time. Also dropped the stray
    double space and fixed "nano second" -> "nanosecond" on the
    Nano one while in there.
    
    Signed-off-by: Charlie Tonneslan <[email protected]>
    c-tonneslan authored and aldas committed May 28, 2026
    Configuration menu
    Copy the full SHA
    dac56bc View commit details
    Browse the repository at this point in the history

Commits on Jun 5, 2026

  1. fix(middleware): correct documented KeyAuth KeyLookup default

    DefaultKeyAuthConfig sets KeyLookup to "header:Authorization:Bearer "
    in v5, but the KeyAuthConfig.KeyLookup comment still shows the v4
    default of "header:Authorization". Update the comment to match.
    
    Signed-off-by: leestana01 <[email protected]>
    leestana01 authored and aldas committed Jun 5, 2026
    Configuration menu
    Copy the full SHA
    29727ff View commit details
    Browse the repository at this point in the history

Commits on Jun 8, 2026

  1. fix(middleware/proxy): append RealIP to X-Forwarded-For for WebSocket…

    … requests (#2994)
    
    * <Description>
    
    The proxy middleware's WebSocket path currently sets `X-Forwarded-For` only
    when the header is empty, dropping the proxy's own peer IP from the chain
    whenever upstream proxies had already added entries. This breaks downstream
    services that rely on the "rightmost untrusted" rule to extract the real
    client IP, including echo's own `ExtractIPFromXFFHeader`.
    
    The HTTP path delegates to `net/http/httputil.ReverseProxy`, which appends
    `RemoteAddr` to the existing `X-Forwarded-For` chain — either inline in
    `ServeHTTP`'s default Director path
    ([reverseproxy.go#L519-L531](https://github.com/golang/go/blob/go1.26.3/src/net/http/httputil/reverseproxy.go#L519-L531))
    or via the explicit
    [`(*ProxyRequest).SetXForwarded`](https://github.com/golang/go/blob/go1.26.3/src/net/http/httputil/reverseproxy.go#L82-L96)
    when a `Rewrite` callback is configured. The WebSocket path uses `proxyRaw`,
    which writes the request verbatim via `r.Write(out)`, so this middleware is
    the only place where the appending happens for WebSocket Upgrade requests.
    
    <Change>
    
    Replace the "set if empty" guard with always-append. Read values via map
    access to preserve multi-line `X-Forwarded-For` headers (RFC 9110 §5.3
    allows combining them by joining values with commas).
    
    <Test>
    Added TestProxyWebSocketXForwardedFor exercising 4 cases:
    
    - no incoming X-Forwarded-For → only c.RealIP()
    - single-line single-entry → preserved + c.RealIP() at the tail
    - ingle-line comma-separated → preserved + c.RealIP() at the tail
    - multi-line headers (multiple X-Forwarded-For occurrences) → joined with , + c.RealIP() at the tail
    
    Each case captures the request header at WebSocket Upgrade time inside the
    upstream handler and asserts both the appended tail and the preserved prefix.
    
    <Backwards compatibility>
    The change is additive: existing entries are preserved and the proxy's own
    peer IP is added at the tail. Downstream readers using the standard
    "rightmost untrusted" rule (e.g. echo.ExtractIPFromXFFHeader) see no
    behavioral difference for chains where they already worked, and start
    returning the correct IP for chains where the proxy IP was previously
    dropped.
    
    <Background>
    We hit this in production with an Echo-based WebSocket reverse proxy
    fronting an internal service that uses echo.ExtractIPFromXFFHeader for
    IP-based authorization. Multi-hop deployments (customer proxy → our reverse
    proxy → backend) broke because the reverse proxy's egress IP was missing
    from the chain reaching the backend.
    
    * Set up upstream per test
    kawaway authored Jun 8, 2026
    Configuration menu
    Copy the full SHA
    6a390cb View commit details
    Browse the repository at this point in the history

Commits on Jun 11, 2026

  1. Configuration menu
    Copy the full SHA
    9c748c9 View commit details
    Browse the repository at this point in the history

Commits on Jun 13, 2026

  1. docs: liveness signals in README + public ROADMAP (#3002)

    * docs: add liveness signals to README and a public ROADMAP
    
    - Add dynamic latest-release and last-commit badges (can't go stale)
    - Add positioning vs net/http and an "actively maintained" note
    - Add ROADMAP.md with version policy (v5 current, v4 LTS to 2026-12-31)
      and surface it from the README
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * docs: fix review findings in README/ROADMAP
    
    - Correct net/http interop claim: Echo handlers are not http.Handler;
      interop is via WrapHandler/WrapMiddleware
    - Clarify binding ships with a pluggable validator (not built-in validation)
    - ROADMAP: reference canonical auto-HEAD issue/PR (#2895/#2949) instead of
      the duplicate PRs (#2944/#2937) slated for closure
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
    vishr and claude authored Jun 13, 2026
    Configuration menu
    Copy the full SHA
    b0a3916 View commit details
    Browse the repository at this point in the history
  2. test: lock in v5 group route method-handling (405 + OPTIONS) (#3003)

    * test: guard group catch-all against 405-masking and route shadowing
    
    Adds regression tests around automatic group catch-all (404) route
    registration. v5 removed that auto-registration; if it is restored
    (e.g. PR #2996) these tests ensure it does not bring back the issues
    that motivated the removal:
    
    - wrong HTTP method on an existing group route must still return 405
      (with Allow header), not be masked to 404 by the catch-all;
    - the group catch-all must not shadow concrete sibling routes, root
      routes, or other sibling groups' routes.
    
    All four pass on current master (v5). The 405 test fails against the
    restore-v4-behavior approach in #2996, pinning down that tradeoff.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * test: rewrite group method-handling tests after review
    
    Addresses review of the original regression file (PR #3003): its comments
    described an automatic group catch-all "triggered by middleware" that does
    not exist on master (v5), so the tests passed for the wrong reason and the
    no-op middleware was inert.
    
    Rewrite to assert v5's actual, verified behavior:
    - method mismatch on a group route -> 405 with full Allow header
    - OPTIONS on a registered group route -> 204 with Allow (preflight-relevant)
    - concrete routes resolve; group prefix does not affect root routes
    
    The 405 and OPTIONS tests are real gates: a group-level catch-all (manual or
    the auto-registration proposed in #2996) masks both as 404, which these tests
    would then catch. Drops the false premise, the inert middleware, and the
    in-comment PR reference.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * test: add rewritten group method-handling tests
    
    The previous commit recorded only the deletion of the old file; this adds
    the rewritten suite (group_method_handling_test.go).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * test: add companion test demonstrating group catch-all masking
    
    Addresses final review: converts the "verified empirically" comment into an
    actual test. TestGroupRoute_catchAllMasksMethodHandling registers a group-wide
    catch-all and asserts it masks both the 405 method-mismatch and the automatic
    OPTIONS (204) response as 404 — the regression the 405/OPTIONS gate tests guard
    against. Makes the rationale self-proving in-repo.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
    vishr and claude authored Jun 13, 2026
    Configuration menu
    Copy the full SHA
    4f5ac60 View commit details
    Browse the repository at this point in the history
  3. fix(binder): serialize BindingError to structured JSON (#2771) (#3004)

    * fix(binder): serialize BindingError to structured JSON (#2771)
    
    BindingError embeds *HTTPError but did not implement json.Marshaler, so
    DefaultHTTPErrorHandler's type switch fell through to its default branch
    (the value is a *BindingError, not a *HTTPError), flattening responses to
    {"message":"Bad Request"} and dropping both the field name and the binder
    message — a regression from fbfe216.
    
    Implement MarshalJSON on *BindingError so it takes the handler's
    json.Marshaler branch, restoring the structured {"field":...,"message":...}
    response (the v4.10.2 behavior).
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * docs/test(binder): clarify BindingError JSON + cover empty-message fallback (#2771)
    
    - Note on the struct that serialization goes through MarshalJSON (the json
      tags are documentation only now).
    - Add a test for the empty-message -> status-text fallback branch.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
    vishr and claude authored Jun 13, 2026
    Configuration menu
    Copy the full SHA
    dba8ff6 View commit details
    Browse the repository at this point in the history
  4. fix(binder): include field name in form/struct bind conversion errors (…

    …#2629) (#3005)
    
    bindData had the field name (inputFieldName) in scope but returned bare
    conversion errors, so c.Bind() failures gave no indication of which field
    failed (e.g. "strconv.ParseInt: parsing \"10a\"..."). Wrap the conversion
    errors with the field name using %w so errors.Is/As still work.
    
    Matches the wrap proposed by the reporter in the issue thread. Existing
    tests that asserted the bare message are updated to the field-prefixed form.
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
    vishr and claude authored Jun 13, 2026
    Configuration menu
    Copy the full SHA
    ec9515a View commit details
    Browse the repository at this point in the history
  5. fix(middleware/static): don't double-unescape request path (#2599) (#…

    …3006)
    
    * fix(middleware/static): don't double-unescape request path (#2599)
    
    http.Request.URL.Path is already decoded by net/http, but the static
    middleware unescaped it again by default, so files whose names contain a
    percent sign were not downloadable ("/100%25.txt" -> "invalid URL escape").
    
    Default pathUnescape to false; only the wildcard param from a group route
    (set explicitly below) may still be escaped and is handled by the existing
    DisablePathUnescaping toggle.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * test(static): add percent-encoded traversal-protection case (#2599)
    
    Companion test confirming that defaulting pathUnescape to false does not
    weaken traversal protection — single-, double-, and dot-encoded "../" all
    stay within the served root.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
    vishr and claude authored Jun 13, 2026
    Configuration menu
    Copy the full SHA
    a9ede66 View commit details
    Browse the repository at this point in the history

Commits on Jun 14, 2026

  1. perf: optimize core hot paths (chain, context, binding, responses) (#…

    …3008)
    
    Compile middleware chains once, zero-copy String/HTML/JSONP writes, reuse delayedStatusWriter + context store map, single-key QueryParam fast path, per-type bind metadata cache, precomputed HSTS header, pooled request-ID buffers. No public API changes. Also de-flakes TestStartConfig_WithListenerNetwork (ephemeral port).
    vishr authored Jun 14, 2026
    Configuration menu
    Copy the full SHA
    b1d65e4 View commit details
    Browse the repository at this point in the history
  2. feat(middleware): optional RateLimiterStoreContext for response heade…

    …rs (#2961) (#3007)
    
    * feat(middleware): optional RateLimiterStoreContext for response headers (#2961)
    
    Adds an optional RateLimiterStoreContext interface. When the configured store
    implements AllowContext(c, identifier), the rate limiter calls it instead of
    Allow, giving the store access to the request context so it can set response
    headers such as Retry-After / X-RateLimit-*. Fully backward compatible: stores
    implementing only Allow are unchanged.
    
    This is the optional-interface approach proposed by the maintainer in the issue
    thread; it does not alter the existing Allow interface or the built-in store.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    * feat(middleware): set X-RateLimit-* / Retry-After from built-in store (#2961)
    
    Implements AllowContext on RateLimiterMemoryStore so the default store sets
    X-RateLimit-Limit, X-RateLimit-Remaining, and (on deny) Retry-After headers
    out of the box — mirroring the v4 PR #2985 by @leno23 on the v5 line.
    
    Allow() is refactored to share an internal allow() with AllowContext; the
    optional RateLimiterStoreContext interface (added earlier in this PR) routes
    the middleware to AllowContext when the store implements it.
    
    Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
    
    ---------
    
    Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
    vishr and claude authored Jun 14, 2026
    Configuration menu
    Copy the full SHA
    c9477eb View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    8d1ae9d View commit details
    Browse the repository at this point in the history
  4. Changelog for v5.2.0 (#3010)

    Release v5.2.0. Bumps version.go and adds the changelog entry.
    vishr authored Jun 14, 2026
    Configuration menu
    Copy the full SHA
    5786024 View commit details
    Browse the repository at this point in the history
Loading