Closed Bug 475216 Opened 16 years ago Closed 7 years ago

CSS serialization doesn't escape characters that need escaping

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: jruderman, Unassigned)

References

Details

(Keywords: sec-low, testcase)

Attachments

(1 file)

      No description provided.
Some of these are more than just escaping issues, like the IsPseudoElement function in nsCSSStyleRule.cpp, and perhaps bug 280443.
Bug 478160 and bug 481591 helped a few of the problems here, but there's still a good bit more to fix.
QA Contact: general → style-system
Depends on: 280443
Target Milestone: --- → mozilla13
Version: Trunk → 15 Branch
OS: Mac OS X → All
Hardware: x86 → All
Target Milestone: mozilla13 → ---
Version: 15 Branch → Trunk
This can lead to security surprises for sites that sanitize user-generated CSS per spec and then use "elem.innerHTML += ...":

http://www.slideshare.net/x00mario/the-innerhtml-apocalypse
Keywords: sec-low
Blocks: xss
Current behavior across different browsers:

Firefox (Stylo & non-Stylo):
a\:b > \: { counter-increment: \d \\ 1; font-family: \;; }

Chrome:
a\:b > \: { counter-increment: \d \\ 1; font-family: ";"; }

Edge:
a:b > : { font-family: ;; }

I have no idea what the "correct" behavior is supposed to be here.
Has Regression Range: --- → irrelevant
All our escaping in the serialization in that test appears to be correct.  (That Chrome turns the identifier list font-family name into a string isn't a huge deal, though I think our serialization is very slightly more defensible.)

The one thing that looks incorrect is the inclusion of the "1" in the counter-increment serialization.  It looks like Firefox, Chrome and Safari all include the 1 but Edge doesn't.  While 1 is the amount that the counter would increment by default when not specified, this shouldn't affect what the specified value actually serializes to.
Filed bug 1408257 for the counter-increment serialization issue.  Since the escaping issues here are fixed, closing this bug.
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: