Skip to content

fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 - abandoned - #506

Open
red-hat-konflux[bot] wants to merge 3 commits into
masterfrom
konflux/mintmaker/master/github.com-go-chi-chi-v5-5.x
Open

fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 - abandoned#506
red-hat-konflux[bot] wants to merge 3 commits into
masterfrom
konflux/mintmaker/master/github.com-go-chi-chi-v5-5.x

Conversation

@red-hat-konflux

@red-hat-konflux red-hat-konflux Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
github.com/go-chi/chi/v5 v5.2.5v5.3.0 age confidence

Release Notes

go-chi/chi (github.com/go-chi/chi/v5)

v5.3.0

Compare Source

What's Changed

New Contributors

SECURITY: middleware.ClientIP, a replacement for middleware.RealIP

@​VojtechVitek submitted PR #​967, which introduces middleware.ClientIP — a replacement for middleware.RealIP that closes the three open spoofing advisories:

It also addresses issues outlined at:

middleware.RealIP is deprecated in this PR with pointers to the new API.

The deprecation only adds a // Deprecated: doc comment; the function keeps working for backward compatibility.

Why a new middleware (not "fix RealIP in place")

RealIP has two unfixable design choices: it mutates r.RemoteAddr, and it tries to be a one-size-fits-all default by walking a hard-coded list of headers any client can supply. Per adam-p's "The perils of the 'real' client IP" (which calls chi out by name on this), there is no safe default — the user must pick their trust source explicitly.

The new API

Four middlewares, two accessors. Pick exactly one middleware based on your
infrastructure, read the result with one of the two accessors:

// One of the four. There is no safe default — pick exactly one.
func ClientIPFromHeader(trustedHeader string) func(http.Handler) http.Handler
func ClientIPFromXFF(trustedIPPrefixes ...string) func(http.Handler) http.Handler
func ClientIPFromXFFTrustedProxies(numTrustedProxies int) func(http.Handler) http.Handler
func ClientIPFromRemoteAddr(h http.Handler) http.Handler

// Read the result.
func GetClientIP(ctx context.Context) string         // for logs, rate-limit keys
func GetClientIPAddr(ctx context.Context) netip.Addr // for typed work

Example usage:

// Pick a single ClientIP middleware based on your deployment
  
// Cloudflare.
r.Use(middleware.ClientIPFromHeader("CF-Connecting-IP"))

// Nginx with ngx_http_realip_module.
r.Use(middleware.ClientIPFromHeader("X-Real-IP"))

// Apache with mod_remoteip.
r.Use(middleware.ClientIPFromHeader("X-Client-IP"))

// AWS CloudFront, or any proxy fleet with known CIDRs.
r.Use(middleware.ClientIPFromXFF(
    "13.32.0.0/15",   // CloudFront IPv4
    "52.46.0.0/18",   // CloudFront IPv4
    "2600:9000::/28", // CloudFront IPv6
))

// Behind exactly 2 trusted proxies with dynamic IPs (autoscaling pools,
// ephemeral containers, dynamic CDN edges).
r.Use(middleware.ClientIPFromXFFTrustedProxies(2))

// Server directly on the public internet, no proxy in front.
r.Use(middleware.ClientIPFromRemoteAddr)

And in your handler or downstream middleware:

clientIP := middleware.GetClientIP(r.Context())
// log it, use it as a rate-limit key, etc.

Thanks to @​adam-p, @​c2h5oh, @​rezmoss, @​Saku0512, @​convto, @​Dirbaio, @​jawnsy, @​lrstanley, @​mfridman, @​n33pm, @​pkieltyka for the prior discussions, detailed reviews, advisory reports, and test contributions that shaped this PR.

Full Changelog: go-chi/chi@v5.2.5...v5.3.0


Configuration

📅 Schedule: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

To execute skipped test pipelines write comment /ok-to-test.


Documentation

Find out how to configure dependency updates in MintMaker documentation or see all available configuration options in Renovate documentation.

@github-actions github-actions Bot added the bot label May 22, 2026
@gmcculloug

Copy link
Copy Markdown
Contributor

@coderbydesign @lpichler Looking for feedback on this deprecation warning for middleware.RealIP in the failing test:

Error: server/server.go:205:3: SA1019: middleware.RealIP is deprecated

Ran this through claude with the following guidance:

What middleware.RealIP currently does:

It reads True-Client-IP, then X-Real-IP, then the leftmost X-Forwarded-For 
value, and overwrites r.RemoteAddr with whatever it finds
---
If you want to preserve accurate client IP logging, chi v5.3.0 ships 
proper replacements:

- middleware.ClientIPFromRemoteAddr - use if this proxy is directly on the
  internet (no load balancer in front)
- middleware.ClientIPFromXFF("10.0.0.0/8", ...) - use if behind a trusted load 
  balancer; you specify the trusted CIDR(s) so spoofing is prevented
- middleware.ClientIPFromHeader("X-Real-IP") — use if your infra sets a 
  single dedicated header

The key question is: does the deployment infrastructure in front of this
service set X-Forwarded-For with the real client IP? If yes, the right
replacement is middleware.ClientIPFromXFF(trustedProxyCIDRs...). If you
just want to drop IP logging accuracy and remove the risk, plain removal is 
safe.

@red-hat-konflux
red-hat-konflux Bot force-pushed the konflux/mintmaker/master/github.com-go-chi-chi-v5-5.x branch 2 times, most recently from 8316dad to 57e29e1 Compare June 2, 2026 15:28
@red-hat-konflux red-hat-konflux Bot changed the title fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 - autoclosed Jun 5, 2026
@red-hat-konflux red-hat-konflux Bot closed this Jun 5, 2026
@red-hat-konflux
red-hat-konflux Bot deleted the konflux/mintmaker/master/github.com-go-chi-chi-v5-5.x branch June 5, 2026 09:58
Signed-off-by: red-hat-konflux <126015336+red-hat-konflux[bot]@users.noreply.github.com>
@red-hat-konflux red-hat-konflux Bot changed the title fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 - autoclosed fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 Jun 5, 2026
@red-hat-konflux red-hat-konflux Bot reopened this Jun 5, 2026
@red-hat-konflux
red-hat-konflux Bot force-pushed the konflux/mintmaker/master/github.com-go-chi-chi-v5-5.x branch 2 times, most recently from 57e29e1 to e1b6e37 Compare June 5, 2026 13:27
@EvanCasey13 EvanCasey13 mentioned this pull request Jun 10, 2026
@red-hat-konflux

Copy link
Copy Markdown
Contributor Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@red-hat-konflux red-hat-konflux Bot changed the title fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 fix(deps): update module github.com/go-chi/chi/v5 to v5.3.0 - abandoned Jun 19, 2026
@red-hat-konflux

Copy link
Copy Markdown
Contributor Author

Autoclosing Skipped

This PR has been flagged for autoclosing. However, it is being skipped due to the branch being already modified. Please close/delete it manually or report a bug if you think this is in error.

@EvanCasey13 EvanCasey13 added the DO NOT MERGE For things that need some work/change before merging label Jun 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot DO NOT MERGE For things that need some work/change before merging

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants