Code Monkey home page Code Monkey logo

proton-bridge's Introduction

Proton Mail Bridge and Import Export app

Copyright (c) 2024 Proton AG

This repository holds the Proton Mail Bridge and the Proton Mail Import-Export applications. For a detailed build information see BUILDS. The license can be found in LICENSE file, for more licensing information see COPYING_NOTES. For contribution policy see CONTRIBUTING.

Description Bridge

Proton Mail Bridge for e-mail clients.

When launched, Bridge will initialize local IMAP/SMTP servers and render its GUI.

To configure an e-mail client, firstly log in using your Proton Mail credentials. Open your e-mail client and add a new account using the settings which are located in the Bridge GUI. The client will only be able to sync with your Proton Mail account when the Bridge is running, thus the option to start Bridge on startup is enabled by default.

When the main window is closed, Bridge will continue to run in the background.

More details on the public website.

Launchers

Launchers are binaries used to run the Proton Mail Bridge or Import-Export apps.

Official distributions of the Proton Mail Bridge and Import-Export apps contain both a launcher and the app itself. The launcher is installed in a protected area of the system (i.e. an area accessible only with admin privileges) and is used to run the app. The launcher ensures that nobody tampered with the app's files by verifying their signature using a hardcoded public key. App files are placed in regular userspace and are signed by Proton's private key. This feature enables the app to securely update itself automatically without asking the user for a password.

Keychain

You need to have a keychain in order to run the Proton Mail Bridge. On Mac or Windows, Bridge uses native credential managers. On Linux, use secret-service freedesktop.org API (e.g. Gnome keyring) or pass. We are working on allowing other secret services (e.g. KeepassXC), but for now only gnome-keyring is usable without major problems.

Environment Variables

Dev build or run

  • APP_VERSION: set the bridge app version used during testing or building
  • PROTONMAIL_ENV: when set to dev it is not using Sentry to report crashes
  • VERBOSITY: set log level used during test time and by the makefile

Integration testing

  • TEST_ENV: set which env to use (fake or live)
  • TEST_ACCOUNTS: set JSON file with configured accounts
  • TAGS: set build tags for tests
  • FEATURES: set feature dir, file or scenario to test

Folders

There are now three types of system folders which Bridge recognises:

Windows Mac Linux Linux (XDG)
config %APPDATA%\protonmail\bridge-v3 ~/Library/Application Support/protonmail/bridge-v3 ~/.config/protonmail/bridge-v3 $XDG_CONFIG_HOME/protonmail/bridge-v3
cache %LOCALAPPDATA%\protonmail\bridge-v3 ~/Library/Caches/protonmail/bridge-v3 ~/.cache/protonmail/bridge-v3 $XDG_CACHE_HOME/protonmail/bridge-v3
data %APPDATA%\protonmail\bridge-v3 ~/Library/Application Support/protonmail/bridge-v3 ~/.local/share/protonmail/bridge-v3 $XDG_DATA_HOME/protonmail/bridge-v3
temp %LOCALAPPDATA%\Temp $TMPDIR if non-empty, else /tmp $TMPDIR if non-empty, else /tmp $TMPDIR if non-empty, else /tmp

Files

Base Dir Path
bridge lock file cache bridge.lock
bridge-gui lock file cache bridge-gui.lock
vault config vault.enc
gRPC server json config grpcServerConfig.json
gRPC client json config grpcClientConfig_.json
gRPC Focus server json config grpcFocusServerConfig.json
Logs data logs
gluon DB data gluon/backend/db
gluon messages data gluon/backend/store
Update files data updates
sentry cache data sentry_cache
Mac/Linux File Socket temp bridge{4_DIGITS}

proton-bridge's People

Contributors

0x34d avatar bilyaka avatar ciehanski avatar cuthix avatar d310n9 avatar dimitripapadopoulos avatar dragospe avatar electronafta avatar gjorgjiproton avatar gwillmann avatar horejsek avatar jameshoulahan avatar kortschak avatar lbeernaertproton avatar maximalfr avatar rlejeune74 avatar skooda avatar themobiusproject avatar tpeacock19 avatar xmichelo avatar y86-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

proton-bridge's Issues

Account keeps logging-out

Is there a way to keep the account signed-in? I had no issues while on Proton-Bridge beta. But the with the latest release (v1.2.6) I'm having a lot of sign outs every time, I power down my machine or log out.

Details below -

$ uname -r
5.3.0-46-generic
$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.4 LTS
Release:	18.04
Codename:	bionic
$ protonmail-bridge --version
Protonmail Bridge version 1.2.6 (fd4f0235fb) 2020-03-30T23:45:44+0200

Unable to build: collect2 errors with "ld: cannot find -lGL"

Summary

make build does not successfully build the project

Background

I tried to build the project today on Fedora 32 with Go v1.14.2. Running make build starts to pull in dependencies for the build, but then collect2 fails. I'm not enough of a Go developer to figure out why.

This blocks me from packaging ProtonMail Bridge for Fedora and EPEL (CentOS/RHEL).

Details

There is a short-term fix and long-term fix I see:

Short-term fix: Figure out reason for build failure in stacktrace (below) and reproduce a clean build of ProtonMail Bridge

This gets me to successfully build proton-bridge in a way I can partially package for Fedora, but still makes it difficult to follow because of Fedora's Golang Packaging Guidelines.

Long-term fix: Better separation and reproducibility of build steps

It would be better for me as a packager if proton-bridge worked with the Golang Packaging Guidelines and macros in Fedora. Being able to go get the application and automatically detect dependencies from go.sum would require less hacking together on my end. It would be easier to package.

Outcome

