-
Notifications
You must be signed in to change notification settings - Fork 189
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
Fixes #1266: modifies sanitize.js to allow Telescope to parse img tags with data uris #1282
Conversation
* added two more http and https schema tests for img tag with a data uri src * added blockquote test and cite sanitation
So this is my first solo rebase that I did because I had like 3 commits and figured it'd be too messy. I also pushed them to my origin by accident, so I |
@chrispinkney can you fix the title of this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you also add a test for protocol-less URLs? (i.e., <img src="//www.telescope.com/image.jpg" />
)
Ah nvm, misread. Will do. |
Is this better? |
@chrispinkney @humphd I wonder why the github action for macos failed. Should we retry with another push with a revised single commit and see if all are passed? Right now one check has failed. This is the error in the macos build |
That failure is not actually causing the tests to fail (i.e, the test expects the failure). What's causing the failure is some process hanging and blocking the tests from exiting correctly (see #1284):
|
@humphd I noticed that too. So I guess this PR is good to go then if thats the case |
…rse img tags with data uris (Seneca-CDOT#1282) * fixes issue-1266, adds a test to ensure data URIs are sanitized properly * added two more http and https schema tests for img tag with a data uri src * added blockquote test and cite sanitation * removed irrelevant test, removed allowed attribute, and added a protocolless test. * added helpful comment regarding mixed content to img tag over http test
Issue This PR Addresses
Fixes #1266
Type of Change
Description
sanitize.js
to allow forimg
tags to usedata
uris assrc
so they can be successfully parsed and indexed by Telescope.data
uris are sanitized properly.http
andhttps
schema tests forimg
tag with a data urisrc
.blockquote
test
andcite
sanitation.Hey everyone!
As per issue #1266, this PR allows images which have a
src
data
uri type to be properly indexed. It passes all the tests on my end thus showing that data uris are being allowed by Telescope.I tried to ensure that this works as expected by purging my redis db via
docker exec -it telescope_redis_1 redis-cli flushall
but it seems that once a post is indexed, it is how it is and forever shall be the way it was initially indexed. So instead of going back in time I disallowed all html attributes and waited for a post to come in. Once one arrived I noticed that it had no tags at all, just plaintext, so I reverted back to normal and allowedimg
s with a data uri.While this isn't exactly a perfect sign that everything works as expected, given that
npm test sanitize-html
runs and returns that all tests pass, and specifically:<img src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==" />
returned as expected, I feel that Telescope should now properly parseimg
s with a data uri.Let me know, thanks!
Checklist