File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -151,10 +151,6 @@ module SecureHeaders
151151 expect ( csp . value ) . to eq ( "default-src 'self'; require-trusted-types-for script" )
152152 end
153153
154- it "does not support style for require-trusted-types-for directive" do
155- expect { ContentSecurityPolicy . new ( { require_trusted_types_for : %(script style) } ) } . to raise_error ( ContentSecurityPolicyConfigError )
156- end
157-
158154 it "includes prefetch-src" do
159155 csp = ContentSecurityPolicy . new ( default_src : %w( 'self' ) , prefetch_src : %w( foo.com ) )
160156 expect ( csp . value ) . to eq ( "default-src 'self'; prefetch-src foo.com" )
Original file line number Diff line number Diff line change @@ -122,6 +122,12 @@ module SecureHeaders
122122 end . to raise_error ( ContentSecurityPolicyConfigError )
123123 end
124124
125+ it "rejects style for trusted types" do
126+ expect do
127+ ContentSecurityPolicy . validate_config! ( ContentSecurityPolicyConfig . new ( default_opts . merge ( style_src : %w( 'self' ) , require_trusted_types_for : %w( script style ) , trusted_types : %w( abcpolicy ) ) ) )
128+ end
129+ end
130+
125131 # this is mostly to ensure people don't use the antiquated shorthands common in other configs
126132 it "performs light validation on source lists" do
127133 expect do
You can’t perform that action at this time.
0 commit comments