all-in-one privacy solution":["Proton Unlimited to wszechstronne rozwiązanie zapewniające prywatność"],"Black Friday":["Czarny Piątek"],"No ads. Privacy by default.":["Brak reklam. Prywatność w standardzie."],"People before profits":["Ludzie przed zyskiem"],"Security through transparency":["Bezpieczeństwo dzięki przejrzystości"],"The best Proton Mail ${ BLACK_FRIDAY } deals":["Najlepsze oferty Proton Mail ${ BLACK_FRIDAY }"],"The world’s only community- supported email service":["Jedyna na świecie usługa poczty elektronicznej wspierana przez społeczność"]},"specialoffer:limited":{"${ hours } hour":["${ hours } godzina","${ hours } godziny","${ hours } godzin","${ hours } godziny"],"${ hoursLeft }, ${ minutesLeft } and ${ secondsLeft } left":["Pozostało: ${ hoursLeft }, ${ minutesLeft } i ${ secondsLeft }"],"${ minutes } minute":["${ minutes } minuta","${ minutes } minuty","${ minutes } minut","${ minutes } minuty"],"${ seconds } second":["${ seconds } sekunda","${ seconds } sekundy","${ seconds } sekund","${ seconds } sekundy"],"Limited time offer":["Oferta ograniczona czasowo"]},"specialoffer:listitem":{"Create multiple addresses":["Utwórz wiele adresów"],"Hide-my-email aliases":["Aliasy hide-my-email"],"Quickly unsubscribe from newsletters":["Szybko anuluj subskrypcję biuletynów"],"Use your own domain name":["Korzystaj z własnej nazwy domeny"]},"specialoffer:logos":{"As featured in":["Opinie naszych klientów"]},"specialoffer:metadescription":{"Get an encrypted email that protects your privacy":["Uzyskaj zaszyfrowaną usługę e-mail, która chroni Twoją prywatność"]},"specialoffer:metatitle":{"Proton Mail Black Friday Sale - Up to 40% off":["Wyprzedaż Proton Mail z okazji Czarnego Piątku – uzyskaj do 40% zniżki"]},"specialoffer:newmetadescription":{"Get up to 40% off Proton Mail subscriptions this Black Friday. Find great deals on our secure end-to-end encrypted email plans.":["Uzyskaj do 40% zniżki na subskrypcje Proton Mail w ten Czarny Piątek. Znajdź wspaniałe oferty naszych bezpiecznych planów usługi poczty elektronicznej w szyfrowaniu end-to-end."]},"specialoffer:newmetatitle":{"Proton Mail Black Friday sale | Up to 40% off secure email":["Wyprzedaż Proton Mail z okazji Czarnego Piątku | Do 40% zniżki na bezpieczną pocztę elektroniczną"]},"specialoffer:note":{"* Billed at ${ TOTAL_SUM } for the first year":["* Płatne ${ TOTAL_SUM } za pierwszy rok"],"*Billed at ${ TOTAL_SUM } for the first 2 years":["* Płatne ${ TOTAL_SUM } za pierwsze 2 lata"],"30-day money-back guarantee":["30-dniowa gwarancja zwrotu pieniędzy"],"Billed at ${ TOTAL_SUM } for the first 2 years":["Płatne ${ TOTAL_SUM } za pierwsze 2 lata"],"Billed at ${ TOTAL_SUM } for the first year":["Płatne ${ TOTAL_SUM } za pierwszy rok"],"You save ${ SAVE_SUM }":["Oszczędzasz ${ SAVE_SUM }"]},"specialoffer:off":{"${ DISCOUNT } off":["-${ DISCOUNT }"],"${ PERCENT_OFF } off":["-${ PERCENT_OFF }"]},"specialoffer:testimonial":{"I love my ProtonMail":["Uwielbiam ProtonMail"],"My favorite email service":["Moja ulubiona usługa e-mail"],"Thanks Proton for keeping us all safe in the complicated internet universe.":["Dziękuję Protonowi za dbanie o nasze bezpieczeństwo w skomplikowanym internetowym uniwersum."],"You get what you pay for. In the case of big tech, if you pay nothing, you get used. I quit using Gmail and switched to @ProtonMail":["Dostajesz to, za co płacisz. W przypadku przedsiębiorstw big tech, jeśli nie płacisz nic, zostaniesz wykorzystany. Przestałam korzystać z Gmail i przeniosłam się na @ProtonMail"]},"specialoffer:time":{"Days":["Dni"],"Hours":["Godz."],"Min":["Min"]},"specialoffer:title":{"And much more":["I wiele więcej"],"Make your inbox yours":["Spraw, aby Twoja skrzynka odbiorcza była naprawdę Twoja"],"Safe from trackers":["Bezpieczeństwo od skryptów śledzących"],"Stay organized":["Zachowaj porządek"],"Black Friday email deals":["Oferty e-mailowe na Czarny Piątek"],"Don’t just take our word for it":["Nie musisz wierzyć nam na słowo"],"Our story":["Nasza historia"],"Transfer your data from Google in one click":["Przenieś dane z Google jednym kliknięciem"]},"specialoffer:tooltip":{"Access blocked content and browse privately. Includes ${ TOTAL_SERVERS }+ servers in ${ TOTAL_COUNTRIES }+ countries, connect up to 10 devices, access worldwide streaming services, malware and ad-blocker, and more.":["Uzyskaj dostęp do zablokowanych treści i przeglądaj prywatnie Internet. Zawiera ponad ${ TOTAL_SERVERS } serwerów w ponad ${ TOTAL_COUNTRIES } krajach z możliwością połączenia do 10 urządzeń, a także dostęp do globalnych usług streamingu, blokadę reklam, złośliwego oprogramowania i wiele więcej."],"Easily share your calendar with your family, friends or colleagues, and view external calendars.":["Łatwo udostępniaj swój kalendarz rodzinie, znajomym oraz współpracownikom i wyświetla kalendarze zewnętrzne."],"Includes support for 1 custom email domain, 10 email addresses, 10 hide-my-email aliases, calendar sharing, and more.":["Zawiera obsługę 1 niestandardowej domeny e-mail, 10 adresów e-mail, 10 aliasów hide-my-email, udostępnianie kalendarza i nie tylko."],"Includes support for 3 custom email domains, 15 email addresses, unlimited hide-my-email aliases, calendar sharing, and more.":["Obejmuje obsługę 3 niestandardowych domen e-mail, 15 adresów e-mail, nielimitowane aliasy hide-my-email, udostępnianie kalendarza i nie tylko."],"Manage up to 25 calendars, mobile apps, secured with end-to-end encryption, 1-click calendar import from Google, and more.":["Zarządzanie nawet 25 kalendarzami, aplikacje mobilne, bezpieczne szyfrowanie metodą end-to-end, importowanie kalendarza za pomocą jednego kliknięcia z Google i więcej."]},"Status Banner":{"At the moment we are experiencing issues with the Proton VPN service":["W tej chwili mamy problemy z usługą Proton VPN"],"Learn more":["Dowiedz się więcej"]},"Status banner":{"Learn more":["Dowiedz się więcej"],"Please note that at the moment we are experiencing issues with the ${ issues[0] } service.":["Uwaga: obecnie występują problemy z usługą ${ issues[0] }."],"We are experiencing issues with one or more services at the moment.":["Mamy problemy z co najmniej jedną usługą."]},"suggestions":{"Suggestions":["Sugestie"]},"Support":{"Sub category":["Podkategoria","Podkategorie","Podkategorii","Podkategorii"]},"Support article":{"${ readingTime } min":["${ readingTime } min","${ readingTime } min","${ readingTime } min","${ readingTime } min"],"Category":["Kategoria","Kategorie","Kategorii","Kategorii"],"Didn’t find what you were looking for?":["Nie znaleziono szukanej frazy?"],"General contact":["Skontaktuj się, wykorzystując ogólne zapytanie"],"Get help":["Uzyskaj pomoc"],"Legal contact":["Skontaktuj się z działem prawnym"],"Media contact":["Skontaktuj się z zespołem medialnym"],"Partnerships contact":["Skontaktuj się z zespołem ds. partnerstwa"],"Reading":["Odczytywanie"]},"Support categories":{"Browse Proton product support":["Przeglądaj wsparcie dotyczące produktów Proton"]},"Support category":{"There is no article in this category yet.":["W tej kategorii jeszcze nie ma żadnego artykułu."]},"Support troubleshooting":{"--- Select ---":["--- Wybierz ---"],"Adding and importing contacts":["Dodawanie i importowanie kontaktów"],"App version":["Wersja aplikacji"],"Automatically save contacts":["Automatyczne zapisywanie kontaktów"],"Bridge connection issues with Outlook, Apple Mail or Thunderbird":["Problemy z połączeniem Bridge z programami Outlook, Apple Mail lub Thunderbird"],"Browser":["Przeglądarka"],"Check if this helps":["Sprawdź, czy to pomoże"],"Choose a category for your question":["Wybierz kategorię pytania"],"Connectivity errors on Android and iOS":["Błędy łączności w systemach Android i iOS"],"Contacts":["Kontakty"],"Custom domain":["Domena niestandardowa"],"Desktop notifications":["Powiadomienia na pulpicie"],"Did this solve your issue ?":["Czy Twój problem został rozwiązany?"],"Difference between Combined Addresses Mode and Split Addresses Mode":["Różnica pomiędzy trybem adresów łączonych i trybem adresów dzielonych"],"Differences between addresses, aliases, and sub-users":["Różnice między adresami, aliasami i podużytkownikami"],"Email notifications":["Powiadomienia e-mail"],"Email tracking protection":["Ochrona przed śledzeniem poczty e-mail"],"Encryption":["Szyfrowanie"],"Encryption keys management":["Zarządzanie kluczami szyfrowania"],"Faster assistance is just a few clicks away — please make your selections":["Szybsze wsparcie w zasięgu ręki – dokonaj wyboru"],"How to avoid receiving spam messages":["Jak uniknąć otrzymywania wiadomości spam"],"How to block unwanted email":["Jak zablokować niechcianą pocztę e-mail"],"How to configure your email client for Bridge":["Jak skonfigurować aplikację pocztową dla narzędzia Bridge"],"How to create contact groups":["Jak tworzyć grupy kontaktów"],"How to create or edit CSV contacts":["Jak tworzyć lub edytować kontakty CSV"],"How to install Proton Mail Bridge":["Jak zainstalować Proton Mail Bridge"],"How to merge duplicate contacts":["Jak scalić zduplikowane kontakty"],"How to send encrypted messages to external users":["Jak wysyłać zaszyfrowane wiadomości do użytkowników zewnętrznych"],"How to set up a custom domain":["Jak skonfigurować domenę niestandardową"],"How to unsubscribe from Apple’s TestFlight notification emails":["Jak nie otrzymywać więcej e-maili z powiadomieniami od Apple TestFlight"],"How to use auto-reply":["Jak korzystać z autorespondera"],"How to use filters":["Jak korzystać z filtrów"],"How to use folders and labels":["Jak korzystać z folderów i etykiet"],"How to use PGP encryption":["Jak korzystać z szyfrowania PGP"],"Invalid password error while setting email client for Bridge":["Niepoprawne hasło podczas konfigurowania aplikacji pocztowej dla narzędzia Bridge"],"Login security notification alerts":["Alerty powiadomień o bezpieczeństwie logowania"],"Manage mailbox appearance":["Zarządzanie wyglądem skrzynki pocztowej"],"Mobile connectivity and synchronization":["Łączenie i synchronizacja z urządzeniami mobilnymi"],"No, contact support":["Nie, skontaktuj się z pomocą techniczną"],"Notifications":["Powiadomienia"],"Other":["Inne"],"Problems with deleting messages":["Problemy z usuwaniem wiadomości"],"Problems with moving messages":["Problemy z przenoszeniem wiadomości"],"Problems with read/unread message status":["Problemy ze statusem wiadomości przeczytanej/nieprzeczytanej"],"Proton Mail Bridge":["Proton Mail Bridge"],"Proton Mail settings":["Ustawienia Proton Mail"],"Push notifications not arriving":["Powiadomienia push nie docierają"],"Sending and receiving messages":["Wysyłanie i odbieranie wiadomości"],"Sending and receiving messages limitations":["Limity wysyłania i odbierania wiadomości"],"Sending and receiving troubleshooting":["Rozwiązywanie problemów z wysyłaniem i odbieraniem"],"Spam filtering, Allow and Block lists":["Filtrowanie spamu, listy dozwolonych i odrzuconych"],"Sub-users and organizations":["Podużytkownicy i organizacje"],"Thank you for your feedback":["Dziękujemy za podzielenie się opinią"],"Troubleshooting":["Rozwiązywanie problemów"],"Verify custom domain records & anti-spoofing":["Weryfikowanie rekordów domeny niestandardowej i ochrona przed spoofingiem"],"What can we help with ?":["W czym możemy Ci pomóc?"],"What if your domain records fail (TXT, MX, SPF, DKIM, DMARC)":["Co się stanie, gdy rekordy Twojej domeny zawiodą (TXT, MX, SPF, DKIM, DMARC)"],"What is encrypted on Proton Mail":["Co jest szyfrowane w Proton Mail"],"Yes":["Tak"]},"support_modal_search_query":{"How to use a custom domain?":["Jak korzystać z domeny niestandardowej?"],"Search query":["Zapytanie wyszukiwania"]},"support_modal_search_result":{"Search result":["Wynik wyszukiwania"]},"support_modal_title":{"Blog search":["Wyszukaj na blogu"],"Support search":["Wyszukiwanie wsparcia"]},"support_search_button":{"Search":["Szukaj"]},"support_search_i_am_looking_for":{"I'm looking for":["Szukam"]},"SupportForm":{"For a faster resolution, please report the issue from the Bridge app: Help > Report a problem.":["W celu szybszego rozwiązania problemu dokonaj zgłoszenia przez aplikację Bridge: Pomoc > Zgłoś problem."],"Information":["Informacje"]},"SupportForm:option":{"Account Security":["Bezpieczeństwo konta"],"Contacts":["Kontakty"],"Custom email domain":["Niestandardowa domena e-mail"],"Email delivery and Spam":["Dostarczanie wiadomości e-mail i spam"],"Encryption":["Szyfrowanie"],"Login and password":["Login i hasło"],"Merge aliases and accounts":["Scalanie aliasów i kont"],"Migrate to Proton":["Migracja do Proton"],"Notifications":["Powiadomienia"],"Other":["Inne"],"Plans and billing":["Plany i rozliczenia"],"Proton for Business":["Proton for Business"],"Sign up":["Rejestracja"],"Storage":["Przestrzeń dyskowa"],"Users, addresses, and identities":["Użytkownicy, adresy i tożsamości"]},"SupportForm:optionIntro":{"Select a topic":["Wybierz temat"]},"swiss_baseed_feature":{"Swiss based":["Ulokowany w Szwajcarii"]},"Testimonial":{"Awards":["Nagrody"],"Customers":["Klienci"],"Featured":["Wyróżnione"],"Go to testimonial source":["Przejdź do źródła referencji"],"Reviews":["Opinie"],"Videos":["Pliki wideo"]},"Text":{"Find the plan that's right for you":["Znajdź odpowiedni plan dla siebie"],"If you need help, check out our ${ supportLink }.":["Jeśli potrzebujesz pomocy, sprawdź naszą ${ supportLink }."],"The page you’re looking for might have been removed, or it could be an\nold link.":["Strona, której szukasz, mogła zostać usunięta lub link jest przestarzały."]},"Title":{"On this page":["Na tej stronie"],"Related articles":["Powiązane artykuły"],"Share ${ thisPage }":["Udostępnij ${ thisPage }"],"Thank you!":["Dziękujemy!"],"this page":["tę stronę"]},"Tooltip":{"More information":["Więcej informacji"]},"tooltip_calendar":{"Create up to 20 custom & shareable encrypted calendars. On top of that, add up to 5 calendars from friends, family, colleagues, and organizations.":["Utwórz do 20 niestandardowych, szyfrowanych kalendarzy z możliwością ich udostępniania. Ponadto możesz dodać do 5 kalendarzy znajomych, rodziny, współpracowników i organizacji."]},"tooltip_vpn":{"Access blocked content and browse privately. Includes ${ TOTAL_SERVERS }+ servers in ${ TOTAL_COUNTRIES }+ countries, highest VPN speed, ${ TOTAL_VPN_CONNECTIONS } VPN connections, worldwide streaming services, malware and ad-blocker, and more.":["Uzyskaj dostęp do zablokowanych treści i przeglądaj prywatnie Internet. Zawiera ponad ${ TOTAL_SERVERS } serwerów w ponad ${ TOTAL_COUNTRIES } krajach, najwyższe prędkości VPN, ${ TOTAL_VPN_CONNECTIONS } połączeń VPN, usługi streamingu na całym świecie, blokowanie reklam oraz złośliwego oprogramowania i wiele więcej."],"Access blocked content and browse privately. Includes ${ TOTAL_SERVERS }+ servers in ${ TOTAL_COUNTRIES }+ countries, highest VPN speed, 10 VPN connections, worldwide streaming services, malware and ad-blocker, and more.":["Uzyskaj dostęp do zablokowanych treści i przeglądaj prywatnie Internet. Zawiera ponad ${ TOTAL_SERVERS } serwerów w ponad ${ TOTAL_COUNTRIES } krajach, najwyższe prędkości VPN, 10 połączeń VPN, usługi streamingu na całym świecie, blokowanie reklam oraz złośliwego oprogramowania i wiele więcej."]},"version_history_label":{"Version history":["Historia wersji"]},"version_history_tooltip":{"Store up to ${ versionHistoryNumber } versions of each file for up to ${ years } years":["Przechowuj do ${ versionHistoryNumber } wersji każdego pliku do ${ years } lat"]},"VideoModal":{"Get started in 2 minutes":["Rozpocznij w 2 minuty"]},"videosButtonLabel":{"Get started with videos":["Zacznij oglądać filmy"]},"vpn_features_link":{"View VPN plans":["Wyświetl plany usługi VPN"]},"vpn_features_useCase":{"Access blocked content and browse privately":["Uzyskaj dostęp do zablokowanej zawartości i przeglądaj ją prywatnie"]}}},"unleashApi":"https://account.proton.me/api"};
// We need to import data (the framework context) from the server
// This Astro feature with define:vars works well but creates an inline script
// So we can't directly import the initFramework helper, we have to store the context
window.frameworkContext = frameworkContext;
})();
Behind the scenes of Proton Mail’s message content search | Proton
Cryptography is at the heart of all our services. This has enormous advantages because it provides all the necessary tools and constructions for us to develop features with built-in security and privacy. Occasionally, however, these protection layers can hinder basic functionalities that everybody has grown accustomed to from non-privacy-focused services. One example is the Proton community wanting to be able to search through their emails’ content on their Proton Mail app.
The dilemma is as easy to explain as it’s difficult to solve. At Proton, we store all messages in an encrypted state on our servers so that only the owner of the legitimate cryptographic key can access them. Since Proton servers do not have access to the keys, we cannot decrypt your emails, which means we cannot search their content. On the other hand, Proton’s web and mobile apps can access decrypted messages but typically lack the full view over the whole mailbox because they only fetch messages when the user interacts with them.
In other words, the problem can be stated as follows: How can we search emails’ content while retaining the usual security and privacy guarantees Proton has always offered?
Our security model for search
Before diving into any actual implementation details, it’s important to keep in mind the goals we set for the solution regarding the security and privacy it should guarantee. At Proton, the security model is the main driver of all design choices and technical decisions. The message content search could not fundamentally alter the privacy offering that Proton Mail(new window) provides. The following list provides a high-level overview of some privacy concerns related to searching message content and how we addressed them.
When searching, we shouldn’t leak the query.
When searching, we shouldn’t leak the set of results.
The server shouldn’t be able to perform a search.
The server shouldn’t be able to learn the contents of emails.
If the local device is compromised after it’s shut down, an attacker shouldn’t be able to learn the contents or metadata of emails.
These are the criteria that we always kept in mind as we evaluated our possible solutions.
Searchable encryption – A theoretically optimal solution
The field of cryptography is full of constructions that go way beyond achieving the most basic security notions (i.e., authenticity, confidentiality, and integrity of data) and offer advanced functionalities to operate on the data without sacrificing too much on the privacy front. In other words, several algorithms have been built to allow the application of functions over ciphertexts, making them capable of preserving confidentiality while performing computations. These cryptographic schemes are called searchable encryption (SE) algorithms when they apply a search function to ciphertexts.
Using SE, emails need to be downloaded, encrypted under the new SE algorithm, and re-uploaded. However, this would be required only once per message and could be available across devices without relying on the disk of a specific device. From that point on, the server could apply the searching function allowed by the specific SE scheme every time the user triggers a search, and the confidentiality of the messages’ content would remain unaltered. If this seems too good to be true, it’s because it comes with severe limitations, which led us to choose a more traditional approach. The field of SE cryptography is mostly limited to academic interest because cryptographic schemes in this category have such restrictive trade-offs.
These schemes are designed to be as general as possible to fit many different use cases. This means that some non-trivial fine-tuning of the cryptographic primitive (for example, security parameters) is required.
The security guarantees vary from one SE algorithm to another. It’s even the case that some schemes sacrifice performance for too much security. For example, we don’t necessarily care that the server learns whether an email has been inserted in the database as it already knows a new email has been received!
Conversely, the cryptographic community hasn’t reached a consensus on the security guarantees of SE algorithms, leading to new and potentially devastating attacks still being published against the most well-known schemes.
Implementations are rare and not ready for production environments since these schemes are still fairly academic. Any attempt at developing such a feature would have required an ad-hoc implementation of almost all its building blocks.
Due to the previous point, performance is poorly understood, and tests have only been carried out in limited and controlled environments, never in the wild.
All in all, this is probably the most interesting field in message content search, but it didn’t meet our requirements.
Our approach – Client-side searching
When facing the problem of how to search message content, there are two sides at play. On the one hand, the server has all the emails inside a mailbox, but they’re encrypted by a key it doesn’t have. On the other hand, the client can decrypt any message but doesn’t have access to the full mailbox at any point in time. Clearly, searching the content of emails, despite being a useful functionality, shouldn’t break the security model Proton Mail already provides. As we discussed, this is difficult to achieve with a server-side solution given current cryptography. Thus for our first implementation of message content search, we decided that the client should be responsible for searching messages.
This is a good starting point already, as the client checks several boxes that are useful for implementing an encrypted search feature.
The moment the user logs in, the cryptographic keys by which all emails are encrypted are locally available and can be used at any time.
All messages are accessible; it’s just a matter of sending the appropriate requests to the server.
Despite looking trivial, these two basic facts of any Proton client already point toward a potential solution to the problem of searching emails’ content. Every time a user performs a query, the client can:
Fetch the message from the server
Decrypt it
Check whether the email matches the metadata search filters (for example, a date range)
If it does, search whether the keyword entered by the user is found in the body or in any other metadata of the email
If it does, show the email as a search result
It isn’t hard to see that this approach has severe practical problems. For one, it has a lot of redundancy because messages are fetched and decrypted for every query. It doesn’t scale: users with small mailboxes might find it acceptable, but as the number of messages grows, so does the slowdown. Finally, servers would need to serve a lot of messages to all the users that search their inboxes at the same time, making the total workload prohibitive very quickly.
Despite being impractical, the above simple algorithm and its drawbacks offer an interesting lead to improve the situation. Any search would need to fetch messages from the server and decrypt them, but these steps are completely independent of any search parameter. In other words, we can implement them as a pre-processing phase before any search.
We call this the indexing phase because we index the data in a local database on the client. Once it’s completed, the index perfectly mirrors the content of the whole mailbox. The user can perform message content searches over the messages stored on their device rather than having to fetch their messages over and over, drastically improving performance and scalability. The logic of the overall procedure can then be summarized as follows.
Upon activation of message content search, build the local index. The amount of time this takes varies considerably depending on how many messages the mailbox contains.
Once that’s done, execute steps 3, 4, and 5 of the above algorithm whenever the user triggers a search.
Details on the local database
Searches themselves are really just described by points 3, 4, and 5 of the algorithm above. Apart from some minor details, that’s pretty much what our implementation does. The core of the solution – and the most interesting to research and develop – was the local index.
Underlying technology
On our web client, we use the IndexedDB Web API(new window) to build the local index. IndexedDB (IDB) is a transactional database system based on the key-value paradigm in all modern browsers. There are several practical reasons behind this choice, especially in relation to other types of web storage(new window) solutions.
IDB is designed with JavaScript objects in mind, making it flexible and friendly to custom objects.
It’s intended to store large amounts of data using its higher quota. This is necessary to be able to index very large mailboxes.
The query system is more flexible. For example, it’s possible to restrict the range of the query.
Building the database
The indexing process starts when a user activates message content search. As mentioned, it’s necessary to build the local index and is a pre-condition before any search of emails’ content can happen. The process is fairly straightforward, but it’s worthwhile to go through it to highlight some security aspects. For each message, the following steps are carried out:
It’s fetched from the server.
We locally decrypt the OpenPGP message using the appropriate private key.
The plaintext of the message is cleaned of any HTML markups, as those aren’t relevant to the search functionality.
The final plaintext, along with all its metadata, is encrypted again, this time by a symmetric encryption key, using WebCrypto.
The ciphertext is stored in IDB.
The symmetric encryption key is generated at the beginning of the indexing phase and is used to encrypt all messages to ensure their confidentiality and integrity – even in the case of a compromised device. We use AES-GCM for this, since AES-GCM is implemented in all modern browsers as part of the Web Crypto API(new window), which is faster than OpenPGP. The symmetric key itself is safely stored locally, encrypted under the user’s contact key.
Since IDB is a simple key-value table where the value can be (almost) any JavaScript value, at the end of the indexing phase, every row is indexed by message ID and contains the encryption of the corresponding message. Note that despite Web APIs being reasonably fast, fetching and decrypting messages from IDB does have a performance cost. To avoid paying this cost for every search within the same session, the IDB is (fully or partially, depending on its size) cached in unencrypted form.
Forward index vs. inverted index
We chose to use the forward index(new window) structure for our message content search. This means the keys are the email’s unique identifiers, and the values are the messages themselves (minus some HTML cleanup, as stated above).
If we abstract away from the actual structure of the database, we can represent it as the table below. The value of each row is an email (both its body and metadata).
It’s worth mentioning that we explored another popular approach to deal with these scenarios, namely the inverted index(new window). The table below represents an abstract example of it.
In this case, keywords are the main keys, and the corresponding value is a list of messages containing each keyword. This approach is usually much faster than the forward index because it only has to search the database for the exact(ish) keywords the user queried, read off the list of messages, and display them. The forward index must search every possible message, which quickly becomes impractical on very large scales.
Despite this difference in performance, we still chose to use a forward index for this first implementation of our message content search. We found that forward indices offered several advantages:
It’s conceptually simpler and closer to the web client’s message interface that’s already in use.
Running more complex queries (for example, searching for exact sentences) is easier when using a forward index because we have access to the full document. In an inverted index, we wouldn’t have an ordered list of keywords without doing additional work, which means the sentences are broken apart.
The size of the typical mailbox is well within what a forward index can quickly handle, making the performance advantage of an inverted index marginal in most cases.
However, we’ll continue to optimize our implementation and investigate alternative approaches, including an inverted index or even searchable encryption, if it proves viable and necessary for performance.
Conclusions
If we revisit the security model that we said our solution had to meet, we see that the solution we chose passes all the tests:
The search is performed locally on user’s device, so the query isn’t leaked to a Proton server.
Everything that’s needed to show the results is stored locally on the user’s device (for example, metadata), so the results aren’t leaked to the server. A caveat is that upon opening a search result, it has to be fetched again as the locally stored version doesn’t have the HTML needed to render. However, the server can’t infer whether multiple email openings belong to the same query (or to a search) since no query is sent to the server when searching.
The user’s private key is required to decrypt the local database of messages, so the server can’t perform a search.
The index is stored locally and never sent to the server, so the server can’t read the contents of emails from the index.
The messages and metadata are stored encrypted on the device, which helps protect them from attackers if the device is compromised. This will still require some care from the user: logging out of your Proton account doesn’t remove the index but does prevent the app from automatically logging you in upon opening the browser. Securing the device with a password and full-disk encryption are also good practices and can stop attackers from reading the contents of of your device’s disk if they manage to steal it.
Security and privacy never come for free. Sometimes it might seem like they do because the price is minimal, like a barely noticeable performance penalty when executing some code. Other times, they require a complete re-design of features and functionalities.
Our journey with message content search shows that, despite all the difficulties, building rich products that respect users’ privacy is possible. And the search functionality we developed can eventually be used by other Proton services, including Proton Drive(new window) and Proton Calendar(new window). Ultimately, we believe the effort we put into reworking these functionalities so that they can work with our encryption is a small price to pay when compared to the privacy they preserve.
Protecting a folder with a password is a simple yet effective way of securing
files. You may wonder whether you can password-protect a folder in Google Drive.
We explain what access controls Google Drive offers and what you can do to
improve your sec
We’re excited to announce that Proton Pass supports passkeys for everyone,
allowing you to manage and use passkeys across all devices seamlessly. Passkeys
are an easy and secure alternative to traditional passwords that can help
prevent phishing atta
Passkeys are a new way to secure your online accounts using cryptographic keys
instead of passwords. They offer a high level of convenience and security, and
are a real game-changer in the way we access and secure sites. What is a
passkey, though, an
Apple’s marketing team has built a powerful association between the iPhone and
privacy. The company’s ad campaigns claim that “what happens on your iPhone,
stays on your iPhone.” And, “Privacy. That’s iPhone.”
But Apple’s lawyers are telling a diffe
A cyberattack on national public employment service France Travail has exposed
the personal data of as many as 43 million people.
The latest breach is the second major cybersecurity attack to happen in France
in the past month, raising concerns abo
Google Drive makes it easy to share files and folders, but you may have wondered
at some point whether the people you’ve shared a folder with can see your other
folders. We answer this question below and also share some tips for truly secure
link sha
In 2014, Proton Mail was introduced as a web app, revolutionizing how we think
about email privacy.
Today, we’re excited to broaden the horizons of secure communication by
launching the Proton Mail desktop app. Anyone can now use the new Proton Mail