question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Important - HTML does not get escaped in failed test reports

See original GitHub issue

Describe the bug

If tests fails, a user (student, tutor, instructor) can click on the underlined x of y passing to see more details. A modal opens up and shows the error that got reported. In case of JUnit, the error looks like this internally:

expected:<Nieder mit den Eisb[ä]ren!> but was:<Nieder mit den Eisb[�]ren!>

This however is not what is shown: pgdpError2

Because it is not escaped, and transforms into (partly by the browser): pgdpError

This can easily be further extended to: pgdpError4

and could lead to big problems, in addition to students not getting a helpful error message.

To Reproduce

  1. Create Java programming exercise
  2. Set it up to test for String equality (no String can contain linebreaks, otherwise the HTML is rendered differently - but still wrong - again) using assertEquals
  3. Solve the exercise and make a mistake, but only in the middle of the String (because <[… seems to be no problem to display)
  4. Submit and take a look at the report shown by artemis, also using the dev-view of the web browser

Expected behavior

HTML special characters must be escaped.

Environment

 - OS: Windows 10 (1903)
 - Browser Vivaldi (2.8; Chromium 77 based)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
jpberniuscommented, Nov 1, 2019

Hi @MaisiKoleni, yes, planning to release this today.

0reactions
MaisiKolenicommented, Nov 1, 2019

I thank all of you very much for the fast fix. I assume this will be integrated in the maintenance today? Because that would allow me to remove some workarounds. And thanks again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to escape HTML - javascript - Stack Overflow
No, once the text is in the DOM, the concept of "escaping" it doesn't apply. The HTML source text needs to be escaped...
Read more >
Summarized test results: HTML escapes - W3C
To see detailed results for a single test, click on the link in the Details column and look just above the table. The...
Read more >
simpletest_log_read() does not escape error messages [#2415671 ...
Enable the Simpletest module. Log in as administrator. Go to admin/config/development/testing and run the ExceptionHandlingTest. When the test results are ...
Read more >
10.1. Preventing Cross Site Scripting Vulnerabilities
Escape always. Assume that all data is untrusted and escape it appropriately. Do not try to determine whether data could or could not...
Read more >
Auto-escaping and output formats - Apache FreeMarker Manual
A value of that type is a piece of text that's already in the output format (like HTML), and hence needs no further...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found