@jwflory can successfully reproduce a build of proton-bridge for packaging in Linux distributions

Uninstalling Bridge on Windows does not remove Startup Program

When uninstalling ProtonMail Bridge on Windows 10, the Startup Item does not get completely removed. It now shows up as a generic Program, and examining the Command Line command it still is trying to run Desktop-Bridge.exe

Expected Behavior

After removing the program, I think that the startup item should be removed as well, as otherwise it is quite hard to get rid of it (despite not being particularly impactful).

Current Behavior

The startup menu persists in the Startup tab of Task Manager (and a corresponding regedit key Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\StartupFolder which, after being deleted, pops up again on reboot)

Steps to Reproduce

  1. Install ProtonMail Bridge on Windows 10 (Respectively, 1.2.6 and Version 1909)
  2. Ensure the run at Startup option is checked in Settings
  3. Uninstall ProtonMail (right clicking in Start Menu)
  4. Check Task Manager for a weird item that is still bound to Desktop-Bridge.exe (screenshot below)

Context (Environment)

This just randonmly happened to me while cleaning up my PC. It's probably just a small oversight in the uninstall code, and I have found a workaround, but felt it would be nice to let you guys know.

Detailed Description

Ensure that when uninstalling the Startup element is removed.

Workaround

As a workaround, the user can reinstall proton mail, uncheck the run at Startup option and then uninstall again. This cleans up everything very nicely. If this works in general it should be quite easy to implement this fix!

Screenshot

Capture

Replace MIME parser completely with some lite version for critical parts

I have encountered several problems inside Bridge and during message encryption on the server as well. The culprit here seems to be that during encryption ProtonMail is trying to parse messages even though it is not actually needed which causes a lot of problems. There are millions and one thing that could go wrong.

I suggest replacing MIME parser for critical tasks with a lite version.
It should be able to find recipient and message body, be able to replace the message body with the encrypted one and add headers. It should not be doing anything else with the message. It should work even if the message does not comply with RFCs.

I think, that find recipient (to decide key) and find the body and replace it and add headers should be safe enough to never fail. I mean like 100%. Because there are some strict conditions on these which needs to be met to even deliver the mail. For the encryption, nothing else is really needed, which in other words mean, nothing else should be done.

This supersedes the: #8

If the UI shows a broken email, it is fine, but if the email gets broken during encryption, it is not fine.

My opinion is that after decryption is completed you should get exactly the same email, to a single bit. Which is currently not the case at all. And with the current way of complete mail parsing is impossible.

[Request][macOS] Add option to hide window on startup

It would be nice to have a configuration option to hide the Proton Bridge's window during system startup. On macOS specifically the window always pops up and can be quite pesky. Low-priority request, but a QoL improvement nonetheless. Would be willing to submit a PR.

Mailspring Email Client Support

Mailspring is a modern email client that is available on all the major platforms, including Linux. Currently it does not work with the Bridge. Quite a lot of research has gone into it on this bug:

Foundry376/Mailspring#429

The crux of the issue (from what I can tell) appears to be unquoted string literals in some responses, which breaks the Mailcore2 library. Therefore fixing this issue should open up a broader set of project to work with the bridge.

Support NATIVE building

Hi,

Currently the build system support only building of binary vendorized package that uses external binary Qt libraries. Even if one were to flex and run

    go build cmd/Desktop-Bridge/main.go

It will crash with

  # github.com/therecipe/qt/core
  core.cpp:10:3: error: #error ------------------------------------------------------------------
     10 |  #error ------------------------------------------------------------------
        |   ^~~~~
  core.cpp:11:3: error: #error please run: '$(go env GOPATH)/bin/qtsetup'
     11 |  #error please run: '$(go env GOPATH)/bin/qtsetup'
        |   ^~~~~
  core.cpp:12:3: error: #error more info here: https:
     12 |  #error more info here: https://github.com/therecipe/qt/wiki/Installation
        |   ^~~~~
  core.cpp:13:3: error: #error ------------------------------------------------------------------
     13 |  #error ------------------------------------------------------------------
        |   ^~~~~
  core.cpp:15:10: fatal error: QAbstractAnimation: No such file or directory
     15 | #include <QAbstractAnimation>
        |          ^~~~~~~~~~~~~~~~~~~~
  compilation terminated.

This by no means allow to build a proper distribution package, and seems like that's also the reason why binary Proton Bridge actually ships with dozens of Qt libs that are not even linked.

Please be so kind and support proper, non-binary-package-only building, in a way that the client will use system-wide Qt and other libraries, rather than use precompiled binary blobs.

internal/imap: assignment to entry in nil map

This looks to be a problem with internal/imap/store.Message; it returns a *pmapi.Message with a nil Header.

Since this is completely repeatable (running the bridge results in a panic as soon as the client attempts to pull messages) and I have not upgraded the bridge, this is presumably something that is recently broken at the server end, though the bridge should be robust to it and not panic.

Expected Behavior

Messages are pulled from the server.

Current Behavior

protonmail-bridge panics

panic: assignment to entry in nil map

goroutine 147 [running]:
net/textproto.MIMEHeader.Set(...)
	net/textproto/header.go:22
github.com/ProtonMail/proton-bridge/pkg/message.SetBodyContentFields(0xc000774c78, 0xc00072c000)
	github.com/ProtonMail/proton-bridge@/pkg/message/header.go:98 +0x12e
github.com/ProtonMail/proton-bridge/internal/imap.(*imapMailbox).setMessageContentType(0xc0005fc000, 0xc00072c000, 0x13cdba0, 0x1269ee0, 0x200)
	github.com/ProtonMail/proton-bridge@/internal/imap/mailbox_message.go:626 +0xbc
github.com/ProtonMail/proton-bridge/internal/imap.(*imapMailbox).buildMessageInner(0xc0005fc000, 0xc00072c000, 0xc000343170, 0x0, 0x1, 0x120, 0x1101d60, 0x21a3000000000008, 0xc00074af70)
	github.com/ProtonMail/proton-bridge@/internal/imap/mailbox_message.go:681 +0x6d
github.com/ProtonMail/proton-bridge/internal/imap.(*imapMailbox).buildMessage(0xc0005fc000, 0xc00072c000, 0xc00075e7b0, 0x0, 0x58, 0xc000754000, 0xb0, 0x2)
	github.com/ProtonMail/proton-bridge@/internal/imap/mailbox_message.go:663 +0x1b6
github.com/ProtonMail/proton-bridge/internal/imap.(*imapMailbox).getBodyStructure(0xc0005fc000, 0x1410f40, 0xc00075e690, 0xb, 0x0, 0xc00074b9b8, 0xa77e8c)
	github.com/ProtonMail/proton-bridge@/internal/imap/mailbox_message.go:339 +0x12c
github.com/ProtonMail/proton-bridge/internal/imap.(*imapMailbox).getMessage(0xc0005fc000, 0x1410f40, 0xc00075e690, 0xc0000d0fc0, 0x4, 0x6, 0x0, 0x0, 0x0)
	github.com/ProtonMail/proton-bridge@/internal/imap/mailbox_message.go:299 +0x39c
github.com/ProtonMail/proton-bridge/internal/imap.(*imapMailbox).ListMessages.func2(0x10339a0, 0xc000226bd0, 0x1, 0x0, 0x0, 0x0)
	github.com/ProtonMail/proton-bridge@/internal/imap/mailbox_messages.go:389 +0x33f
github.com/ProtonMail/proton-bridge/pkg/parallel.RunParallel.func2(0xc0000cae70, 0xc0000439e0, 0xc000048e40, 0xc000226cb0, 0xc000043a40)
	github.com/ProtonMail/proton-bridge@/pkg/parallel/parallel.go:79 +0xfa
created by github.com/ProtonMail/proton-bridge/pkg/parallel.RunParallel
	github.com/ProtonMail/proton-bridge@/pkg/parallel/parallel.go:76 +0x1d7

Possible Solution

There is no workaround.

Steps to Reproduce

  1. Run protonmail-bridge.
  2. Get client to sync
  3. Bang!

Context (Environment)

I am trying to read email.

Detailed Description

Evolution mail client.

~ $ evolution --version
evolution 3.28.5-0ubuntu0.18.04.2 
~ $ protonmail-bridge --version
INFO[0000] Run app                                       appLong="Protonmail Bridge" appShort=bridge args="[protonmail-bridge --version]" build="2020-05-19T00:33:31+0200" pkg=main revision=50ed40f205 runtime=linux version=1.2.7
Protonmail Bridge version 1.2.7 (50ed40f205) 2020-05-19T00:33:31+0200

Note that the failure is replicated when using thunderbird.

Possible Implementation

Have *imapMailbox.setMessageContentType check m's validity before use?

Support RFC 8551 (S/MIME) V4.0 Message Specification (for EnvelopedData / Protected Headers)

In Thunderbird with Enigmail and a GPG key, I can encrypt my emails and header data, like subjects, with Autocrypt. I would like ProtonMail Bridge to support RFC 8551 / Autocrypt Protected Headers so my header data remains confidential and so I can reply to encrypted subjects with clients that support that protocol.

Expected Behavior

  1. Alice has a GPG key, Bob has a ProtonMail account with ProtonMail Bridge and Thunderbird
  2. Alice encrypts a message with Protected Headers with Bob's public key
  3. Alice's encrypted message passes through ProtonMail servers and to ProtonMail Bridge on Bob's computer
  4. Bob receives encrypted email from Alice
  5. Bob successfully decrypts Alice's message with Protected Headers like the Subject: field

Current Behavior

  1. Alice has a GPG key, Bob has a ProtonMail account with ProtonMail Bridge and Thunderbird
  2. Alice encrypts a message with Protected Headers with Bob's public key
  3. Alice's encrypted message passes through ProtonMail servers and to ProtonMail Bridge on Bob's computer
  4. Bob receives encrypted email from Alice
  5. Bob successfully decrypts Alice's message, but details like the email subject and some other metadata is lost.

Possible Solution

Not sure if this is an upstream issue with ProtonMail server software, or if this kind of email metadata can be decrypted by ProtonMail Bridge. But any solution that provides me with two-way encrypted email support through ProtonMail Bridge, I am happy.

