-
Notifications
You must be signed in to change notification settings - Fork 282
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
Icingaweb2 can't handle properly escaped URIs #3239
Comments
I'm on it, sending the PR once I could test it |
Hello @mhutter and thank you for reporting and providing a solution with unit tests! We'll have a look at it ASAP. Best, |
Hi, Thanks for the report and the PR. @nilmerg Already closed and commented the PR but I'd like to share my thoughts on this. First, there is no doubt that according to RFC 3986 the pipe character should be encoded. We use other characters unencoded that don't conform with the RFC as well. But we have our reasons:
I don't know which chat tool you use. I know and use some which don't parse my content and modify it. Is there an option in your chat tool to paste content raw? So, to sum it up, we won't introduce double encoding which would solve the issue because we would introduce too much complexity and live with the fact that some tools try to be smart and modify our URLs. Best regards, |
Hey @lippserd, thanks for the feedback. However I still think this is an issue. Maybe my fix was flawed, but it's still broken: The problem occurs as soon as you want to send the link to someone. I have yet to find a communications tool which does NOT encode the URIs, and rightly so: most tools have Web frontends at which point they must encode URLs to avoid HTML injection. Example for tools where sharing Icinga links does not work:
|
No, no web app has to URL-encode any URL I write to somebody else because:
If your apps behave like GitHub, you could still copy-and-paste the text (not the link). |
@mhutter: I second that @Al2Klimov and @lippserd sait. I gave Mattermost a quick try, URLs like the following work fine:
However, this one breaks:
So, Mattermost stops on
But this is not the case, The problem seems to be simpler. To me it seems that Mattermost is clearly wrong here. Blind guess: it fails in the included commonmark.js, like in this place:
Using a regular expression is IMO not the right tool to deal with URLs, but that's OT. All weird links I tried worked fine in Thunderbird, could you please show what is failing there for you? Also, examples showing where those other tools are struggling would be helpful. Eventually some of the are also based on CommonMark.js, so fixing that library could fix more of the above. The bug (in MatterMost) seems to trigger only when a special character follows the quotation mark. This link fails:
But this one is fine:
I'd prefer to see those bugs fixed at their origin, but of course the more we understand what problems different tools are facing, the better we can understand what kind of workarounds would eventually help. But as @lippserd already pointed out, all kind of black magic and making assumptions when decoding input are dangerous and can potentially lead to security issues. So, being strict should be the preferred way to go. Hope this helps. Cheers, |
This regex looks solid 😆 |
I did some more digging... there seems to be a lot more stuff broken than I initially thought. For example, when opening links in Chrome from another app, the |
For the record: It never gets replaced. |
I just stumbled across this problem. On MacOS if I click on an URL anywhere (outside of a browser) that contains a |, that gets escaped into %7C, and then icingaweb barfs and fails to deal with it. This means that any way of sharing icingaweb URLS (chat, email, etc.) does not work. The behavior of escaping the pipe is correct according to RFC 3986, so I would expect icingaweb to handle this properly. |
Please pardon me for reusing this old and already closed issue, but I stumbled upon this or a variant of this issue when creating URLs for Icinga Web 2 based on the Icinga 2 API in Icinga/icinga-notifications#112 (comment). It seems like Icinga Web 2 always uses |
Expected Behavior
Icingaweb2 recognizes
%7C
in filter queries as the pipe character.Current Behavior
Possible Solution
un-escape query string using
urldecode()
before parsingSteps to Reproduce (for bugs)
Context
Most chat client do escaping on URLs as they should. This leads to occurences of
|
to be replaced with%7C
.We often send each other links to multiple checks in chat. Clicking those links leads to an icingaweb2 stacktrace.
also see #1803
Your Environment
The text was updated successfully, but these errors were encountered: