-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
[BUG] generic "No OpenSearchException found" error if http.detailed_errors is disabled #4545
Comments
Update my findings: When Providing another example with
If
|
@reta @nknize Sorry for spamming folks here but looking for some guidance on a small but potentially impactful API change. The current behavior when
Does anyone here have more historical context around this behavior? Any and all opinions are welcome. |
@andrross you are right, the number of changes went it to prevent information leaks, may be we could include exception type BUT not the details, for example:
becomes
|
Thanks @reta ! Looking at this a bit more, what do you think about mirroring the logic in ExceptionHelpers.status() with something like the following?
The logic in OpenSearchExceptions would become:
We'd mirror the logic around the known 400 errors with blessed messages. We'd also avoid exposing embarrassing details like a stray NullPointerException :) |
LGTM @andrross, I think it is reasonable alternative |
thanks for the discussion! the suggestion from @andrross would already be an improvement, but e.g. the settings API would then still not report anything useful (i.e. for a caller getting an error it'd still be unclear what he did wrong / what he'd have to change in order to make his call work). the problem is that |
@rursprung I agree with your points. I think we should go ahead with the proposal above that will result in no longer responding with the confusing/unhelpful "No OpenSearchException found" text. Separately, I think we should update the AbstractScopedSettings class to throw OpenSearchExceptions instead of IllegalArgumentException so that the helpful error messages can be reported in all cases. This keeps a fairly conservative approach of not reporting arbitrary exception details when |
i think that's a sensible trade-off, but it's then probably something which should be kept in mind when adding any new exceptions anywhere in the system: you always have to consider whether it should be an |
@xuezhou25 i saw that you implemented part of what was discussed here in #4669 (thanks for that!) and closed this issue here from there.
will you address this in a separate PR? should i raise a new ticket for this? note that it doesn't just affect the line linked in the comment, i count 17 |
@rursprung I created a new issue to throw new OpenSearchExceptions instead of IllegalArgumentException by updating in the AbstractScopedSettings class. OpenSearch/server/src/main/java/org/opensearch/OpenSearchException.java Lines 593 to 598 in 77cff55
will find the root cause of exception and return "Invalid argument". So I am thinking of the way wrapping IllegalArgumentException to an OpenSearchException .Keeping this issue closed. |
Describe the bug
if
http.detailed_errors.enabled: false
is set then the error message in a REST API call will only report back an error message if the exception contains anOpenSearchException
:OpenSearch/server/src/main/java/org/opensearch/OpenSearchException.java
Lines 595 to 608 in 4657716
(note: confusingly enough this method is a static member of
OpenSearchException
but handles anyException
, IMHO it might be better located e.g. in ExceptionsHelper?)there are however (many?) cases where this isn't the case, e.g. when trying to update a setting through the settings API which doesn't support it (fun-fact: i noticed it when trying to update the
http.detailed_errors.enabled
setting). this returns anIllegalArgumentException
instead.To Reproduce
http.detailed_errors.enabled: false
PUT /_cluster/settings
with a setting which doesn't support it, e.g.:with
http.detailed_errors.enabled: false
(as in the reproduction case) it gives the following - useless - response:with the default settings (or explicitly
http.detailed_errors.enabled: true
) it gives the following response:Expected behavior
the error message gives a hint at the cause as here the cause is clearly on the side of the caller. without the message the caller has no way of knowing what to do to fix the issue.
otherwise the message should at least be in the server log, but this isn't the case either (with default log settings). that way no information leakage would happen but it'd still be possible to understand the cause of a failure (for people with access to the system which should be the only ones which can do config updates via APIs).
Plugins
(irrelevant, this is about core functionality)
Screenshots
n/a
Host/Environment (please complete the following information):
OpenSearch 2.2.0 running in a linux container
Additional context
see the following related tickets:
The text was updated successfully, but these errors were encountered: