Commit Graph

54 Commits

Author SHA1 Message Date
James Houlahan 792317e945 Other: Prevent double login 2022-12-14 10:15:40 +01:00
Jakub 6c30a04ac0 Merge branch 'release/perth_narrows' into devel 2022-12-07 09:26:59 +01:00
James Houlahan 58d04f9693 GODT-2187: Skip messages during sync that fail to build/parse 2022-12-06 14:07:13 +00:00
James Houlahan 04881b9b78 GODT-2178: Bump go-proton-api to fix drafts 2022-12-05 15:14:30 +01:00
James Houlahan 990b8cda96 GODT-2180: Allow login with FIDO2
The API docs didn't specify what the "integer" meant. Turns out it's a
bitfield; we can't compare with equality.
2022-12-05 14:22:38 +01:00
Xavier Michelon 4003e0a2ab
GODT-2042: fix setup guide not always showing on first login. 2022-12-02 11:36:31 +01:00
James Houlahan ae7ae2886f GODT-2041: Crash after factory reset
I forgot to remove the user from the users map during factory reset.
This meant the (deleted) would attempt to be closed during teardown.
2022-11-28 19:58:10 +01:00
James Houlahan e601245f01 Other(chore): Bump major version to v3 2022-11-23 16:08:27 +01:00
James Houlahan ad1fb47b0d Other: Switch from liteapi to go-proton-api 2022-11-23 15:17:56 +01:00
James Houlahan b81fa5ed39 GODT-2139: Validate key pass during login 2022-11-22 14:51:31 +00:00
Leander Beernaert 0df4f41269 Other: Remove unused SyncBuffers setting 2022-11-22 13:59:06 +01:00
Xavier Michelon 1abda7555d GODT-2131: if refresh token is revoked, user gets signed out. 2022-11-22 07:23:07 +00:00
James Houlahan 7d84ab37f6 GODT-2100: Load users in parallel at startup 2022-11-19 12:13:33 +01:00
James Houlahan e60bbaa60f Other: Add more user-level logs 2022-11-18 13:30:45 +00:00
Xavier Michelon e087a7972e
GODT-2003: introduces 3 phases user state (SignedOut/Locked/Connected)
WIP: introduced UserState enum in GUI and implemented logic.
2022-11-16 16:24:55 +01:00
Jakub ae87d7b236 GODT-1913: pass reporter to gluon, limit restarts, add crash handlers. 2022-11-16 13:48:31 +01:00
James Houlahan 59278913ca GODT-2037: Handle and log API refresh event 2022-11-16 13:48:31 +01:00
James Houlahan 04f2dd1a0b GODT-2021: Remove gluon data when deleting user 2022-11-16 13:48:31 +01:00
James Houlahan c548ba85fe Other: Add more extensive logging 2022-11-16 13:48:30 +01:00
James Houlahan bc7912e8fb GODT-2022: Fix change between address modes 2022-11-16 13:48:30 +01:00
James Houlahan 943d95a725 Other: Add UserLoading/UserLoadFail events 2022-11-16 13:48:30 +01:00
James Houlahan 924a423488 Other: Add some more debug logs 2022-11-16 13:48:30 +01:00
James Houlahan 3c4e8730ac Other: Read sync workers setting from vault 2022-11-16 13:48:30 +01:00
James Houlahan d4da325e57 Other(refactor): Sort safe.Mutex types before locking to prevent deadlocks
This change implements safe.Mutex and safe.RWMutex, which wrap the
sync.Mutex and sync.RWMutex types and are assigned a globally unique
integer ID. The safe.Lock and safe.RLock methods sort the mutexes
by this integer ID before locking to ensure that locks for a given
set of mutexes are always performed in the same order, avoiding
deadlocks.
2022-11-16 13:48:30 +01:00
James Houlahan 2bda47fcad Other(refactor): Less unwieldy user type in Bridge
Instead of the annoying safe.Map type, we just use a normal go map
and mutex pair, and use safe.Lock/safe.RLock as a helper function
2022-11-16 13:48:30 +01:00
James Houlahan 6fbf6d90dc Other: Fix IMAP/SMTP/Login leaks/race conditions
Depending on the timing of bridge closure, it was possible for the 
IMAP/SMTP servers to not have started serving yet. By grouping this in
a cancelable goroutine group (*xsync.Group), we mitigate this issue.

