-
Notifications
You must be signed in to change notification settings - Fork 437
restrict link protocols in safe mode #230
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
Conversation
Nice, thank you |
@trentm We could probably use a release and new version. I think we're past due ha |
@alanhamlett I may revert this as #233 was brought to my attention. Should urls be unescaped with safe mode on? I think that this patch may need to be more specific in keeping urls unescaped. |
Ok, we shouldn't escape urls when safe mode is on? I can submit a new PR with only the necessary changes, or all if it's reverted? |
Bringing @lopopolo in on this conversation as he made the report. I don't actually know what is the most "correct" way to handle this. aka either:
|
I'd consider the way django handles autoescaping
This patch doesn't escape input; it urlencodes it. URL encoding should be applied to URL parameters. Not HTML content. |
What is "safe_mode" supposed to do? I can't find any documentation about it. If safe mode actually is supposed to break all links (as it does now), why bother converting the link syntax The same applies to images. Why not just remove images instead of leaving a broken image tag, for perfectly innocent image urls, if "safe_mode" is supposed to break all urls. |
@strindhaug safe mode shouldn't break links or images, it should just urlencode them. I htmlencoded them to prevent injecting javascript into elements, but I'll switch to urlencoding to fix this. |
@alanhamlett But url'encoding the whole url does break images and links, because changing Try adding this to
and this to
|
Fixed in #236 thanks everyone! |
Related to #51 and #174.
When
safe_mode
is truthy, only allowshttp
,https
, andftp
protocols in links to prevent XSS.