Is there a way to encrypt cookies before they are saved

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Is there a way to encrypt cookies before they are saved

Postby dmklementiev » Tue Mar 24, 2020 6:51 pm

I enable cookies as CefString(&settings.cache_path).FromASCII("path/cookies");. Everything works as expected, however, when I authenticate using one of auth2 flows, persistent cookie(s) that contain essentially refresh token are saved in the location I provided. This poses certain security risk. Question: is there any way to encrypt cookies before they are save on the disk and encrypt after they are loaded, so non-encrypted cookies exist in memory only?
dmklementiev
Mentor
 
Posts: 54
Joined: Wed Jul 31, 2019 7:11 pm

Re: Is there a way to encrypt cookies before they are saved

Postby magreenblatt » Tue Mar 24, 2020 7:08 pm

What OS and CEF version? They should be encrypted by default with NetworkService enabled.
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm

Re: Is there a way to encrypt cookies before they are saved

Postby dmklementiev » Tue Mar 24, 2020 7:18 pm

Thank you Marshall. OS = Ubuntu 18.04. CEF = cloned from main a few weeks ago. Question: who owns the public/private keys? Can I provide my own?
dmklementiev
Mentor
 
Posts: 54
Joined: Wed Jul 31, 2019 7:11 pm

Re: Is there a way to encrypt cookies before they are saved

Postby magreenblatt » Tue Mar 24, 2020 7:59 pm

I guess on Linux there may not be a system keychain to use by default. You can check what CryptoCookieDelegate is passed to SQLitePersistentCookieStore in your local build.
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm

Re: Is there a way to encrypt cookies before they are saved

Postby dmklementiev » Mon Apr 06, 2020 3:51 pm

Seems that I cannot hit a break point (actually I've changed CEF code to log and throw an exception) in the following functions to understand what CryptoCookieDelegate is sent.

I've tried the following funtions:

Code: Select all
in src/net/extras/sqlite/sqlite_persistent_cookie_store.cc

SQLitePersistentCookieStore::Backend::MakeCookiesFromSQLStatement
SQLitePersistentCookieStore::Backend::FinishedLoadingCookies
SQLitePersistentCookieStore::SQLitePersistentCookieStore

in src/components/cookie_config/cookie_store_util.cc

net::CookieCryptoDelegate* GetCookieCryptoDelegate()

What else can I try?
dmklementiev
Mentor
 
Posts: 54
Joined: Wed Jul 31, 2019 7:11 pm

Re: Is there a way to encrypt cookies before they are saved

Postby magreenblatt » Mon Apr 06, 2020 3:57 pm

You likely need to attach the debugger to the network process (it has --type=utility on the command-line).
magreenblatt
Site Admin
 
Posts: 12402
Joined: Fri May 29, 2009 6:57 pm

Re: Is there a way to encrypt cookies before they are saved

Postby dmklementiev » Mon Apr 06, 2020 6:16 pm

Yes, hit the break point, thank you.
dmklementiev
Mentor
 
Posts: 54
Joined: Wed Jul 31, 2019 7:11 pm


Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 41 guests