-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Watcher: Add whitelist to HttpClient #36817
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
Watcher: Add whitelist to HttpClient #36817
Conversation
This adds a configurable whitelist to the HTTP client in watcher. By default it allows everything is does not, but there is a dynamically configurable setting named "xpack.http.hosts.whitelist" that allows to configure an array of hosts, which can also contain simple regexes. TODO: - Should we match against a host list or really against URLs? Right now you cannot filter http vs https which might be quite the feature - fix the code TODO and cast properly - Is a blacklist needed on top of a whitelist? - Should we block certain things by default as mentioned in the issue? Closes elastic#29937
|
Pinging @elastic/es-core-features |
I think we should support the full URI and not just the host. Some large organizations do path based routing over dns for operational reasons (shared wildcard certs, SSO, etc), and they may to limit access to specific paths within a company's host. I think we should also support a URL with our with the
I don't think so. More of a personal opinion then anything ... but I have found when having both it is harder to understand which one to configure and how the precedence works for anything but the trivial case.
I think this gets tricky to get right and can lead to a false sense of increased security by providing these defaults. However, I think it may help, but the real answer is to require a white list. |
|
I changed the setting to be an URL like |
|
Removed the always whitelisting feature for slack/PD/pagerduty. If someone is using this feature, they could easily add the respective endpoints themselves. Documentation was added. TODOs were removed. I think this is ready for a first review. Jake: I intentionally did not introduce another |
hub-cap
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
| } | ||
| } | ||
|
|
||
| public void testToStringDoesNotContainAuthorizationheader() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice fix right here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
jakelandis
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a question and a couple nit picks, but LGTM as-is
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java
Outdated
Show resolved
Hide resolved
x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/common/http/HttpClient.java
Show resolved
Hide resolved
...lugin/watcher/src/test/java/org/elasticsearch/xpack/watcher/common/http/HttpClientTests.java
Outdated
Show resolved
Hide resolved
| } | ||
| } | ||
|
|
||
| public void testToStringDoesNotContainAuthorizationheader() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++
|
@elasticmachine retest this please |
|
applied all the requests changes. I also changed the setting from |
|
still LGTM |
same |
This adds a configurable whitelist to the HTTP client in watcher. By
default it allows everything is does not, but there is a dynamically
configurable setting named "xpack.http.hosts.whitelist" that allows to
configure an array of urls, which can also contain simple regexes.
TODO:
Closes #29937