escape_html: stop encoding slash, change apostrophe encoding to ', better docs#662
Open
chris-morgan wants to merge 1 commit intoKeats:masterfrom
Open
escape_html: stop encoding slash, change apostrophe encoding to ', better docs#662chris-morgan wants to merge 1 commit intoKeats:masterfrom
chris-morgan wants to merge 1 commit intoKeats:masterfrom
Conversation
The OWASP XSS cheat sheet is a very badly-written document that hasn’t been maintained and still contains various errors that have lasted more than a decade, in some cases despite them being pointed out. Also the section being quoted here was being misapplied anyway (it’s only for *text*, not for attribute values, and it therefore escapes *way* more than is needed). The entire document urgently needs to be completely rewritten, but they’re not doing it. Hence in part my removal of any citation of it. One recently exorcised ancient error is the recommendation to escape slashes: <OWASP/CheatSheetSeries#515>. That was *always* spurious, and I want it gone partly under the principle of least encoding but mostly because I’m fed up with URLs being uglified in this way. I’ve also changed the escaping of ' from ' to ', because the reason for avoiding ' is invalid (it was an accidental omission in an early HTML5 spec, long since reinstated, and all user agents always supported it).
Owner
|
It hasn't been ignored though? Just that it will be merged for a future major version as it's breaking imo. |
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.
More details in the commit message.
I propose this as an alternative to #568; I wrote it before checking if someone had already done much the same thing (or else I would probably not have bothered—though I also have a vague feeling that I knew about #568 last year but have forgotten about it since), but I think my patch is more thorough.
I also propose that this shouldn’t be considered a breaking change; anything that depended on slash being escaped as
/was already catastrophically wrong; if you want to compare equality of serialised HTML (a very dubious operation in general, tests are the only place I’d even consider countenancing it), you need to normalise it first to be correct. I suppose this is the main argument against performing this change in a minor or patch release: you may break some tests, whether you consider those tests Incorrect-with-a-capital-I or not. After writing this out I guess I’m more sympathetic to the breaking-change classification, though I’m still fed up with gratuitously mangled URLs! 🙂/cc @89z