mox/go.mod

38 lines
1.2 KiB
Modula-2
Raw Permalink Normal View History

2023-01-30 16:27:06 +03:00
module github.com/mjl-/mox
go 1.21
2023-01-30 16:27:06 +03:00
require (
2024-03-09 17:32:37 +03:00
github.com/mjl-/adns v0.0.0-20240309142737-2a1aacf346dc
2024-03-08 11:28:09 +03:00
github.com/mjl-/autocert v0.0.0-20231214125928-31b7400acb05
github.com/mjl-/bstore v0.0.5
github.com/mjl-/sconf v0.0.6
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-04 15:10:48 +03:00
github.com/mjl-/sherpa v0.6.7
github.com/mjl-/sherpadoc v0.0.14
2023-01-30 16:27:06 +03:00
github.com/mjl-/sherpaprom v0.0.2
github.com/mjl-/sherpats v0.0.6
2024-01-05 13:12:24 +03:00
github.com/prometheus/client_golang v1.18.0
github.com/russross/blackfriday/v2 v2.1.0
2024-03-08 11:28:09 +03:00
go.etcd.io/bbolt v1.3.9
golang.org/x/crypto v0.22.0
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
golang.org/x/net v0.24.0
2023-11-09 23:19:51 +03:00
golang.org/x/text v0.14.0
rsc.io/qr v0.2.0
2023-01-30 16:27:06 +03:00
)
require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect
github.com/mjl-/xfmt v0.0.2 // indirect
2024-01-05 13:12:24 +03:00
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.45.0 // indirect
2024-01-05 13:12:24 +03:00
github.com/prometheus/procfs v0.12.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/tools v0.20.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
2023-01-30 16:27:06 +03:00
)