merge: branch 'izzy/patch/easypwned'

fix: configure new authifier properties
This commit is contained in:
izzy
2025-05-10 16:31:37 +01:00
parent 6daa8223b2
commit 3a7ebad883
7 changed files with 38 additions and 26 deletions

32
Cargo.lock generated
View File

@@ -443,9 +443,9 @@ dependencies = [
[[package]]
name = "authifier"
version = "1.0.10"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "edfe88c4a9fcf24b18a216b27c9766966af2a40603d24c7782237afd6ca0d5cd"
checksum = "ca26cb6b5ab776a1de5a8122fe6cc77fadd84fed30704c496f2aca451637877b"
dependencies = [
"async-std",
"async-trait",
@@ -454,7 +454,7 @@ dependencies = [
"chrono",
"futures",
"handlebars",
"iso8601-timestamp 0.1.11",
"iso8601-timestamp",
"lazy_static",
"lettre",
"log",
@@ -470,6 +470,7 @@ dependencies = [
"schemars",
"serde",
"serde_json",
"sha1",
"totp-lite",
"ulid 0.5.0",
"validator 0.15.0",
@@ -3647,17 +3648,6 @@ dependencies = [
"waker-fn",
]
[[package]]
name = "iso8601-timestamp"
version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b088f3296223f11d6bd70998132653b30b6f39e6ab4be055c0bda486fa8d11c7"
dependencies = [
"generic-array 0.14.7",
"serde",
"time",
]
[[package]]
name = "iso8601-timestamp"
version = "0.2.17"
@@ -6095,7 +6085,7 @@ dependencies = [
"futures",
"indexmap 1.9.3",
"isahc",
"iso8601-timestamp 0.2.17",
"iso8601-timestamp",
"linkify 0.8.1",
"log",
"lru 0.11.1",
@@ -6140,7 +6130,7 @@ dependencies = [
"env_logger",
"futures",
"impl_ops",
"iso8601-timestamp 0.2.17",
"iso8601-timestamp",
"lettre",
"linkify 0.6.0",
"log",
@@ -6229,7 +6219,7 @@ name = "revolt-models"
version = "0.8.4"
dependencies = [
"indexmap 1.9.3",
"iso8601-timestamp 0.2.17",
"iso8601-timestamp",
"num_enum 0.6.1",
"once_cell",
"regex",
@@ -6299,7 +6289,7 @@ dependencies = [
"base64 0.22.1",
"fcm_v1",
"isahc",
"iso8601-timestamp 0.2.17",
"iso8601-timestamp",
"log",
"pretty_env_logger",
"revolt-config",
@@ -6517,12 +6507,12 @@ dependencies = [
[[package]]
name = "rocket_authifier"
version = "1.0.10"
version = "1.0.13"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2aa1bfaee106d088b78de7c3cc2a8ab2c9e05a0286b6b912f0b18ea656b329e"
checksum = "0490f4a6f0a359a9ffff9acbdf4eddf49890ec94941b8ddd88163c16f6159f5a"
dependencies = [
"authifier",
"iso8601-timestamp 0.1.11",
"iso8601-timestamp",
"revolt_okapi",
"revolt_rocket_okapi",
"rocket",

View File

@@ -36,7 +36,7 @@ async-std = { version = "1.8.0", features = [
] }
# core
authifier = { version = "1.0.10" }
authifier = { version = "1.0.13" }
revolt-result = { path = "../core/result" }
revolt-models = { path = "../core/models" }
revolt-config = { path = "../core/config" }

View File

@@ -54,6 +54,8 @@ authifier_shield_key = ""
voso_legacy_token = ""
# Whether services are behind the Cloudflare network
trust_cloudflare = false
# easypwned endpoint
easypwned = ""
[api.security.captcha]
# hCaptcha configuration

View File

@@ -168,6 +168,7 @@ pub struct ApiSecurity {
pub voso_legacy_token: String,
pub captcha: ApiSecurityCaptcha,
pub trust_cloudflare: bool,
pub easypwned: String,
}
#[derive(Deserialize, Debug, Clone)]

View File

@@ -97,7 +97,7 @@ web-push = "0.10.0"
revolt_a2 = { version = "0.10", default-features = false, features = ["ring"] }
# Authifier
authifier = { version = "1.0.10", features = ["rocket_impl"] }
authifier = { version = "1.0.13", features = ["rocket_impl"] }
# RabbitMQ
amqprs = { version = "1.7.0" }

View File

@@ -102,6 +102,9 @@ impl Database {
let config = config().await;
let mut auth_config = authifier::Config {
password_scanning: authifier::config::PasswordScanning::EasyPwned {
endpoint: config.api.security.easypwned,
},
email_verification: if !config.api.smtp.host.is_empty() {
EmailVerificationConfig::Enabled {
smtp: SMTPSettings {
@@ -118,6 +121,7 @@ impl Database {
),
port: config.api.smtp.port,
use_tls: config.api.smtp.use_tls,
use_starttls: None,
},
expiry: Default::default(),
templates: if config.production {
@@ -134,6 +138,13 @@ impl Database {
url: format!("{}/login/reset/", config.hosts.app),
html: Some(include_str!("../../templates/reset.html").into()),
},
reset_existing: Template {
title: "You already have a Revolt account, reset your password."
.into(),
text: include_str!("../../templates/reset.txt").into(),
url: format!("{}/login/reset/", config.hosts.app),
html: Some(include_str!("../../templates/reset.html").into()),
},
deletion: Template {
title: "Confirm account deletion.".into(),
text: include_str!("../../templates/deletion.txt").into(),
@@ -156,9 +167,16 @@ impl Database {
url: format!("{}/login/reset/", config.hosts.app),
html: None,
},
reset_existing: Template {
title: "Reset your password.".into(),
text: include_str!("../../templates/reset.whitelabel.txt").into(),
url: format!("{}/login/reset/", config.hosts.app),
html: None,
},
deletion: Template {
title: "Confirm account deletion.".into(),
text: include_str!("../../templates/deletion.whitelabel.txt").into(),
text: include_str!("../../templates/deletion.whitelabel.txt")
.into(),
url: format!("{}/delete/", config.hosts.app),
html: None,
},

View File

@@ -52,10 +52,11 @@ async-std = { version = "1.8.0", features = [
lettre = "0.10.0-alpha.4"
# web
rocket = { version = "0.5.1", default-features = false, features = ["json"] }
rocket_cors = { git = "https://github.com/lawliet89/rocket_cors", rev = "072d90359b23e9b291df6b672c07c93de9c46011" }
rocket_empty = { version = "0.1.1", features = ["schema"] }
rocket_authifier = { version = "1.0.10" }
rocket_authifier = { version = "1.0.13" }
rocket_prometheus = "0.10.0-rc.3"
# spec generation
@@ -66,7 +67,7 @@ revolt_rocket_okapi = { version = "0.10.0", features = ["swagger"] }
amqprs = { version = "1.7.0" }
# core
authifier = "1.0.10"
authifier = "1.0.13"
revolt-config = { path = "../core/config" }
revolt-database = { path = "../core/database", features = [
"rocket-impl",