dodona-edu / judge-turtle

🐢 Python Turtle judge for the Dodona learning environment
GNU Affero General Public License v3.0
0 stars 1 forks source link

Images are not shown in output #66

Closed niknetniko closed 1 month ago

niknetniko commented 1 year ago

When submitting solutions for the Turtle judge, I can't seem to get the images to work:

image

Tested in both Firefox and Chrome.

(Not entirely sure if this is a turtle judge issue or a Dodona issue, but I'll move the issue to the correct repo if necessary)

BTWS2 commented 1 year ago

Thank you for notifying me. Images form submissions that worked correctly in the past are also gone (e.g. https://dodona.ugent.be/nl/submissions/11622640/), but the code from the judge didn't change. This leads me to believe this is a Dodona issue.

jorg-vr commented 1 year ago

Summary of slack discussion:

data:image/svg+xml is no longer supported due to security concerns (see https://github.com/rails/rails-html-sanitizer/pull/147)

I suggest to render svg's inline instead of as an image. This allows for proper sanitizing by rails.

jorg-vr commented 1 year ago

In the code png versions of the images are calculated but never used, so using this might be an option as well if simply inlining the svg does not work. (But inlining the svg still seems prefered as it would also lower complexity of the judge) https://github.com/dodona-edu/judge-turtle/blob/3f3ba3d70f95d42646a4c891bdd8b273a4812169/turtle_judge.py#L71-L94

BTWS2 commented 1 month ago

data:image/svg+xml is no longer supported due to security concerns. SVG's are now shown inline. This commit fixed the render: https://github.com/dodona-edu/judge-turtle/commit/39bd9cfd052d5de8ccef5482e05c9c6be6bba081.

The polyline tag wasn't allowed as a tag. This was fixed by: https://github.com/dodona-edu/dodona/pull/5853.