Restrict Host header values for TequilAPI - #3985
Conversation
5436423 to
85e5c96
Compare
Codecov Report
@@ Coverage Diff @@
## master #3985 +/- ##
==========================================
+ Coverage 43.45% 43.48% +0.03%
==========================================
Files 325 326 +1
Lines 17100 17148 +48
==========================================
+ Hits 7430 7457 +27
- Misses 8915 8935 +20
- Partials 755 756 +1
Continue to review full report at Codecov.
|
| Value: "127.0.0.1", | ||
| } | ||
| // FlagTequilapiAllowedHostnames Restrict hostnames in requests' Host header to following domains. | ||
| FlagTequilapiAllowedHostnames = cli.StringFlag{ |
There was a problem hiding this comment.
Can this be Hidden: true as we already have a bunch of flags that are printed on --help and this seems like an average person should not care about it.
There was a problem hiding this comment.
Average person doesn't run node CLI!
There are two options:
- We expose this parameter visible and it just adds another line in help output.
- We hide it and whoever uses it will have to open source code to enable remote access by hostname to TequilAPI, otherwise receiving 403 for unknown reason.
I picked second option.
db52fb9 to
1bf4bf6
Compare
1bf4bf6 to
f7fd776
Compare
| FlagTequilapiAllowedHostnames = cli.StringFlag{ | ||
| Name: "tequilapi.allowed-hostnames", | ||
| Usage: "Comma separated list of allowed domains. Prepend value with dot for wildcard mask", | ||
| Value: ".localhost, localhost, .localdomain", |
There was a problem hiding this comment.
Looks complicated compared to controlling with bind address: --tequilapi.address=0.0.0.0:4050.
And now i need to to know hostname thru which I'm gonna call TequiAPI. --tequilapi.address=0.0.0.0 --tequilapi.allowed-hostnames=myst-tunnel-0.
Talking about Docker case here, maybe --tequilapi.allowed-hostnames=. should be default inside Docker?
There was a problem hiding this comment.
Looks complicated compared to controlling with bind address
because it's not a bind address, it's list of domains and suffixes to allow. This syntax is identical to similar list in Firefox proxy settings (list domains to bypass). Pretty much common I'd say.
Talking about Docker case here, maybe --tequilapi.allowed-hostnames=. should be default inside Docker?
Usually docker deployments of node do not expose TequilAPI directly, but there is no way to check it from the inside. Any assumptions on that subject are rather unsafe.
Closes https://github.com/mysteriumnetwork/environment/issues/728
@Waldz this PR introduced potentially breaking change. Requests with Host header not in whitelist will be rejected. If you invoke Tequilapi using some domain name, you may need to adjust
tequilapi.allowed-hostnamesconfig parameter or use CLI argument--tequilapi.allowed-hostnames.Value examples:
".localhost, localhost, .localdomain"- allow Host header values withlocalhostdomain, alllocalhostsubdomains andlocaldomainsubdomains (but notlocaldomainitself!)."."- allows all subdomains of root domain (virtually all domains).