convert special chars to avoid xss#6
Open
dneustadt wants to merge 3 commits intoActionRetro:mainfrom
dneustadt:patch-1
Open
convert special chars to avoid xss#6dneustadt wants to merge 3 commits intoActionRetro:mainfrom dneustadt:patch-1
dneustadt wants to merge 3 commits intoActionRetro:mainfrom
dneustadt:patch-1
Conversation
Contributor
|
After #21 got merged there's a few conflicts now, mostly because the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
I watch your YouTube channel and really enjoy your content. I think these projects for enabling older machines to use the modern web are great so I thought I should have a quick look to see if I can contribute some advice.
I don't know if you're familiar with the concept of XSS or cross-site scripting attacks. In short they allow strangers to use your website as a disguise to run scams, phish for password etc.
As it stands, user inputs aren't safely escaped, which means it is possible to use special characters, like double-quotes, to inject markup or even JavaScript code into the site.
Fore example searching for
"><script>alert('hi i\'m friendly neighbourhood XSS attack :)');</script><img src="will actually run that JavaScript code. Where it really becomes a critical issue is that you can take that search query link and send it to someone: http://frogfind.com/?q=%22%3E%3Cscript%3Ealert%28%27hi+i%5C%27m+your+friendly+neighbourhood+XSS+attack+%3A%29%27%29%3B%3C%2Fscript%3E%3Cimg+src%3D%22Most users won't study a link and just open it and that's where I use your trustworthy site to run my code on the end users machine. That's when I could ask for a password etc...
The changes I committed will prevent these kind of XSS attacks. While you did use
strip_tagsfor the text output you didn't escape the query value within the input value, which as you can see above is very easy to break out of. Aside from being more securehtmlspecialcharswill also allow users to search for HTML tags for example<title>and it will now show what you searched as it doesn't strip tags but instead converts the<and>to safe html entities which won't be interpreted as html.Hope this helps. Keep up the great work :)