mox/testdata
Mechiel Lukkien 0f8bf2f220
replace http basic auth for web interfaces with session cookie & csrf-based auth
the http basic auth we had was very simple to reason about, and to implement.
but it has a major downside:

there is no way to logout, browsers keep sending credentials. ideally, browsers
themselves would show a button to stop sending credentials.

a related downside: the http auth mechanism doesn't indicate for which server
paths the credentials are.

another downside: the original password is sent to the server with each
request. though sending original passwords to web servers seems to be
considered normal.

our new approach uses session cookies, along with csrf values when we can. the
sessions are server-side managed, automatically extended on each use. this
makes it easy to invalidate sessions and keeps the frontend simpler (than with
long- vs short-term sessions and refreshing). the cookies are httponly,
samesite=strict, scoped to the path of the web interface. cookies are set
"secure" when set over https. the cookie is set by a successful call to Login.
a call to Logout invalidates a session. changing a password invalidates all
sessions for a user, but keeps the session with which the password was changed
alive. the csrf value is also random, and associated with the session cookie.
the csrf must be sent as header for api calls, or as parameter for direct form
posts (where we cannot set a custom header). rest-like calls made directly by
the browser, e.g. for images, don't have a csrf protection. the csrf value is
returned by the Login api call and stored in localstorage.

api calls without credentials return code "user:noAuth", and with bad
credentials return "user:badAuth". the api client recognizes this and triggers
a login. after a login, all auth-failed api calls are automatically retried.
only for "user:badAuth" is an error message displayed in the login form (e.g.
session expired).

in an ideal world, browsers would take care of most session management. a
server would indicate authentication is needed (like http basic auth), and the
browsers uses trusted ui to request credentials for the server & path. the
browser could use safer mechanism than sending original passwords to the
server, such as scram, along with a standard way to create sessions.  for now,
web developers have to do authentication themselves: from showing the login
prompt, ensuring the right session/csrf cookies/localstorage/headers/etc are
sent with each request.

webauthn is a newer way to do authentication, perhaps we'll implement it in the
future. though hardware tokens aren't an attractive option for many users, and
it may be overkill as long as we still do old-fashioned authentication in smtp
& imap where passwords can be sent to the server.

for issue #58
2024-01-05 10:48:42 +01:00
..
ctl add basic tests for the ctl subcommands, and fix two small bugs 2023-07-02 14:18:50 +02:00
dmarc-reports mox! 2023-01-30 14:27:06 +01:00
dmarcdb implement outgoing dmarc aggregate reporting 2023-11-02 09:12:30 +01:00
dsn deprecate having only localparts in an Account's Destinations, it should always be a full email address 2023-03-09 22:13:56 +01:00
httpaccount add webmail 2023-08-07 21:57:03 +02:00
imap add per-account quota for total message size disk usage 2023-12-20 20:54:12 +01:00
imapserverfuzz for fuzzing the imapserver and smtpserver use different config files than regular tests 2023-05-22 15:37:03 +02:00
imaptest deprecate having only localparts in an Account's Destinations, it should always be a full email address 2023-03-09 22:13:56 +01:00
importtest.maildir add funtionality to import zip/tgz with maildirs/mboxes to account page 2023-02-16 09:57:27 +01:00
integration when suggesting CAA records for a domain, suggest variants that bind to the account id and with validation methods used by mox 2023-12-21 15:53:32 +01:00
junk mox! 2023-01-30 14:27:06 +01:00
message add pedantic mode (used by localserve) that refuses some behaviour that is invalid according to specifications and that we normally accept for compatibility 2023-03-12 15:16:01 +01:00
queue new feature: when delivering messages from the queue, make it possible to use a "transport" 2023-06-16 18:57:05 +02:00
smtp add suppression list for outgoing dmarc and tls reports 2023-11-13 13:48:52 +01:00
smtpservercatchall simplify .gitignore, just on line for ignoring all the testdata/*/data directories 2023-11-09 19:47:33 +01:00
smtpserverfuzz for fuzzing the imapserver and smtpserver use different config files than regular tests 2023-05-22 15:37:03 +02:00
smtpserverquota add per-account quota for total message size disk usage 2023-12-20 20:54:12 +01:00
smtpserversendlimit simplify .gitignore, just on line for ignoring all the testdata/*/data directories 2023-11-09 19:47:33 +01:00
smtpsmuggle add faq for smtp smuggling, fix bug around handling "\nX\n" for any X, reject bare carriage returns and possibly smtp-smuggling attempts 2024-01-01 20:11:16 +01:00
store deprecate having only localparts in an Account's Destinations, it should always be a full email address 2023-03-09 22:13:56 +01:00
tlsreports work around missing timezone in timestamps in tls reports from microsoft 2023-02-05 10:55:34 +01:00
tlsrptsend implement outgoing tls reports 2023-11-09 19:47:26 +01:00
web deprecate having only localparts in an Account's Destinations, it should always be a full email address 2023-03-09 22:13:56 +01:00
webadmin replace http basic auth for web interfaces with session cookie & csrf-based auth 2024-01-05 10:48:42 +01:00
webmail add webmail 2023-08-07 21:57:03 +02:00
webserver implement transparent gzip compression in the webserver 2023-08-21 21:52:35 +02:00
websocket add reverse proxying websocket connections 2023-05-30 22:11:31 +02:00
importtest.maildir.tgz implement storing non-system/well-known flags (keywords) for messages and mailboxes, with imap 2023-06-24 00:24:43 +02:00
importtest.mbox add funtionality to import zip/tgz with maildirs/mboxes to account page 2023-02-16 09:57:27 +01:00
importtest.mbox.zip implement storing non-system/well-known flags (keywords) for messages and mailboxes, with imap 2023-06-24 00:24:43 +02:00