[edge] Share fixes: per-network password limit and no eviction, revocation epoch never goes down, stray share tokens stripped on every host, admin socket bound in a private directory
This commit is contained in:
@@ -309,6 +309,25 @@ mod unix {
|
||||
let t2 = link("closed.test", 7, "/", now() + 3600, None);
|
||||
let r = e.get("closed.test", &format!("/?share={t2}"), None).await;
|
||||
assert_eq!(r.status, 302);
|
||||
// ...and is not passed on to the auth server or the upstream either.
|
||||
let r = e
|
||||
.get(
|
||||
"closed.test",
|
||||
&format!("/x?b=2&share={t2}"),
|
||||
Some("authelia_session=good"),
|
||||
)
|
||||
.await;
|
||||
assert_eq!(r.status, 200);
|
||||
let body: serde_json::Value = serde_json::from_slice(&r.body).unwrap();
|
||||
assert_eq!(body["query"], "b=2");
|
||||
for req in e.auth.requests() {
|
||||
for (_, v) in &req.headers {
|
||||
assert!(
|
||||
!String::from_utf8_lossy(v).contains("ish1."),
|
||||
"token sent to the auth server"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[tokio::test(flavor = "multi_thread")]
|
||||
@@ -460,7 +479,11 @@ mod unix {
|
||||
.await;
|
||||
assert_eq!(r.status, 422, "{}", r.text);
|
||||
assert!(r.text.contains("epoch"), "{}", r.text);
|
||||
assert_eq!(e.get(HOST, "/", Some(&keep_cookie)).await.status, 302, "still stopped");
|
||||
assert_eq!(
|
||||
e.get(HOST, "/", Some(&keep_cookie)).await.status,
|
||||
302,
|
||||
"still stopped"
|
||||
);
|
||||
assert_eq!(e.get(HOST, "/", Some(&fresh_cookie)).await.status, 200);
|
||||
|
||||
// Without the admin call, edge notices a changed file within 5 s.
|
||||
|
||||
@@ -32,7 +32,10 @@ fn junk_ids_from_the_same_network_cannot_flush_a_link_counter() {
|
||||
for n in 0u32..10_000 {
|
||||
t.failed(junk(n), Some(ip));
|
||||
}
|
||||
assert!(!t.allowed(victim, Some(ip)), "10,000 junk failures reset the victim's counter");
|
||||
assert!(
|
||||
!t.allowed(victim, Some(ip)),
|
||||
"10,000 junk failures reset the victim's counter"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -66,7 +69,13 @@ fn a_full_table_refuses_new_visitors_instead_of_forgetting_old_ones() {
|
||||
let other = IpAddr::from([10, (n >> 16) as u8, (n >> 8) as u8, n as u8]);
|
||||
t.failed(junk(n), Some(other));
|
||||
}
|
||||
assert!(!t.allowed(victim, Some(ip)), "the victim's counter survived");
|
||||
assert!(
|
||||
!t.allowed(victim, Some(ip)),
|
||||
"the victim's counter survived"
|
||||
);
|
||||
let newcomer = IpAddr::from([203, 0, 113, 5]);
|
||||
assert!(!t.allowed(ShareId([3; 16]), Some(newcomer)), "full table: refuse, don't forget");
|
||||
assert!(
|
||||
!t.allowed(ShareId([3; 16]), Some(newcomer)),
|
||||
"full table: refuse, don't forget"
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user