For what it is worth, I am a Visionary subscriber. I prefer to submit feedback as an open source bug instead of starting with support. (This is similar to how Red Hat encourages their customers to collaborate upstream on Red Hat's open source products.) But happy to direct this where it will be heard.

Context (Environment)

It affects me in two ways:

  1. Difficult to communicate with non-ProtonMail PGP users who use Protected Headers to encrypt email subjects
  2. Leaves one vector of discussion exposed in non-ProtonMail email server transit

It would make me feel more secure if I could trust that metadata like email subject is also encrypted by default.

Detailed Description

Possible Implementation

Not sure if the bridge could handle this metadata locally on the client or if it needs to be processed upstream in the server. But the desired user experience is the email subject is either decrypted by default, or (current behavior in Thunderbird+Enigmail), the subject decrypts once I open the email.


Advice how to build with local version of libraries

Hello, I am now trying to build with latest version of go-mime and gopenpgp to look into some issues. What is the recommended way to build against local version?

I have tried:

  github.com/ProtonMail/gopenpgp => ../gopenpgp
  github.com/ProtonMail/go-mime => ../go-mime

But it leads me to:

../gopenpgp/crypto/message.go:15:2: use of internal package github.com/ProtonMail/gopenpgp/v2/internal not allowed

APPEND result when targetSeq.Len() == 0

Already reported to support. Adding here as well.

Is this really ok, to return success if the sequence is empty? Seems to cover failure on the server.

  info := appendSucess
  if targetSeq.Len() > 0 {
    info = fmt.Sprintf("[%s %d %s] %s",
      appenduid,
      uidValidity,
      targetSeq.String(),
      appendSucess,
    )
  }

  return &imap.StatusResp{
    Type: imap.StatusOk,
    Info: info,
  }

My report:

IMAP over ProtonBridge silently fails when importing mail into Sent folder where From corresponds to one of the user adresses causing a loss of emails.

Consider I have [email protected] added to my account and minimal example below:

When I try to import a message like this where From corresponds to [email protected] account:
MIME-Version: 1.0
Date: Mon, 10 Jan 2021 12:12:12 +0200
Message-ID: [email protected]
Subject: Test
From: [email protected]
To: [email protected]

It results in this IMAP communication:
45:34.13 > b'KLII4 APPEND Sent "13-Apr-2020 01:45:34 +0200" {160}'
45:34.13 < b'+ send literal'
45:34.13 write literal size 160
45:34.13 < b'KLII4 OK APPEND completed'

Even though completed, the email is not added into the Sent folder.
ProtonBridge does not report any error as well, just ordinary: No matching UID, continuing APPEND to Sent

When I on the other hand try to import a message where From corresponds to a different address not added to my account:
MIME-Version: 1.0
Date: Mon, 10 Jan 2021 12:12:12 +0200
Message-ID: [email protected]
Subject: Test
From: [email protected]
To: [email protected]

It results in this IMAP communication:
45:47.98 > b'OFJB4 APPEND Sent "13-Apr-2020 01:45:47 +0200" {161}'
45:47.98 < b'+ send literal'
45:47.98 write literal size 161
45:48.30 < b'OFJB4 OK [APPENDUID 4 33] APPEND successful'

And the email is stored in the Sent folder.
ProtonBridge reports: Importing external message

This does not affect Inbox, only on Sent.

Fix various message/MIME based errors

The parser for message/MIME should be more graceful or maybe better - not even parser what it does not need and leave it as is.

I think it should fail only when it would prevent encryption of the message and for that, you just really need to separate headers and body.

I suggest making this aggregate of all message/MIME parsing errors or maybe this should move to the sub-projects.

  1. "multipart: unexpected line in Next(): %q" - relates to go-message repository.
    I think this relates to the multipart/mixed inside multipart/mixed.
  2. "non-utf8 content without charset specification" - relates to go-mail repository.
    This seems to be related to either missing charset or charset on the new line.
    This actually fixes "reformime -r7" so.
  3. "mime: duplicate parameter name" - not sure where this is coming.

These errors usually prevent the email to be imported through the bridge.

I can supply test files 1. and 2.

qtdeploy: Command not found despite having QT installed

Hi,
I just cloned the repo and make build and I get this:

/usr/bin/go
go install -v -tags=no_env github.com/therecipe/qt/cmd/...
go mod vendor
ln -sf /home/newin/project/proton-bridge/vendor-cache/github.com/therecipe/env_linux_amd64_513 vendor/github.com/therecipe/env_linux_amd64_513
rm -rf deploy linux cmd/Desktop-Bridge/deploy
cp cmd/Desktop-Bridge/main.go .
qtdeploy -tags='pmapi_prod' -ldflags '-X main.Version=1.2.6-git -X main.Revision=409abba995 -X main.BuildTime=2020-04-16T00:03:59+0200' build desktop
make: qtdeploy: Command not found
make: *** [Makefile:62: cmd/Desktop-Bridge/deploy/linux/proton-bridge] Error 127

Even if it's not listed in the dependancies I have QT (5.14.2) installed on my machine but I don't have any qtdeploy. Also surprisingly I don't see any mention of a qtdeploy in the QT documentation. What am I missing ?

where is the private cert?

So I am using a email client that does not have the option to accept an untrusted cert even if is local, such I like, and why I use this client... so I need the cert protonmail-bridge is using to create the local cert so I can add it to my system keys so it sees it as valid... where can I find this?
I am looking around and cant see this info, or in the FAQ and Im starting to get worried, and before I write a blog post about this, that there is no way for a user to get the original signing key to create the local cert I want to ask where can I get this key?
I sent an email to support 1 week a go, no reply. mute silence...

pass manager: Use Proton-specific sub-folder

Summary

When using the pass password manager, ProtonMail Bridge should initialize in a sub-folder specific to itself

Background

Before I used ProtonMail Bridge, I used pass to manage my passwords. Now, ProtonMail Bridge commits passwords to my existing password store. This is fine, but I also synchronize my pass repository to a remote repository. I end up pushing my ProtonMail Bridge commits up to my password repository. It causes problems when I use ProtonMail Bridge on two different machines.

Details

pass can be initialized in a sub-folder:

pass init --path=sub-folder gpg-id

There could be a ProtonMail Bridge-specific folder that doesn't interfere with existing personal passwords I manage with pass.

Outcome

ProtonMail Bridge password credentials do not interfere with user's personal password repositories

Create official Fedora / EPEL package

I'm opening this issue as an initial discussion point for landing protonmail-bridge as an official package in Fedora and Fedora EPEL (for CentOS/RHEL). I think this would make ProtonMail Bridge more accessible for many Linux users. It would also ensure compliance with Fedora's licensing guidelines for best open source practices.

I have started to test building a RPM spec. It is my first time packaging a Golang app for Fedora. It is taking me some time to figure it out, but I am working with the Packaging Guidelines:

https://docs.fedoraproject.org/en-US/packaging-guidelines/Golang/

If upstream has an RPM spec for ProtonMail Bridge, it would also be nice to consider committing this to the source repo. I am also happy to contribute RPM spec improvements back upstream that comply with the Fedora Packaging Guidelines.

Error appending message: mime: invalid media parameter

I'm using Evolution 3.36.2-1, I'm having two accounts (a local Maildir, and proton-bridge), and I'm trying to move a mail from my Maildir to protonmail.

My message is a multipart/mixed, the attachment looks like this in the eml:

--047d7bdcab7c6efaf604f6d9c256
Content-Type: application/octet-stream; name=copie CE2
Content-Disposition: attachment; filename=copie CE2
Content-Transfer-Encoding: base64
X-Attachment-Id: f_htx17pui0

[the base64 blob, redacted for privacy]

It's advised as application/octet-stream with a name without extension, but it's in fact a proper PDF file.

Expected Behavior

I expect protonmail-bridge to accept the message, even if it does not recognize the attachment.

Current Behavior

Getting an invalid media parameter error, but I see nothing in the logs, and evolution don't give me more details.

Credential storage/retrieval fails (flatpak)

Summary

ProtonMail Bridge v1.2.6 stuck in a login loop after prompting for 2FA key

Background

When I open ProtonMail Bridge, I go to add my account. I enter my email and password successfully. I am prompted for 2FA key. I enter 2FA key. After entering 2FA key response, I am sent back to the login screen with an error at the top:

Failure: user interaction failed

Details

Here is a screenshot of what it looks like in my GUI:

Screenshot of error message in Proton Bridge

I am using a Flatpak on Linux (Fedora 32).

Outcome

Need to log in again to start bridge for my account

Fix failing tests from `make test`

Summary

Six files have failing unit tests

Background

I was looking at packaging ProtonMail Bridge officially for Fedora. Running make test results in failed tests on my end. The output of make test needs to be passing if I can move ahead on packaging in Fedora.

Details

$ make test
go test -coverprofile=/tmp/coverage.out -run= \
	./internal/api/... \
	./internal/bridge/... \
	./internal/events/... \
	./internal/frontend/autoconfig/... \
	./internal/frontend/cli/... \
	./internal/imap/... \
	./internal/preferences/... \
	./internal/smtp/... \
	./internal/store/... \
	./pkg/...
# pkg-config --cflags  -- libsecret-1
Package libsecret-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `libsecret-1.pc'
to the PKG_CONFIG_PATH environment variable
Package 'libsecret-1', required by 'virtual:world', not found
pkg-config: exit status 1
FAIL	github.com/ProtonMail/proton-bridge/internal/bridge [build failed]
FAIL	github.com/ProtonMail/proton-bridge/internal/bridge/credentials [build failed]
FAIL	github.com/ProtonMail/proton-bridge/internal/imap [build failed]
ok  	github.com/ProtonMail/proton-bridge/internal/imap/cache	0.155s	coverage: 72.7% of statements
ok  	github.com/ProtonMail/proton-bridge/internal/imap/uidplus	0.034s	coverage: 67.9% of statements
FAIL	github.com/ProtonMail/proton-bridge/internal/smtp [build failed]
FAIL	github.com/ProtonMail/proton-bridge/internal/store [build failed]
ok  	github.com/ProtonMail/proton-bridge/pkg/algo	0.032s	coverage: 100.0% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/config	2.608s	coverage: 70.5% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/connection	10.167s	coverage: 34.6% of statements
FAIL	github.com/ProtonMail/proton-bridge/pkg/keychain [build failed]
ok  	github.com/ProtonMail/proton-bridge/pkg/listener	1.062s	coverage: 91.7% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/message	0.031s	coverage: 19.5% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/mime	0.015s	coverage: 67.4% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/parallel	6.758s	coverage: 98.1% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/pmapi	54.492s	coverage: 59.4% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/ports	0.003s	coverage: 71.4% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/srp	0.243s	coverage: 70.3% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/updates	0.050s	coverage: 42.9% of statements
ok  	github.com/ProtonMail/proton-bridge/pkg/useragent	0.004s	coverage: 43.8% of statements
make: *** [Makefile:130: test] Error 2

Outcome

All tests should pass when running make test

Uning Apple's Mail client: emails are duplicated for each save

When composing a new email and I save the draft repeatedly (as I am in the habit of doing a lot), for each save a copy is uploaded to the protonmail server. For many emails I have 20 copies laying around.

Btw. Deleting them in the client doesn't help, because they get downloaded again from the server. The only way to get rid of them is to log into protonmail via the web interface and delete them there.

bad fonts encoding

the bridge has many interfaces where is not possible to read the chars. See screenshot.
System: Fedora 31 KDE
proton_bridge

support for Alpine/Aerc

I am trying to make alpine or aerc work with proton-bridge.
but both of them fail to display messages (they can fetch emails from the local IMAP server of proton-bridge, though).

Alpine fails with the most informative errors.

  • when fetching new messages:
{localhost/novalidate-cert:1143/[email protected]/tls}INBOX: Unexpected untagged message: FLAGS
  • when opening a message:
 Unknown body disposition: "inline" NIL NIL) FLAGS (\Seen nonjunk))
[list message build: wrong section 1]
[Message size does not match expected size, continuing...]

could this be fixed?
anything I could do on my end to help with that?

missing dependency: libsecret-1-dev

on Debian Testing, make run fails with the following message:

# command-line-arguments
/usr/lib/go-1.14/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: cannot find -lsecret-1
collect2: error: ld returned 1 exit status

make: *** [Makefile:191: run-nogui-cli] Error 2

Problem list

These are the problems I have encountered so far after 14 days of using ProtonMail. I am losing track of what I have reported and how, so I would like to keep it in one place and mark it solved when it is solved. Support advised me that there is no public bug tracking and as most of these relates to Bridge or are somehow connected to Bridge, I would like to keep it here.

Receiving emails:

  1. Damages some emails by correctly not detecting headers and body, causing the part of headers to be encrypted as part of the body.
    Reported to [email protected]
  2. Damages signatures on emails, for example, S/MIME.
    Reported: #26
  3. Damages attachments encoded as quoted-printable replacing \r\n by \n in binary files.
    Reported: #18
  4. Ads Content-Disposition: inline to multipart data.
    Reported: #18
  5. Changes encoding to all parts to base64.
    Reported: #18
  6. Does not comply with RFC7505 and hijacks emails sent to a domain hosted on ProtonMail even if the MX records do not lead to ProtonMail and by that opens you to a few kinds of a man-in-the-middle attack.
    Reported to [email protected], [email protected]
  7. Corrupts emails which contains another email (like an undeliverable response), but incorrectly detecting headers and body and making part of the headers part of the body.
    Reported to [email protected]

Sending and importing emails from ProtonBridge:

  1. Damages signatures on emails, for example, S/MIME.
    Reported: #26
  2. Silently shreds any email moved into Sent folder where the From corresponds to the account email (complete loss of that email when moving from a different IMAP account, even the ProtonMail one).
    Reported: #2
  3. Unable to import a large number of messages because of various parsing problems, namely:
  • NO non-utf8 content without charset specification
  • NO mime: duplicate parameter name
  • NO mime: invalid media parameter
  • NO multipart: NextPart: EOF
  • NO malformed MIME header line:
  • NO multipart: unexpected line in Next():
    Reported here: #8, #18
  1. Ads Content-Disposition: attachment to multipart data.
    Reported: #18
  2. Fails to import mails over 26214400 bytes.
    Reported to [email protected]
  3. Randomly fails to return APPENDUID.
    Reported to [email protected]
  4. Operating with a large number of emails causes unrecoverable 120% CPU usage until the cache was cleared.
    Reported: #25
  5. Changes encoding to all parts to base64.
    Reported: #18

General:

  1. All Mail folder contains Trash and Spam which is non-standard and causes glitches in mail clients (like a complete profile failure).
    Reported to [email protected], [email protected]

Web UI:

  1. Cannot find emails by subject if it contains /, \ or ? symbols.
    Reported to [email protected]
  2. Cannot find emails by message-id.
    Reported to [email protected]
  3. When an email is moved into Sent folder, it shows message of success, but actually fails and messages stay in the original location.
    Maybe connected to this somehow as well: #2
    Reported to [email protected]
  4. Reports any action as success even if it fails.

internal/frontend/cli: missing handling of events.OutgoingNoEncEvent

I am trying to run proton-bridge in a headless setting with:

$> protonmail-bridge -l debug-client --noninteractive

and trying to send emails with git send-email like explained in git-send-email.

everything seems to work ok (once I instructed git-send-email to look for the proton-bridge self-signed certificate under ~/.config/protonmail/bridge/cert.pem), except for that pesky error:

DEBU[Jun 26 12:34:07.266] Requesting  GET /keys?Email=<redacted>   pkg=pmapi userID="<redacted>"
WARN[Jun 26 12:34:07.347] No channel is listening to outgoingNoEncryption data <redacted>:test  pkg=bridgeUtils/listener
DEBU[Jun 26 12:34:07.347] Waiting for sendingUnencrypted confirmation for <redacted>  pkg=smtp
[..]
DEBU[Jun 26 12:34:26.246] sendingUnencrypted timeout, not sending <redacted>  pkg=smtp
DEBU[Jun 26 12:34:26.247] Requesting  PUT /messages/delete              pkg=pmapi userID="<redacted>"
DEBU[Jun 26 12:34:26.332] 554 Error: transaction failed, blame it on the weather: sending was canceled by user  pkg=smtp/server
DEBU[Jun 26 12:34:26.333] SMTP client logged out user                   pkg=smtp

it seems to me internal/frontend/cli is missing (like is done for internal/frontend/qt) the creation of a channel like so:

outgoingNoEncCh := s.getEventChannel(events.OutgoingNoEncEvent)

in its watchEvents() method.

could this be fixed?

perhaps just something like (untested):

diff --git a/internal/frontend/cli/frontend.go b/internal/frontend/cli/frontend.go
index d0e6c61..7fdf988 100644
--- a/internal/frontend/cli/frontend.go
+++ b/internal/frontend/cli/frontend.go
@@ -19,6 +19,8 @@
 package cli
 
 import (
+       "strings"
+
        "github.com/ProtonMail/proton-bridge/internal/events"
        "github.com/ProtonMail/proton-bridge/internal/frontend/types"
        "github.com/ProtonMail/proton-bridge/internal/preferences"
@@ -192,6 +194,7 @@ func New( //nolint[funlen]
 
 func (f *frontendCLI) watchEvents() {
        errorCh := f.getEventChannel(events.ErrorEvent)
+       outgoingNoEncCh := f.getEventChannel(events.OutgoingNoEncEvent)
        internetOffCh := f.getEventChannel(events.InternetOffEvent)
        internetOnCh := f.getEventChannel(events.InternetOnEvent)
        addressChangedCh := f.getEventChannel(events.AddressChangedEvent)
@@ -202,6 +205,11 @@ func (f *frontendCLI) watchEvents() {
                select {
                case errorDetails := <-errorCh:
                        f.Println("Bridge failed:", errorDetails)
+               case idAndSubject := <-outgoingNoEncCh:
+                       idAndSubjectSlice := strings.SplitN(idAndSubject, ":", 2)
+                       messageID := idAndSubjectSlice[0]
+                       subject := idAndSubjectSlice[1]
+                       f.Printf("Sending msg-id=%q, subject=%q unencrypted...", messageID, subject)
                case <-internetOffCh:
                        f.notifyInternetOff()
                case <-internetOnCh:

MAIL command doesn't support AUTH Parameter

Some mail clients (e.g. KMail and E-mailRelay) include parameters such as BODY= and AUTH= in the MAIL command in addition to the primary FROM: parameter. When a client sends a MAIL command with an AUTH parameter, protonmail-bridge returns a 501 code.

Expected Behavior

AUTH parameters should be handled per https://tools.ietf.org/html/rfc4954#section-5. This has been fixed upstream in go-smtp.

Current Behavior

Both myself and another user (see https://www.reddit.com/r/ProtonMail/comments/evadaz/need_help_setting_up_outgoing_with_kmail/ for the other report) are experiencing the following interaction:

Example command from the client:

MAIL FROM:<[email protected]> BODY=7BIT AUTH=<username>

Response from protonmail-bridge:

501 Was expecting MAIL arg syntax of FROM:<address>

Possible Solution

Possibly as simple as pulling in the latest go-smtp. It looks like protonmail-bridge uses an old fork (circa 2018) that has different handling behavior for the optional mail parameters.

I'm actually a little unsure about exactly what's happening here though; reading through the conn.go file in the fork, it's unclear to me how MAIL FROM:<[email protected]> AUTH=<username> would result in the error above. I'm sure I'm missing something :P.

When I modified E-mailRelay (http://emailrelay.sourceforge.net/index.html#) to stop appending the AUTH and BODY parameters (commented out lines 190-201 in src/gsmtp/gsmtpclientprotocol.cpp in version 2.1), protonmail-bridge stopped returning a 501 and emails started going through.

Steps to Reproduce

I haven't created a minimal repro with telnet, but I can try that if it would be helpful.

Context (Environment)

Trying to send an email to protonmail-bridge from an email client.

[Thunderbird] "folders" and "labels" not syncing

Few days ago, I have installed Thunderbird and added my Visionary account.

The problem is: "folders" and "labels" not synchronized.
I can sends emails, received new emails, but I cannot get other emalis.

OS: Archlinux (5.6.8-arch1-1)
Bridge version: 1.2.6
Thunderbird version: 68.7.0 (64 bits)

Apple Mail keeps re-downloading all of my emails

This has been a long standing issue for me and a number of people who've reported the issue over the years on Reddit and ProtonMail support. I ended up giving up and requesting a refund at the time. This year however I decided to give it another shot and see if the issue has been fixed. I'm sad to say that this is still a problem. I'm hoping now that the Bridge is open source, we can have an open conversation on why this is happening and how we can help finding the root cause.

I still haven't figured out the exact pattern of when this happens, but I started to write down my actions and I'll be updating this issue as it happens. It usually works fine for a few days, then after a while it starts re-downloading emails on a regular basis, sometimes several times per day. I can never find anything useful in the Bridge logs.

...
{"error":"mailbox  does not exist","level":"error","msg":"Could not get mailbox","name":"","pkg":"imap","time":"2020-04-28T11:56:23+02:00"}
{"error":"mailbox  does not exist","level":"error","msg":"Could not get mailbox","name":"","pkg":"imap","time":"2020-04-28T12:01:02+02:00"}
{"error":"mailbox  does not exist","level":"error","msg":"Could not get mailbox","name":"","pkg":"imap","time":"2020-04-28T12:02:04+02:00"}
{"error":"mailbox  does not exist","level":"error","msg":"Could not get mailbox","name":"","pkg":"imap","time":"2020-04-28T12:03:57+02:00"}

The last time this happened, I didn't do anything special. Just read a few emails, archive them, I un-flagged an email. A few minutes later I could hear my laptop fans spinning and I saw that the Bridge and Apple Mail were working full speed downloading my emails again.

What can we do to help you find the cause for this?

Is ProtonMail staff reading this issue tracker at all?

Judging from the activity so far, it does not seem that any comment/acknowledgement/question came from ProtonMail staff.

It would be good to know if they do read, and if there is actually any point in reporting issues here, or if this is supposed to be just a community forum.

How is this issue tracker supposed to be used in relation to the 'Report a bug' feature of the Bridge?

proton-bridge build fails

Attempting to build proton-bridge by downloading the 1.2.7-live.1 archive tarball and running make build on x86_64 glibc Linux fails.

Expected Behavior

proton-bridge should build correctly and produce an executable.

Current Behavior

The build process of proton-bridge fails midway through. Here is an output log:
proton-bridge-build.log

Possible Solution

Possible missing build dependency?

Steps to Reproduce

  1. Download the 1.2.7-live.1 release tarball on a x86_64 glibc Linux system
  2. Run make build in the project root directory

Context (Environment)

I am attempting to package this software for the Linux distribution I use. However, I am encountering the error described above regardless if I try to build proton-bridge directly from GitHub or if I use my distribution's build tools.

UPDATE: After the manual installation of several libraries not listed as dependencies, we are now experiencing the following error upon running the built executable:
proton-bridge: symbol lookup error: proton-bridge: undefined symbol: _ZdlPvm, version Qt_5
Is this some sort of missing dependency issue?.

Receiving messages encrypted by 3rd party keys

Let's say I recieve an email that is encrypted to my own PGP key. Currently, Bridge mangles the encrypted message and wraps it html with a message :

Decryption error
Decryption of this message's encrypted content failed.
openpgp: incorrect key

The PGP message that follows is mangled and cannot be decrypted.
However, in the web client the same message is not mangled and can be decrypted with gpg -d. I find this behaviour very odd. Why is Bridge altering the content of the messages? Sending already encrypted emails fails too:

msmtp: the server did not accept the mail
msmtp: server message: 554 Error: transaction failed, blame it on the weather: backend: cannot create draft: cannot create attachment: Invalid input

I'd very much like to see this fixed. There should at least be an option to let incoming email pass through as-is.

Originally posted by @ettom in #4 (comment)

Signed emails has broken signatures after ProtonMail mangles them

S/MIME:

$ openssl smime -verify -in FW_\ anyconnect\ -\ ProtonMail.eml 
Error reading S/MIME message
139644724533056:error:0D0D40CD:asn1 encoding routines:SMIME_read_ASN1:invalid mime type:../crypto/asn1/asn_mime.c:469:type: multipart/mixed

$ openssl smime -verify -in FW_\ anyconnect\ -\ Bridge.eml 
Error reading S/MIME message
139802251859776:error:0D0D40CD:asn1 encoding routines:SMIME_read_ASN1:invalid mime type:../crypto/asn1/asn_mime.c:469:type: multipart/mixed

$ openssl smime -verify -in FW_\ anyconnect\ -\ Gmail.eml
...
Verification successful

install proton-bridge as a sevice with no gui

Issue tracker is ONLY used for reporting bugs with technical details. "It doesn't work" or new features should be discussed with our customer support. Please use bug report function in Bridge or contact [email protected].

Expected Behavior

I can install it as a service (sudo service proton-bridge start) with config file or teminal ui or alternative, and run it on the cloud/server/rasbperry pi/etc

Current Behavior

only gui app

Possible Solution

Not sure about technical part, but I'm sure it's not a problem to make it w/o GUI

Context (Environment)

I'd like to have this running on my server so I can access mailbox via any email client w/o running bridge on my pc and only when I'm at home.

KDE Wallet support

Currently proton-bridge requires gnome-keyring to run on desktop. Which is very inconvenient to use in KDE since it already has a system to store credentials (which e.g. used by chrome).

Here's API reference of kwallet.

And here's KDE Wallet Manager wiki page.

Unable to build and missing dependency

When building on fedora 32 I get the issue /usr/bin/ld: cannot find -lGL, this is fixed by installing libGL.so, which should be listed in BUILDS.md. In the particular case of fedora it is provided by libglvnd-devel.

After fixing this issue it will give the error

/usr/bin/go
go install -v -tags=no_env github.com/therecipe/qt/cmd/...
go mod vendor
github.com/ProtonMail/proton-bridge/internal/frontend/qt imports
	github.com/therecipe/qt/core imports
	github.com/therecipe/qt imports
	syscall/js: package syscall/js is not in GOROOT (/usr/src/syscall/js)
make: *** [Makefile:94: prepare-vendor] Error 1

The error persists if I set GOROOT=/usr/lib/golang which is where syscall/js is.

Sending from aliases when in combined inbox mode

I have various address aliases set up, but cannot send from them when in combined inbox mode. For me they are not meant as seperate mailboxes, so the split address mode isn't useful.

Expected Behavior

When setting from address in my email client to a valid configured alias, the email sent out will have it's from header set to that value.

Current Behavior

The email sent out has the from header from the main address.

Possible Solution

Instead of setting the from header to be the main address, use the from header if it's set to a valid alias.

Steps to Reproduce

  1. send an email with a from header specified that is different to the main email address:
msmtp -a protonmail [email protected] <<EOF
To: [email protected]
From: [email protected]
Subject: test4

test4
EOF
  1. See headers in the email sent are different (I snipped the other headers):
To: [email protected]
From: [email protected]
Reply-To: [email protected]
Subject: test4

test4

Context (Environment)

I use a terminal-based email setup with protonmail bridge, isync (mbsync), notmuch, alot, msmtp. I have a custom domain with various wildcard aliases that I want to send from. They are not supposed to be mailboxes in themselves though.

Detailed Description

Possible Implementation

High CPU usage when doing nothing

Basically, when I run it, my fan does not stop at all. Proton-bridge is 120% CPU usage in htop. No program is interfacing with it. So no message encryption should occur.

Screenshot_2020-04-23_17-03-46

Publish protonmail-bridge.desktop in git

I am trying to package ProtonMail Bridge for Fedora. I see in the official RPM from ProtonMail, there is a .desktop file included in the RPM:

[Desktop Entry]
Type=Application
Version=1.1
Name=ProtonMail Bridge
GenericName=ProtonMail Bridge for Linux
Comment=The Bridge is an application that runs on your computer in the background and seamlessly encrypts and decrypts your mail as it enters and leaves your computer.
Icon=/usr/share/icons/hicolor/scalable/apps/protonmail-bridge.svg
Exec=protonmail-bridge
Terminal=false
Categories=Office;Email;Network
StartupWMClass=protonmail-bridge

It would be nice for downstream packagers if this file, along with the Icon SVG, were available in upstream.

[Linux] hardcoded icon

Hello guys, thank you for ProtonMail and providing Bridge to Linux users :-)

Would it be possible to don't "hardcode" icon's path in the .desktop file please?

Icon=protonmail-bridge is enough to grab the one you provide, and allows us to override it with custom themes as well.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.