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

[dev.icinga.com #12829] non-UTF-8 characters creates broken JSON #4703

Closed
icinga-migration opened this issue Sep 29, 2016 · 6 comments · Fixed by #7019
Closed

[dev.icinga.com #12829] non-UTF-8 characters creates broken JSON #4703

icinga-migration opened this issue Sep 29, 2016 · 6 comments · Fixed by #7019
Assignees
Labels
area/api REST API bug Something isn't working
Milestone

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/12829

Created by TheSeal on 2016-09-29 14:36:42 +00:00

Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-11-29 15:06:24 +00:00 (in Redmine)

Icinga Version: 2.5.4
Backport?: Not yet backported
Include in Changelog: 1

I wrote about this on icinga-users without any response.
Since we still thinks this is a bug this is the bug rapport.

We have a check that returns non-UTF-8 characters in its output.
That seems to be just fine for Icinga since it stores the string as is
in the database. But when to access the data through the API things
break since JSON requires strict UTF-8(or higher…).
This also effects livestatus.

We will in our implementation fix this on the client side, but it would be neat if
Icinga would do the sanitation on the server side as you can't always control
the input.

@icinga-migration
Copy link
Author

Updated by gbeutner on 2016-10-04 07:30:14 +00:00

We could fix this by calling Utility::ValidateUTF8 in json.cpp:Encode.

@icinga-migration
Copy link
Author

Updated by micke on 2016-11-29 15:06:24 +00:00

gbeutner wrote:

We could fix this by calling Utility::ValidateUTF8 in json.cpp:Encode.

This also affects output via livestatus, so it would be good if a fix addresses both outputs (maybe the proposed fix will fix both problems, but it was not obvious to me that it would).

@icinga-migration icinga-migration added bug Something isn't working area/api REST API labels Jan 17, 2017
@theseal
Copy link

theseal commented Jan 19, 2017

Since I was reminded of this issue, any update?

@dnsmichi
Copy link
Contributor

That referenced patch is pretty expensive on its own, I doubt that we should add it this way.

@Al2Klimov
Copy link
Member

Al2Klimov commented Apr 27, 2017

@dnsmichi Why "pretty expensive"? (It's technically 1 LOC.)

@dnsmichi
Copy link
Contributor

Look where JSON::Encode is called. That's a fundamental function and as such shouldn't be slowed down for the cost of fixing this bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api REST API bug Something isn't working
Projects
None yet
4 participants