Further, depending on internet disconnection timing during user login,
it was possible for a user to be improperly logged in. This change 
fixes this and adds test coverage for it.

Lastly, depending on timing, certain background tasks (updates check,
connectivity ping) could be improperly started or closed. This change
groups them in the *xsync.Group as well to be closed properly.
2022-11-16 13:48:30 +01:00
James Houlahan 828385b049 Other: Fix user sync leaks/race conditions
This fixes various race conditions and leaks related to the user's sync
and API event stream. It was possible for a sync/stream to begin after a
user was already closed; this change prevents that by managing the
goroutines related to sync/stream within cancellable groups.
2022-11-16 13:48:30 +01:00
Leander Beernaert 6bbaf03f1f Other: Fix goroutine leaks in sync tests
Add missing Close calls.

Properly handle nil channel for `user.startSync`.

This patch also updated liteapi and Gluon to latest master and dev
version respectively.
2022-11-16 13:48:30 +01:00
James Houlahan 0f125196a6 Other: Bump go-smtp version to fix race condition
There was a race condition internal to the go-smtp library.
In order to fix it, a version bump was necessary.
However, this significantly changed the library interface.
2022-11-16 13:48:30 +01:00
Leander Beernaert a7a7d9a3d4 GODT-1742: Implement hide All Mail 2022-11-16 12:26:09 +01:00
Leander Beernaert 7c62312220 Other: Fix all linter errors 2022-11-16 12:26:09 +01:00
Leander Beernaert e10cd2a3ed GODT-1901: Allow to set IMAP SSL from UI 2022-11-16 12:26:09 +01:00
James Houlahan ef2dea89b4 Other: Safer vault 2022-11-16 12:26:09 +01:00
James Houlahan fd63611b41 Other: Safer user types 2022-11-16 12:26:09 +01:00
James Houlahan 2450511555 Other: Put back split login process in backend 2022-11-16 12:26:09 +01:00
James Houlahan 509a767e50 GODT-1657: More stable sync, with some tests 2022-11-16 12:26:09 +01:00
James Houlahan 9d69a2e565 GODT-1657: Stable sync (still needs more tests) 2022-11-16 12:26:09 +01:00
James Houlahan 39b366ee69 GODT-1650: Password as bytes in API login 2022-11-16 12:26:09 +01:00
James Houlahan 6ac68984f2 GODT-1609: Fix bridge password encoding 2022-11-16 12:26:09 +01:00
Romain LE JEUNE b536b8707e GODT-1609: use byte array for password 2022-11-16 12:26:09 +01:00
James Houlahan e9672e6bba GODT-1815: Combined/Split mode 2022-11-16 12:26:08 +01:00
Michal Horejsek 4d2baa6b85 Renamed bridge to general users and keep bridge only for bridge stuff 2020-05-25 09:02:34 +02:00
Michal Horejsek 1998d92432 Updates() needs to return imapBackend.Update instead of interface with go-imap v1 2020-05-05 11:47:47 +00:00
James Houlahan 1457005f86 fix: address review comments 2020-04-21 13:29:26 +02:00
James Houlahan 3f32fd95e0 feat: refresh expired access tokens in one goroutine 2020-04-21 08:36:39 +00:00
Jakub 80f4e1e346 Fixing unit tests for client manager.
* [x] pmapi: refresh auth uid won't change
* [x] bridge tests:
    * update mocks
    * delete auth when FinishLogin fails
    * check for mailbox password
    * add `gomock.InOrder` for better test control
* [x] fix linter issues except TODOs
* [x] make rootScheme unexported
* [x] store tests: update mocks
2020-04-21 08:36:39 +00:00
James Houlahan 042c340881 feat: make store use ClientManager 2020-04-21 08:36:38 +00:00
James Houlahan f269be4291 refactor: make pmapi.Client the interface 2020-04-21 08:36:38 +00:00
James Houlahan 6e38a65bd8 feat: improve login flow 2020-04-21 08:36:38 +00:00
James Houlahan 941e09079c feat: implement token expiration watcher 2020-04-21 08:36:38 +00:00