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

plaintext log: %0A transformed to cleartext <br /> #324

Closed
GoogleCodeExporter opened this issue Jul 19, 2015 · 15 comments
Closed

plaintext log: %0A transformed to cleartext <br /> #324

GoogleCodeExporter opened this issue Jul 19, 2015 · 15 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. Log a cache on opencaching.pl through OKAPI, comment-format plaintext with 
linebreaks (%0A)
2. The log-entry on the website will contain a <br /> visibly there


What is the expected output? What do you see instead?
It seems that the OKAPI transforms the log to HTML, but the page renders it as 
cleartext

Which revision of OKAPI are you using?
checked with 1055 on oc.pl

Please provide any additional information below.
If I than edit the log, it will be displayed properly formatted in the (html) 
editor and after storing it again also displayed correctly on the page.

Regards
ra_sch

Original issue reported on code.google.com by rsu...@googlemail.com on 5 Nov 2014 at 6:55

@GoogleCodeExporter
Copy link
Author

Both OCDE and OCPL branches behave very "funny" wherever HTML is to be 
displayed. Developers tend to escape/unescape/encode/decode it 4 or 6 times on 
the way from one user's form to other user's screen! And it seems no one knows 
which form is to be stored in the database. That's madness!

I have really tried to cope with this, as you can see in the comments here:

https://code.google.com/p/opencaching-api/source/browse/trunk/okapi/services/log
s/submit.php?r=1028#173

However, I'm not sure if I can without actually looking into OCPL code and 
fixing it in their own repo.

Original comment by rygielski on 16 Nov 2014 at 9:31

@GoogleCodeExporter
Copy link
Author

Posted a new issue in OCPL tracker here:

https://code.google.com/p/opencaching-pl/issues/detail?id=174

Original comment by rygielski on 16 Nov 2014 at 9:34

@GoogleCodeExporter
Copy link
Author

Oh, one more thing (quite important): Have you tested with the correct value of 
'comment_format' parameter? 
http://opencaching.pl/okapi/services/logs/submit.html

Original comment by rygielski on 16 Nov 2014 at 9:45

@GoogleCodeExporter
Copy link
Author

Sorry for the late reply: We use "comment_format=plaintext", which IMO should 
be the correct one.

Original comment by rsu...@googlemail.com on 19 Nov 2014 at 9:52

@GoogleCodeExporter
Copy link
Author

I have triggered a quite vivid discussion among OCPL developers regarding the 
vulnerabilities in the current model. Lots of caveats, but there's a good 
chance the issue will resolve soon enough.

Original comment by rygielski on 20 Nov 2014 at 7:11

@GoogleCodeExporter
Copy link
Author

Original comment by rygielski on 20 Nov 2014 at 10:09

  • Changed state: Accepted
  • Added labels: Priority-High
  • Removed labels: Priority-Medium

@GoogleCodeExporter
Copy link
Author

Original comment by rygielski on 8 Mar 2015 at 6:52

  • Changed state: Blocked
  • Added labels: Priority-Medium
  • Removed labels: Priority-High

@GoogleCodeExporter
Copy link
Author

That does not look very promising...
I figure the oc.pl devs did not come to a conclusion in this area?

Original comment by rsu...@googlemail.com on 8 Mar 2015 at 6:58

@GoogleCodeExporter
Copy link
Author

They did - but currently the fix has been implemented for caches only (which 
doesn't concern us here), not for cache logs. The intent is to apply the same 
fix to cache logs, but it's hard to say when it will be done... :(

Original comment by rygielski on 8 Mar 2015 at 7:22

@GoogleCodeExporter
Copy link
Author

This issue was updated by revision r1070.

Original comment by rygielski on 9 Mar 2015 at 8:30

@GoogleCodeExporter
Copy link
Author

The other day I had a short exchange with harrie klomp from oc.nl and I asked 
myself, if it would be a good idea to just convert on our end (c:geo) and send 
html right away. Should this work on oc.pl today?

Original comment by rsu...@googlemail.com on 30 Apr 2015 at 12:04

@GoogleCodeExporter
Copy link
Author

If this was that easy, then we could do the same on the OKAPI server-side... It 
might solve the problem for some input cases, but not for all of them. C:geo 
and OKAPI may try to make it a little better, but in the end it must be fixed 
in the OCPL code.

Original comment by rygielski on 4 May 2015 at 7:28

@GoogleCodeExporter
Copy link
Author

On the issue page of the Polish code this problem is also mentioned. Please 
look at https://code.google.com/p/opencaching-pl/issues/detail?id=174 . Here  
is also suggested a solution but somehow it looks that no one has the time to 
implement it. On oc.nl i have temporarily changed a line mentioned in #9. I 
hope a programmer can solve this. 

Original comment by henricus...@gmail.com on 5 May 2015 at 6:26

@wrygiel wrygiel added bug and removed Type-Defect labels Jul 20, 2015
@following5
Copy link
Contributor

I have verified the comment_format handling at OCPL. The current status is this:

  • submitting plaintext works fine since commit cb7d222
  • submitting HTML is broken: &lt;text&gt; will be eaten when displaying the comment at OCPL sites

So the this issue - #324 - meanwhile is solved, while there is another issue. This can be solved by the same hack like for plaintext:

            $formatted_comment = str_replace("&amp;", "&amp;#38;", $formatted_comment);
            $formatted_comment = str_replace("&lt;", "&amp;#60;", $formatted_comment);
            $formatted_comment = str_replace("&gt;", "&amp;#62;", $formatted_comment);

@following5
Copy link
Contributor

The latter is fixed by commit 40e3968.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants