Skip to content

Commit 21b2f46

Browse files
authored
fix test syntax
1 parent e78ae24 commit 21b2f46

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

lib/secure_headers/headers/content_security_policy.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,14 @@ def value
5353
def build_value
5454
directives.map do |directive_name|
5555
case DIRECTIVE_VALUE_TYPES[directive_name]
56-
when :source_list, :require_sri_for_list # require_sri is a simple set of strings that don't need to deal with symbol casing
56+
when :source_list, :require_sri_for_list, :require_trusted_types_for_list # require_sri is a simple set of strings that don't need to deal with symbol casing
5757
build_source_list_directive(directive_name)
5858
when :boolean
5959
symbol_to_hyphen_case(directive_name) if @config.directive_value(directive_name)
6060
when :sandbox_list
6161
build_sandbox_list_directive(directive_name)
6262
when :media_type_list
6363
build_media_type_list_directive(directive_name)
64-
when :require_trusted_types_for_list
65-
build_trusted_type_list_directive(directive_name)
6664
end
6765
end.compact.join("; ")
6866
end

lib/secure_headers/headers/policy_management.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def validate_require_sri_source_expression!(directive, require_sri_for_expressio
398398
def validate_require_trusted_types_for_source_expression!(directive, require_trusted_types_for_expression)
399399
ensure_array_of_strings!(directive, require_trusted_types_for_expression)
400400
unless require_trusted_types_for_expression.to_set.subset?(REQUIRE_TRUSTED_TYPES_FOR_VALUES)
401-
raise ContentSecurityPolicyConfigError.new(%(require-sri for must be a subset of #{REQUIRE_TRUSTED_TYPES_FOR_VALUES.to_a} but was #{require_trusted_types_for_expression}))
401+
raise ContentSecurityPolicyConfigError.new(%(require-trusted-types-for for must be a subset of #{REQUIRE_TRUSTED_TYPES_FOR_VALUES.to_a} but was #{require_trusted_types_for_expression}))
402402
end
403403
end
404404

spec/lib/secure_headers/headers/content_security_policy_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ module SecureHeaders
147147
end
148148

149149
it "supports require-trusted-types-for directive" do
150-
csp = ContentSecurityPolicy.new(default_src: %w('self'), require_trusted_types_for: %(script))
150+
csp = ContentSecurityPolicy.new(default_src: %w('self'), require_trusted_types_for: %w(script))
151151
expect(csp.value).to eq("default-src 'self'; require-trusted-types-for script")
152152
end
153153

0 commit comments

Comments
 (0)