Opened 17 years ago
Closed 14 years ago
#7025 closed New feature (wontfix)
SafeUnicode.split() should return a list of SafeUnicode objects
Reported by: | Thomas Güttler | Owned by: | nobody |
---|---|---|---|
Component: | Core (Other) | Version: | dev |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | yes |
Easy pickings: | no | UI/UX: | no |
Description
Patch is attached.
Attachments (1)
Change History (8)
comment:1 by , 17 years ago
Patch needs improvement: | set |
---|---|
Triage Stage: | Unreviewed → Accepted |
comment:2 by , 17 years ago
Yes, Mallcolm, you are right. I updated my patch. It now overwrites splitlines() (that's what I intended with split()).
The patch overwrites strip, rstrip and lstrip, too. And it includes a unittest.
There is still a rare condition where splitlines() can fail: Inside a CDATA section. But I think it is safe to ignore this.
Do you still think this patch needs improvement?
by , 17 years ago
Improved patch: Overwrite splitlines() and not split()
comment:3 by , 16 years ago
Cc: | removed |
---|---|
Resolution: | → wontfix |
Status: | new → closed |
comment:4 by , 16 years ago
Patch needs improvement: | unset |
---|---|
Resolution: | wontfix |
Status: | closed → reopened |
It is unclear why this was closed wontfix. Malcolm accepted the ticket and asked for an improved patch, which was provided. Even if the original submitter is no longer able to pursue the problem, the improved patch should be considered to fix the reported problem (since accepting implies the problem is real), correct?
comment:5 by , 14 years ago
Patch needs improvement: | set |
---|
If there are cases where splitlines can fail to behave correctly with the proposed change, then we shouldn't do it, since it is security related (i.e. XSS attacks). The author didn't give a reason why we can safely ignore those circumstances. (Those circumstances being 'rare' isn't good enough, it needs to be 'never'). The other improvements (strip methods) are welcome though. Marking as 'needs improvement' on that basis.
comment:6 by , 14 years ago
Severity: | → Normal |
---|---|
Type: | → New feature |
comment:7 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | reopened → closed |
I (the original author of this ticket) will close this again: safestring.splitlines() ist not safe! Your content could include
CDATA sections with newlines. Please leave this closed.
If I do something like this
the first component is no longer safe, since it contains an unescaped ampersand.
You might be able to come up with some extra logic to work around all those possibilities, but it might also end up making the resulting function a lot slower. Probably worth it if you can work around those cases without too much penalty, though.
See what you can come up with.