feat(auth): explicit transport modes
ACAUA_TRANSPORT (local, tls, proxy) is now required; a missing or invalid value stops the daemon. local refuses a non-loopback ACAUA_PUBLISHED, tls serves HTTPS via axum-server/rustls, proxy needs ACAUA_TRUSTED_PROXIES. HSTS is sent in tls and proxy modes. The image defaults to local. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
5ad89d5be5
commit
dc8c7fa248
8 files changed
+430
-19
No files matched your search
@@ -339,6 +339,33 @@ async fn html_request_redirects_to_login_api_gets_401() {
|
||||
assert_eq!(r.status, StatusCode::UNAUTHORIZED);
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn hsts_header_only_in_tls_and_proxy() {
|
||||
for (transport, hsts) in [
|
||||
(Transport::Local, false),
|
||||
(
|
||||
Transport::Tls {
|
||||
cert: "c".into(),
|
||||
key: "k".into(),
|
||||
},
|
||||
true,
|
||||
),
|
||||
(
|
||||
Transport::Proxy {
|
||||
trusted: vec!["10.0.0.0/8".parse().unwrap()],
|
||||
},
|
||||
true,
|
||||
),
|
||||
] {
|
||||
let (_d, _a, app) = fresh(transport);
|
||||
let r = send(&app, empty(Method::GET, "/api/health")).await;
|
||||
assert_eq!(
|
||||
r.headers.contains_key(header::STRICT_TRANSPORT_SECURITY),
|
||||
hsts
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn cookie_flags() {
|
||||
for (transport, secure) in [
|
||||
|
||||
Reference in new issue
Block a user