From 8554824a143f4f4538f3b27b33337bf804132675 Mon Sep 17 00:00:00 2001 From: Paolo Barbolini Date: Tue, 8 Nov 2022 15:27:39 +0100 Subject: [PATCH] Add Permissions-Policy header --- benches/header_map/basic.rs | 1 + src/header/mod.rs | 1 + src/header/name.rs | 8 ++++++++ tests/header_map.rs | 1 + tests/header_map_fuzz.rs | 1 + 5 files changed, 12 insertions(+) diff --git a/benches/header_map/basic.rs b/benches/header_map/basic.rs index 078b89fb..c528e95d 100644 --- a/benches/header_map/basic.rs +++ b/benches/header_map/basic.rs @@ -565,6 +565,7 @@ const STD: &'static [HeaderName] = &[ LOCATION, MAX_FORWARDS, ORIGIN, + PERMISSIONS_POLICY, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, diff --git a/src/header/mod.rs b/src/header/mod.rs index 6c1b4955..919115b9 100644 --- a/src/header/mod.rs +++ b/src/header/mod.rs @@ -130,6 +130,7 @@ pub use self::name::{ LOCATION, MAX_FORWARDS, ORIGIN, + PERMISSIONS_POLICY, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, diff --git a/src/header/name.rs b/src/header/name.rs index f0eaeb77..16474588 100644 --- a/src/header/name.rs +++ b/src/header/name.rs @@ -714,6 +714,14 @@ standard_headers! { /// whole path. (Origin, ORIGIN, b"origin"); + /// Allows selectively enabling and disabling use of various browser features + /// and APIs. + /// + /// Permissions Policy is a web platform API which gives a website the + /// ability to allow or block the use of browser features in it's own + /// frame or in iframes that it embeds. + (PermissionsPolicy, PERMISSIONS_POLICY, b"permissions-policy"); + /// HTTP/1.0 header usually used for backwards compatibility. /// /// The Pragma HTTP/1.0 general header is an implementation-specific header diff --git a/tests/header_map.rs b/tests/header_map.rs index d02a5106..6fddc252 100644 --- a/tests/header_map.rs +++ b/tests/header_map.rs @@ -375,6 +375,7 @@ const STD: &'static [HeaderName] = &[ LOCATION, MAX_FORWARDS, ORIGIN, + PERMISSIONS_POLICY, PRAGMA, PROXY_AUTHENTICATE, PROXY_AUTHORIZATION, diff --git a/tests/header_map_fuzz.rs b/tests/header_map_fuzz.rs index fbcd8d2d..6019f953 100644 --- a/tests/header_map_fuzz.rs +++ b/tests/header_map_fuzz.rs @@ -310,6 +310,7 @@ fn gen_header_name(g: &mut StdRng) -> HeaderName { header::LOCATION, header::MAX_FORWARDS, header::ORIGIN, + header::PERMISSIONS_POLICY, header::PRAGMA, header::PROXY_AUTHENTICATE, header::PROXY_AUTHORIZATION,