Live data from Hacker News

Show HN: HN comments sidebar bookmarklet

gist.github.com

11–14 of 14 posts

Re: Show HN: HN comments sidebar bookmarklet

#11
post #9

Earlier quoted context omitted.

Thank you for spotting this! I updated the code to escape some special characters. For people reading this, the parent comment is referring to this line[1] from a previous revision of the gist. [1]: https://gist.github.com/postmalloc/e2602752d46c5b9dee2446235...

> For people reading this, the parent comment is referring to this line[1] from a previous revision of the gist. That was not the line, it was linking to this innerHTML call: https://gist.github.com/postmalloc/e2602752d46c5b9dee2446235... Also as a defense mitigation I don't think escaping is ever going to be effective, it would be better to create anchor elements directly. With your current approach I can still XSS…

Thanks! For now, I added a warning under the gist. Not that this is an excuse, but I put this together in about 30 minutes using GPT-4 for fun without much consideration about robustness or security. I will maybe try to rewrite it when I find time.

Re: Show HN: HN comments sidebar bookmarklet

#12
post #11

Earlier quoted context omitted.

> For people reading this, the parent comment is referring to this line[1] from a previous revision of the gist. That was not the line, it was linking to this innerHTML call: https://gist.github.com/postmalloc/e2602752d46c5b9dee2446235... Also as a defense mitigation I don't think escaping is ever going to be effective, it would be better to create anchor elements directly. With your current approach I can still XSS…

Thanks! For now, I added a warning under the gist. Not that this is an excuse, but I put this together in about 30 minutes using GPT-4 for fun without much consideration about robustness or security. I will maybe try to rewrite it when I find time.

[deleted]

Re: Show HN: HN comments sidebar bookmarklet

#13
post #11

Earlier quoted context omitted.

> For people reading this, the parent comment is referring to this line[1] from a previous revision of the gist. That was not the line, it was linking to this innerHTML call: https://gist.github.com/postmalloc/e2602752d46c5b9dee2446235... Also as a defense mitigation I don't think escaping is ever going to be effective, it would be better to create anchor elements directly. With your current approach I can still XSS…

Thanks! For now, I added a warning under the gist. Not that this is an excuse, but I put this together in about 30 minutes using GPT-4 for fun without much consideration about robustness or security. I will maybe try to rewrite it when I find time.

Please do! Besides being a fun exercise it’s also a neat idea. Comments from the HN community make the content posted almost always more interesting imho

Re: Show HN: HN comments sidebar bookmarklet

#14
post #13
post #11

Earlier quoted context omitted.

Thanks! For now, I added a warning under the gist. Not that this is an excuse, but I put this together in about 30 minutes using GPT-4 for fun without much consideration about robustness or security. I will maybe try to rewrite it when I find time.

Please do! Besides being a fun exercise it’s also a neat idea. Comments from the HN community make the content posted almost always more interesting imho

I took the advice and updated the code to generate DOM nodes instead of setting HTML directly - it should decrease the risk of XSS
Post reply on HN