chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.41k stars 468 forks source link

Mac: NetworkService Allow custom service/account name values for keychain prompt #2692

Open magreenblatt opened 5 years ago

magreenblatt commented 5 years ago

Original report by Jason Pollack (Bitbucket: Jason Pollack).


When running my application on Mac using version 75+ with NetworkService enabled, I get a prompt on every launch:

MyAppName wants to use your confidential information stored in "Chromium Safe Storage" in your keychain.

This would be confusing and a bit troublesome to our users.

The current workaround of using the ‘--disable-features=NetworkService’ switch works.

magreenblatt commented 5 years ago

This appears to come from KeychainPassword::GetPassword in Chromium. Are you able to set a breakpoint in that method and post the symbolized call stack?

magreenblatt commented 5 years ago

Here’s the call stack from current CEF master (Chromium 75.0.3770.0):

* thread #1, name = 'CrBrowserMain', queue = 'com.apple.main-thread', stop reason = breakpoint 2.1
  * frame #0: 0x000000010f0326ca Chromium Embedded Framework`KeychainPassword::GetPassword(this=0x00007ffeefbf70a8) const at keychain_password_mac.mm:66
    frame #1: 0x000000010f03357f Chromium Embedded Framework`(anonymous namespace)::GetEncryptionKey() at os_crypt_mac.mm:108
    frame #2: 0x000000010f033248 Chromium Embedded Framework`OSCrypt::GetRawEncryptionKey() at os_crypt_mac.mm:137
    frame #3: 0x00000001103c0318 Chromium Embedded Framework`SystemNetworkContextManager::OnNetworkServiceCreated(this=0x0000000100b3bee0, network_service=0x000000016ee2c110) at system_network_context_manager.cc:551
    frame #4: 0x000000010b06ed03 Chromium Embedded Framework`CefContentBrowserClient::OnNetworkServiceCreated(this=0x0000000100916d70, network_service=0x000000016ee2c110) at content_browser_client.cc:1300
    frame #5: 0x000000010720eec4 Chromium Embedded Framework`content::GetNetworkServiceFromConnector(connector=0x0000000100b37230) at network_service_instance.cc:217
    frame #6: 0x000000010720e4d6 Chromium Embedded Framework`content::GetNetworkService() at network_service_instance.cc:119
    frame #7: 0x00000001103b602a Chromium Embedded Framework`ProfileNetworkContextService::CreateNetworkContext(this=0x000000016ee28a60, in_memory=true, relative_partition_path=0x0000000100ab8250) at profile_network_context_service.cc:155
    frame #8: 0x0000000110696afa Chromium Embedded Framework`Profile::CreateNetworkContext(this=0x0000000100b826a0, in_memory=true, relative_partition_path=0x0000000100ab8250) at profile.cc:274
    frame #9: 0x000000010b06ed95 Chromium Embedded Framework`CefContentBrowserClient::CreateNetworkContext(this=0x0000000100916d70, context=0x0000000100b826a0, in_memory=true, relative_partition_path=0x0000000100ab8250) at content_browser_client.cc:1309
    frame #10: 0x000000010793767c Chromium Embedded Framework`content::StoragePartitionImpl::InitNetworkContext(this=0x0000000100ab8230) at storage_partition_impl.cc:1416
    frame #11: 0x0000000107937597 Chromium Embedded Framework`content::StoragePartitionImpl::GetNetworkContext(this=0x0000000100ab8230) at storage_partition_impl.cc:799
    frame #12: 0x000000010795ac86 Chromium Embedded Framework`content::URLLoaderFactoryGetter::HandleNetworkFactoryRequestOnUIThread(this=0x0000000100abc840, network_factory_request=network::mojom::URLLoaderFactoryRequest @ 0x00007ffeefbf8b28, is_corb_enabled=false) at url_loader_factory_getter.cc:301
    frame #13: 0x0000000107940143 Chromium Embedded Framework`content::URLLoaderFactoryGetter::HandleFactoryRequests(this=0x0000000100abc840) at url_loader_factory_getter.cc:152
    frame #14: 0x0000000107936ed9 Chromium Embedded Framework`content::URLLoaderFactoryGetter::Initialize(this=0x0000000100abc840, partition=0x0000000100ab8230) at url_loader_factory_getter.cc:141
    frame #15: 0x0000000107935801 Chromium Embedded Framework`content::StoragePartitionImpl::Create(context=0x0000000100b826a0, in_memory=true, relative_partition_path=0x00007ffeefbf9ad0, partition_domain="") at storage_partition_impl.cc:729
    frame #16: 0x000000010793eabc Chromium Embedded Framework`content::StoragePartitionImplMap::Get(this=0x0000000100a9ac20, partition_domain="", partition_name="", in_memory=true, can_create=true) at storage_partition_impl_map.cc:397
    frame #17: 0x0000000106733330 Chromium Embedded Framework`content::(anonymous namespace)::GetStoragePartitionFromConfig(browser_context=0x0000000100b826a0, partition_domain="", partition_name="", in_memory=true, can_create=true) at browser_context.cc:218
    frame #18: 0x0000000106733204 Chromium Embedded Framework`content::BrowserContext::GetStoragePartition(browser_context=0x0000000100b826a0, site_instance=0x0000000100ab7f90, can_create=true) at browser_context.cc:437
    frame #19: 0x00000001075e1e36 Chromium Embedded Framework`content::(anonymous namespace)::SpareRenderProcessHostManager::MaybeTakeSpareRenderProcessHost(this=0x000000011bdb2a60, browser_context=0x0000000100b826a0, site_instance=0x0000000100ab7f90, is_for_guests_only=false) at render_process_host_impl.cc:565
    frame #20: 0x00000001075e15ab Chromium Embedded Framework`content::RenderProcessHostImpl::GetProcessHostForSiteInstance(site_instance=0x0000000100ab7f90) at render_process_host_impl.cc:3998
    frame #21: 0x00000001078cd447 Chromium Embedded Framework`content::SiteInstanceImpl::GetProcess(this=0x0000000100ab7f90) at site_instance_impl.cc:185
    frame #22: 0x00000001079711f4 Chromium Embedded Framework`content::WebContentsImpl::Init(this=0x000000016787be00, params=0x00007ffeefbfb520) at web_contents_impl.cc:2055
    frame #23: 0x000000010795fa97 Chromium Embedded Framework`content::WebContentsImpl::CreateWithOpener(params=0x00007ffeefbfb520, opener_rfh=0x0000000000000000) at web_contents_impl.cc:788
    frame #24: 0x000000010795f659 Chromium Embedded Framework`content::WebContents::Create(params=0x00007ffeefbfb520) at web_contents_impl.cc:311
    frame #25: 0x000000010b014aa1 Chromium Embedded Framework`CefBrowserHostImpl::Create(create_params=0x00007ffeefbfc000) at browser_host_impl.cc:367
    frame #26: 0x000000010b014223 Chromium Embedded Framework`CefBrowserHost::CreateBrowserSync(windowInfo=0x000000016ee14e50, client=(ptr_ = 0x0000000100b6a060), url=0x000000016ee14eb8, settings=0x000000016ee14ed0, extra_info=(ptr_ = 0x0000000000000000), request_context=(ptr_ = 0x0000000100b69f80)) at browser_host_impl.cc:290
    frame #27: 0x000000010b013b97 Chromium Embedded Framework`(anonymous namespace)::CreateBrowserWithHelper(helper=0x000000016ee14e50)::CreateBrowserHelper*) at browser_host_impl.cc:142
    frame #28: 0x000000010b02c852 Chromium Embedded Framework`void base::internal::FunctorTraits<void (*)((anonymous namespace)::CreateBrowserHelper*), void>::Invoke<void (function=(0x000000016ee03ad0), args=0x000000016ee03ad8)((anonymous namespace)::CreateBrowserHelper*), (anonymous namespace)::CreateBrowserHelper*>(void (*&&)((anonymous namespace)::CreateBrowserHelper*), (anonymous namespace)::CreateBrowserHelper*&&) at bind_internal.h:399
    frame #29: 0x000000010b02c7a2 Chromium Embedded Framework`void base::internal::InvokeHelper<false, void>::MakeItSo<void (functor=(0x000000016ee03ad0), args=0x000000016ee03ad8)((anonymous namespace)::CreateBrowserHelper*), (anonymous namespace)::CreateBrowserHelper*>(void (*&&)((anonymous namespace)::CreateBrowserHelper*), (anonymous namespace)::CreateBrowserHelper*&&) at bind_internal.h:599
    frame #30: 0x000000010b02c742 Chromium Embedded Framework`void base::internal::Invoker<base::internal::BindState<void (*)((anonymous namespace)::CreateBrowserHelper*), (anonymous namespace)::CreateBrowserHelper*>, void ()>::RunImpl<void (functor=(0x000000016ee03ad0), bound=size=1, (null)=std::__1::index_sequence<0UL> @ 0x00007ffeefbfc788)((anonymous namespace)::CreateBrowserHelper*), std::__1::tuple<(anonymous namespace)::CreateBrowserHelper*>, 0ul>(void (*&&)((anonymous namespace)::CreateBrowserHelper*), std::__1::tuple<(anonymous namespace)::CreateBrowserHelper*>&&, std::__1::integer_sequence<unsigned long, 0ul>) at bind_internal.h:672
    frame #31: 0x000000010b02c669 Chromium Embedded Framework`base::internal::Invoker<base::internal::BindState<void (*)((anonymous namespace)::CreateBrowserHelper*), (anonymous namespace)::CreateBrowserHelper*>, void ()>::RunOnce(base=0x000000016ee03ab0) at bind_internal.h:641
    frame #32: 0x00000001030fd59c Chromium Embedded Framework`base::OnceCallback<void ()>::Run(this=0x00007ffeefbfcfd8) && at callback.h:97
    frame #33: 0x000000010b7a0d61 Chromium Embedded Framework`base::TaskAnnotator::RunTask(this=0x0000000100907658, trace_event_name="ThreadController::Task", pending_task=0x00007ffeefbfcfd8) at task_annotator.cc:114
    frame #34: 0x000000010b7cadc1 Chromium Embedded Framework`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(this=0x0000000100907480, continuation_lazy_now=0x00007ffeefbfd100, ran_task=0x00007ffeefbfd0ff) at thread_controller_with_message_pump_impl.cc:363
    frame #35: 0x000000010b7cb217 Chromium Embedded Framework`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoDelayedWork(this=0x0000000100907480, next_run_time=0x00007ffeefbfd1a8) at thread_controller_with_message_pump_impl.cc:286
    frame #36: 0x000000010b96d9ee Chromium Embedded Framework`base::MessagePumpCFRunLoopBase::RunWork(this=0x000000010091ab30) at message_pump_mac.mm:494
    frame #37: 0x000000010b96d8fc Chromium Embedded Framework`::___ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv_block_invoke(.block_descriptor=0x00007ffeefbfd220) at message_pump_mac.mm:464
    frame #38: 0x000000010b63faca Chromium Embedded Framework`base::mac::CallWithEHFrame(void () block_pointer) + 10
    frame #39: 0x000000010b96cb85 Chromium Embedded Framework`base::MessagePumpCFRunLoopBase::RunWorkSource(info=0x000000010091ab30) at message_pump_mac.mm:463
    frame #40: 0x00007fff4f86e155 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    frame #41: 0x00007fff4f86e0fb CoreFoundation`__CFRunLoopDoSource0 + 108
    frame #42: 0x00007fff4f851b95 CoreFoundation`__CFRunLoopDoSources0 + 195
    frame #43: 0x00007fff4f85113e CoreFoundation`__CFRunLoopRun + 1219
    frame #44: 0x00007fff4f850a28 CoreFoundation`CFRunLoopRunSpecific + 463
    frame #45: 0x00007fff4eae9b35 HIToolbox`RunCurrentEventLoopInMode + 293
    frame #46: 0x00007fff4eae986b HIToolbox`ReceiveNextEventCommon + 618
    frame #47: 0x00007fff4eae95e8 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #48: 0x00007fff4cda5eb7 AppKit`_DPSNextEvent + 997
    frame #49: 0x00007fff4cda4c56 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1362
    frame #50: 0x00007fff4cd9ecb9 AppKit`-[NSApplication run] + 699
    frame #51: 0x000000010b96ee01 Chromium Embedded Framework`base::MessagePumpNSApplication::DoRun(this=0x000000010091ab30, delegate=0x0000000100907480) at message_pump_mac.mm:852
    frame #52: 0x000000010b96c2ab Chromium Embedded Framework`base::MessagePumpCFRunLoopBase::Run(this=0x000000010091ab30, delegate=0x0000000100907480) at message_pump_mac.mm:186
    frame #53: 0x000000010b7cbc2c Chromium Embedded Framework`base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(this=0x0000000100907480, application_tasks_allowed=true, timeout=(delta_ = [9223372036854775807 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/9223372036854775807))) at thread_controller_with_message_pump_impl.cc:448
    frame #54: 0x000000010b753be3 Chromium Embedded Framework`base::RunLoop::RunWithTimeout(this=0x00007ffeefbff4f8, timeout=(delta_ = [9223372036854775807 (bb)](https://bitbucket.org/chromiumembedded/cef/commits/9223372036854775807))) at run_loop.cc:161
    frame #55: 0x000000010b75384a Chromium Embedded Framework`base::RunLoop::Run(this=0x00007ffeefbff4f8) at run_loop.cc:129
    frame #56: 0x000000010b0797d8 Chromium Embedded Framework`CefRunMessageLoop() at context.cc:307
    frame #57: 0x0000000101806479 Chromium Embedded Framework`::cef_run_message_loop() at libcef_dll.cc:141
    frame #58: 0x0000000100264eba cefclient`::cef_run_message_loop() at libcef_dll_dylib.cc:992
    frame #59: 0x00000001001a2289 cefclient`CefRunMessageLoop() at libcef_dll_wrapper.cc:134
    frame #60: 0x000000010000d661 cefclient`client::MainMessageLoopStd::Run(this=0x0000000100a12840) at main_message_loop_std.cc:14
    frame #61: 0x00000001000a0e38 cefclient`client::(anonymous namespace)::RunMain(argc=1, argv=0x00007ffeefbff988) at cefclient_mac.mm:416
    frame #62: 0x00000001000a0782 cefclient`main(argc=1, argv=0x00007ffeefbff988) at cefclient_mac.mm:438
    frame #63: 0x00007fff7ca3308d libdyld.dylib`start + 1
    frame #64: 0x00007fff7ca3308d libdyld.dylib`start + 1
magreenblatt commented 5 years ago

Related Chromium issue: https://bugs.chromium.org/p/chromium/issues/detail?id=880522

magreenblatt commented 5 years ago

This prompt can be disabled and cookies will not be encrypted if you pass the --use-mock-keychain command-line flag.

We could modify Chromium to additionally support configuration of the service/account name values (to optionally replace the default of "Chromium Safe Storage" with something application-specific) in cases where the prompt is not disabled.

magreenblatt commented 5 years ago

Update attributes.

magreenblatt commented 5 years ago

Update title.

magreenblatt commented 4 years ago

macOS: Disable toolchain prompt for tests (see issue #2692)

→ <<cset 492c6c684314 (bb)>>

magreenblatt commented 4 years ago

macOS: Disable toolchain prompt for tests (see issue #2692)

→ <<cset 1d805e5357b2 (bb)>>

magreenblatt commented 2 years ago

Original comment by Alexander Pushkov (Bitbucket: notpushkin, GitHub: notpushkin).


I’ve just ran into this issue, too: https://github.com/ONLYOFFICE/DesktopEditors/issues/850

magreenblatt commented 1 year ago

Original comment by Maxim Fedotov (Bitbucket: Maxim Fedotov).


We could modify Chromium to additionally support configuration of the service/account name values (to optionally replace the default of "Chromium Safe Storage" with something application-specific) in cases where the prompt is not disabled.

I believe this is an important thing to do, and it would really help us.

Correct me if I’m wrong, but as things stand right now our options seem to be:

  1. Disable encryption of cookies, which seems like a real security risk (in our case we do need to use cookies and they will contain sensitive information)
  2. Share "Chromium Safe Storage" with any other app which uses it, which gives other apps access to the secret used for encryption. And by default, other apps using CEF will use "Chromium Safe Storage". Seems like a security risk as well.

Unless I’m missing something, all the options we have when using CEF with networking are insecure, in which case I’m not sure why the priority of this issue is “minor” at this moment.

magreenblatt commented 5 years ago
magreenblatt commented 5 years ago
magreenblatt commented 5 years ago