mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Do not allow IP address in HSTS list
As per [rfc6797](https://tools.ietf.org/html/rfc6797#section-8.1.1), do not allow IPv4 or IPv6 addresses as host entries into the HSTS list. servo/servo#6105
This commit is contained in:
parent
d2f35555b9
commit
72d4433587
2 changed files with 33 additions and 5 deletions
|
@ -19,6 +19,28 @@ fn test_exit() {
|
|||
resource_task.send(ControlMsg::Exit).unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_push_entry_to_hsts_list_should_not_add_ipv6_addresses() {
|
||||
let mut list = HSTSList {
|
||||
entries: Vec::new()
|
||||
};
|
||||
|
||||
list.push("2001:0db8:0000:0000:0000:ff00:0042:8329".to_string(), false);
|
||||
|
||||
assert!(list.entries.len() == 0)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_push_entry_to_hsts_list_should_not_add_ipv4_addresses() {
|
||||
let mut list = HSTSList {
|
||||
entries: Vec::new()
|
||||
};
|
||||
|
||||
list.push("8.8.8.8".to_string(), false);
|
||||
|
||||
assert!(list.entries.len() == 0)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_push_entry_to_hsts_list_should_not_add_subdomains_whose_superdomain_is_already_matched() {
|
||||
let mut list = HSTSList {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue