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

Case insensitive check for host restrictions #561

Closed
ErikPelli opened this issue Dec 14, 2024 · 2 comments · Fixed by #565
Closed

Case insensitive check for host restrictions #561

ErikPelli opened this issue Dec 14, 2024 · 2 comments · Fixed by #565

Comments

@ErikPelli
Copy link
Collaborator

Currently the DstHostIs handler is implemented like this:

func DstHostIs(host string) ReqConditionFunc {
	return func(req *http.Request, ctx *ProxyCtx) bool {
		return req.URL.Host == host
	}
}

Suppose we use some handler like this one to block all the requests made to the target host:

proxy.OnRequest(goproxy.DstHostIs("www.reddit.com")).DoFunc(...)

If the user types www.reddit.com, the request would be blocked and an error would be returned.
However, if he types www.ReDDit.com, the request would bypass the restriction and just be accepted because the string is not equal (however the resolved ip from the dns is the reddit server).

@elazarl should we just ignore cases like this? Should we introduce another function where the check is explicit (calling it something like InsensitiveDstHostIs? Or should we directly modify the current one to do a case insensitive check?

@elazarl
Copy link
Owner

elazarl commented Dec 15, 2024

Hmmm... can a dns server elect to be case sensitive? Is there a canonization standard for that?

@ErikPelli
Copy link
Collaborator Author

I've never seen any case sensitive DNS , and I think they don't even exist.
RFC4343 explain explicitly the fact that they should be case insensitive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants