feat(hub): email one-time-code sign-in
POST /v1/auth/email/start and /verify with HMAC-protected 8-digit codes (10 min, 5 tries, atomic single use), browser-bound via a __Host- cookie, same-origin checks, per-address/source/global rate limits and an injectable sender. Enabled in /v1/info only when SMTP is configured. Email identities use external_identities(provider='email') and never merge with GitHub.
This commit is contained in:
parent
f1883e5001
commit
cca084b0ae
20 changed files with 1756 additions and 59 deletions
|
|
@ -187,11 +187,23 @@ async fn capabilities_and_routes_do_not_pretend_authentication_is_ready() {
|
|||
}
|
||||
assert_eq!(value["smtp"]["public_send_endpoint"], false);
|
||||
assert!(value.get("secret_key").is_none());
|
||||
for path in [
|
||||
"/v1/auth/email/start",
|
||||
"/v1/servers/register",
|
||||
"/v1/mail/send",
|
||||
] {
|
||||
// Email sign-in exists but stays closed until SMTP is configured; there is still no
|
||||
// route that sends arbitrary mail.
|
||||
for path in ["/v1/auth/email/start", "/v1/auth/email/verify"] {
|
||||
let response = app
|
||||
.clone()
|
||||
.oneshot(
|
||||
Request::builder()
|
||||
.method("POST")
|
||||
.uri(path)
|
||||
.body(Body::empty())
|
||||
.unwrap(),
|
||||
)
|
||||
.await
|
||||
.unwrap();
|
||||
assert_eq!(response.status(), StatusCode::SERVICE_UNAVAILABLE);
|
||||
}
|
||||
for path in ["/v1/servers/register", "/v1/mail/send"] {
|
||||
let response = app
|
||||
.clone()
|
||||
.oneshot(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue