Closed Bug 2072088 Opened 1 month ago Closed 15 days ago

[css-random] Ensure random() values are the same across static cloned documents (print preview)

Categories

(Core :: CSS Parsing and Computation, task)

task

Tracking

()

RESOLVED FIXED
160 Branch
Tracking Status
firefox160 --- fixed

People

(Reporter: sajidanwar, Assigned: sajidanwar)

References

(Blocks 1 open bug)

Details

Attachments

(1 file, 1 external file, 1 obsolete file)

The random() function has a document-level identifier that influences every generated value; and additionally, any functions with an element-scoped key has an element-level identifier that influences those generated values. This is somewhat tricky with Gecko's static cloned documents (Bug 487667) which are used for print previews. Since the document and all elements within are cloned, a simple implementation that uses document/element pointer addresses in the random value generation will generate all new values in a print preview document.

Secondary concern is that since authors have full control of the cache key, they could generate an arbitrary number of hash(--foo + <document-pointer-address>) -> seed -> PRNG value values and possibly reverse engineer the document pointer address. (Maybe, not really any experience with security but this seems plausible and probably shouldn't be allowed.)

Attached file CSS random() + Print Preview (obsolete) —

Test case that generates random widths for bars, and then places tick marks at the computed widths. When the user enters print preview, the bars and tick marks should match. If the bars are different widths and don't match the tick marks, then it means that the random widths changed.

Chrome and Safari retain the random values in print preview. Firefox does not.

Well they retain the whole document, which has its own issues...

Attachment #9642285 - Attachment mime type: text/plain → text/html
Attachment #9642285 - Attachment is obsolete: true
Depends on: 2071165
No longer depends on: 2071971
Assignee: nobody → sajidanwar94
Status: NEW → ASSIGNED
Pushed by sajidanwar94@gmail.com: https://github.com/mozilla-firefox/firefox/commit/ff745ebfb64c https://hg.mozilla.org/integration/autoland/rev/31da9f95ccc0 Ensure random() values are the same across static cloned documents. r=firefox-style-system-reviewers,layout-reviewers,emilio
Status: ASSIGNED → RESOLVED
Closed: 15 days ago
Resolution: --- → FIXED
Target Milestone: --- → 160 Branch
QA Whiteboard: [qa-triage-done-c161/b160]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: