0

mac: Prevent GetLoginFileList() from mounting volumes from login items

If a user has a network volumes listed in login items, calling
LSSharedFileListItemCopyResolvedURL() will cause an attempt to mount
those volumes. This is confusing behavior because it is not relevant to
the user's action (which is likely installing PWA or Chrome extension
with a background page). Also the name "GetLoginFileList" doesn't
indicate there is any such side-effect expected.

Using kLSSharedFileListDoNotMountVolumes flag will prevent this
behavior.

Bug: 1220000
Change-Id: I3995c437891b558312d8994b030cfb3c0633ffc2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2964074
Reviewed-by: Mark Mentovai <mark@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Cr-Commit-Position: refs/heads/master@{#894616}
This commit is contained in:
Lukas Weber
2021-06-22 11:07:02 +00:00
committed by Chromium LUCI CQ
parent a55e7eb677
commit d23a60c7cf

@ -78,8 +78,11 @@ class LoginItemsFileList {
reinterpret_cast<LSSharedFileListItemRef>(login_item);
#pragma clang diagnostic push // https://crbug.com/1154377
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
ScopedCFTypeRef<CFURLRef> item_url(
LSSharedFileListItemCopyResolvedURL(item, 0, nullptr));
// kLSSharedFileListDoNotMountVolumes is used so that we don't trigger
// mounting when it's not expected by a user. Just listing the login
// items should not cause any side-effects.
ScopedCFTypeRef<CFURLRef> item_url(LSSharedFileListItemCopyResolvedURL(
item, kLSSharedFileListDoNotMountVolumes, nullptr));
#pragma clang diagnostic pop
if (item_url && CFEqual(item_url, url)) {