Page MenuHomePhabricator

Bug 1891234, additional filename filter checks, r=gijs
ClosedPublic

Authored by NeilDeakin on Apr 25 2024, 6:32 PM.
Referenced Files
Unknown Object (File)
Oct 13 2025, 4:00 AM
Unknown Object (File)
Oct 12 2025, 9:02 PM
Unknown Object (File)
Oct 10 2025, 2:20 PM
Unknown Object (File)
Oct 10 2025, 12:09 PM
Unknown Object (File)
Oct 10 2025, 9:45 AM
Unknown Object (File)
Oct 10 2025, 2:53 AM
Unknown Object (File)
Oct 7 2025, 10:25 AM
Unknown Object (File)
Sep 10 2025, 4:37 PM

Diff Detail

Event Timeline

phab-bot changed the visibility from "Custom Policy" to "Custom Policy".
phab-bot changed the edit policy from "Custom Policy" to "Custom Policy".
phab-bot added a project: Restricted Project.
phab-bot added subscribers: Laraweron, rkraesig, mccr8 and 2 others.

Wasn't sure whether to make this change Windows-specific. Thoughts?

Wasn't sure whether to make this change Windows-specific. Thoughts?

Just speaking personally, as a Linux user, I'd generally prefer U+005F to U+0020 as a replacement character.

Wasn't sure whether to make this change Windows-specific. Thoughts?

Just speaking personally, as a Linux user, I'd generally prefer U+005F to U+0020 as a replacement character.

I would concur with this sentiment, fwiw.

uriloader/exthandler/nsExternalHelperAppService.cpp
3680–3681

Instead of matching that, can we change the extension filter to match the underscore bits? Given the source of this bug that feels safer - or am I missing something here?

uriloader/exthandler/nsExternalHelperAppService.cpp
3680–3681

https://bugzilla.mozilla.org/show_bug.cgi?id=1891234#c9 suggests that we shouldn't change the filepicker handling.

This part doesn't relate to the underscore change. This handles when the filename is, for example 'sample. png'

This seems reasonable to me.

Can we move the new test coverage to a separate patch/bug that we land after this makes it to release, so as not to paint quite such a bulls-eye on the vulnerability?

uriloader/exthandler/nsExternalHelperAppService.cpp
3671–3672

This is a useful statement of fact, but can we extend the comment to include what we're doing in response and why? I _think_ that means something like:

to avoid "duplicate" '. png.png' type suffixes, strip out whitespace from the extension part of the filename here

but I'm not sure.

This revision is now accepted and ready to land.Apr 30 2024, 11:01 AM

This revision requires a Testing Policy Project Tag to be set before landing. Please apply one of testing-approved, testing-exception-unchanged, testing-exception-ui, testing-exception-elsewhere, testing-exception-other. Tip: this Firefox add-on makes it easy!

This revision now requires review to proceed.May 6 2024, 1:58 PM
This revision is now accepted and ready to land.May 6 2024, 2:43 PM
This revision is now accepted and ready to land.May 6 2024, 7:40 PM

The QuotaManager code seems to have a separate set of constants that it expects to be identical to FILE_ILLEGAL_CHARACTERS but also expects certain characters -- in this case the percent sign -- not to be in that constant. The filenames it uses are escaped urls which often contain percent signs. Fixing that seems to require more work and a better understanding of that code, so I'm just handling the percent sign separately as it is only an issue with the Windows file picker, and will file a separate bug on the QuotaManager sanitization.

This still seems reasonable to me; let's make sure we have that follow-up for QM.

This revision is now accepted and ready to land.May 10 2024, 9:29 PM
phab-bot changed the edit policy from "Custom Policy" to "Custom Policy".
phab-bot added a project: Restricted Project.
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Mar 6 2025, 2:02 AM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed projects: Restricted Project, Restricted Project, secure-revision.