Closed Bug 1837963 Opened 2 years ago Closed 1 year ago

Consider disallowing opening a picker from a background page

Categories

(Core :: DOM: Core & HTML, defect)

defect

Tracking

()

RESOLVED FIXED
136 Branch
Tracking Status
firefox-esr115 --- wontfix
firefox-esr128 --- wontfix
firefox134 --- wontfix
firefox135 --- wontfix
firefox136 + fixed

People

(Reporter: edgar, Assigned: edgar)

References

Details

(Keywords: csectype-spoof, sec-want, Whiteboard: [adv-main136-])

Attachments

(3 files)

(This is split from bug 1828276 comment #8)

I think we should not allow a background page can open a picker and even switch itself to foreground. It's worth to check how other browser behave. However, in general, open a picker requires a user gesture, so blocking a background page from opening a picker should not cause web compatibility problem. Because in most of case "a-background-page == no-user-gesture", unless user interact with the page, switch it to background then tries to open a picker, and expect that work, but I think that is a very corner case.

This is from a fullscreen sec bug, though we have a solution for that, bug 1821884, but not sure if opening-pickers-from-background might cause other bugs, so file this bug for tracking and mark as a sec bug, too.

I'm not sure what this bug is tracking, which leaves me unsure what security rating to give it. Blocking pickers-from-background in cases other than fullscreen? Tracking regressions ("might cause other bugs") from bug 1821884? The "edge case" of opening something from a page and then switching focus to another window/tab before the picker can open? That last one is known to be exploitable on mobile, at least.

This bug is created to track potential issues of opening-pickers-from-background other than fullscreen.

(In reply to Daniel Veditz [:dveditz] from comment #1)

The "edge case" of opening something from a page and then switching focus to another window/tab before the picker can open? That last one is known to be exploitable on mobile, at least.

Do we have a bug on mobile?

Keywords: sec-want
Assignee: nobody → echen
Attachment #9439664 - Attachment description: WIP: Bug 1837963 - Disallow opening file picker from background tab; → WIP: Bug 1837963 - Disallow opening file pickers from background tabs;
Attachment #9439664 - Attachment description: WIP: Bug 1837963 - Disallow opening file pickers from background tabs; → Bug 1837963 - Disallow opening file pickers from background tabs;
Attachment #9444552 - Attachment description: WIP: Bug 1837963 - Introduce nsBaseColorPicker; → Bug 1837963 - Introduce nsBaseColorPicker;
Attachment #9439668 - Attachment description: WIP: Bug 1837963 - Disallow opening color pickers from background tabs; → Bug 1837963 - Disallow opening color pickers from background tabs;
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/36f4b96eb15b Disallow opening file pickers from background tabs; r=geckoview-reviewers,emilio,m_kato https://hg.mozilla.org/integration/autoland/rev/90114d0e72d1 Introduce nsBaseColorPicker; r=win-reviewers,mac-reviewers,emilio,gstoll,mstange https://hg.mozilla.org/integration/autoland/rev/5ed6d107133f Disallow opening color pickers from background tabs; r=geckoview-reviewers,emilio,m_kato https://hg.mozilla.org/integration/autoland/rev/6465dbafe002 apply code formatting via Lando

Backed out for causing build bustages on nsColorPicker.cpp:
https://hg.mozilla.org/integration/autoland/rev/ec9441f956a20c64d517c8cc84f40149939d71ba

Push with bustage
Failure log

[task 2025-01-14T13:08:12.807Z] 13:08:12    ERROR -  /builds/worker/checkouts/gecko/widget/gtk/nsColorPicker.cpp:97:15: error: use of undeclared identifier 'aColorPickerShownCallback'
[task 2025-01-14T13:08:12.807Z] 13:08:12     INFO -     97 |   mCallback = aColorPickerShownCallback;
[task 2025-01-14T13:08:12.807Z] 13:08:12     INFO -        |               ^
Flags: needinfo?(echen)
Flags: needinfo?(echen)
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7c4052454ec2 Disallow opening file pickers from background tabs; r=geckoview-reviewers,emilio,m_kato https://hg.mozilla.org/integration/autoland/rev/d19b71505a16 Introduce nsBaseColorPicker; r=win-reviewers,mac-reviewers,emilio,gstoll,mstange https://hg.mozilla.org/integration/autoland/rev/cd000de4a239 Disallow opening color pickers from background tabs; r=geckoview-reviewers,emilio,m_kato
Pushed by echen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/7907d00425fb Disallow opening file pickers from background tabs; r=geckoview-reviewers,emilio,m_kato https://hg.mozilla.org/integration/autoland/rev/a4ef712fa44d Introduce nsBaseColorPicker; r=win-reviewers,mac-reviewers,emilio,gstoll,mstange https://hg.mozilla.org/integration/autoland/rev/e49da4b8b2d0 Disallow opening color pickers from background tabs; r=geckoview-reviewers,emilio,m_kato

:edgar I see this is a sec want, do we need to uplift this to beta and esr128?

I'd rather let this get some bake time rather than uplifting to Beta in the last week of the cycle. Not super concerned about ESR either, but leaving that option open for now until Edgar has a chance to reply.

Not super concern about ESR, either. And I would like this get some bake time on Beta/Release.

Flags: needinfo?(echen)
QA Whiteboard: [post-critsmash-triage]
Flags: qe-verify-
Regressions: 1949092

I noticed that the behavioral change introduced here does not have any test coverage.

Since the patches have caused a regression (bug 1949092), I decided to not only add test coverage for the regressed functionality, but also a simple test case for the common case (a tab browser), at https://phabricator.services.mozilla.com/D238843 (as test_canOpenModalPicker_in_tab).

See Also: → 1949587
Regressions: 1949587
See Also: 1949587
Whiteboard: [adv-main136-]
Regressions: 1952343
Regressions: 1956266
Group: core-security-release
Duplicate of this bug: 1966445
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: