Skip to content

Commit 7921de2

Browse files
Copilotfletchto99
andcommitted
Remove deprecated plugin-types directive
Co-authored-by: fletchto99 <[email protected]>
1 parent 1714721 commit 7921de2

File tree

4,667 files changed

+2
-874389
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

4,667 files changed

+2
-874389
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@ coverage
1111
pkg
1212
rdoc
1313
spec/reports
14+
vendor/bundle

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@ SecureHeaders::Configuration.default do |config|
7272
media_src: %w(utoob.com),
7373
object_src: %w('self'),
7474
sandbox: true, # true and [] will set a maximally restrictive setting
75-
plugin_types: %w(application/x-shockwave-flash),
7675
script_src: %w('self'),
7776
script_src_elem: %w('self'),
7877
script_src_attr: %w('self'),

lib/secure_headers/headers/policy_management.rb

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,13 @@ def self.included(base)
5858
CHILD_SRC = :child_src
5959
FORM_ACTION = :form_action
6060
FRAME_ANCESTORS = :frame_ancestors
61-
PLUGIN_TYPES = :plugin_types
6261

6362
DIRECTIVES_2_0 = [
6463
DIRECTIVES_1_0,
6564
BASE_URI,
6665
CHILD_SRC,
6766
FORM_ACTION,
68-
FRAME_ANCESTORS,
69-
PLUGIN_TYPES
67+
FRAME_ANCESTORS
7068
].flatten.freeze
7169

7270
# All the directives currently under consideration for CSP level 3.
@@ -128,7 +126,6 @@ def self.included(base)
128126
MEDIA_SRC => :source_list,
129127
NAVIGATE_TO => :source_list,
130128
OBJECT_SRC => :source_list,
131-
PLUGIN_TYPES => :media_type_list,
132129
REQUIRE_SRI_FOR => :require_sri_for_list,
133130
REQUIRE_TRUSTED_TYPES_FOR => :require_trusted_types_for_list,
134131
REPORT_URI => :source_list,
@@ -281,7 +278,6 @@ def merge_policy_additions(original, additions)
281278
def list_directive?(directive)
282279
source_list?(directive) ||
283280
sandbox_list?(directive) ||
284-
media_type_list?(directive) ||
285281
require_sri_for_list?(directive) ||
286282
require_trusted_types_for_list?(directive)
287283
end
@@ -313,10 +309,6 @@ def sandbox_list?(directive)
313309
DIRECTIVE_VALUE_TYPES[directive] == :sandbox_list
314310
end
315311

316-
def media_type_list?(directive)
317-
DIRECTIVE_VALUE_TYPES[directive] == :media_type_list
318-
end
319-
320312
def require_sri_for_list?(directive)
321313
DIRECTIVE_VALUE_TYPES[directive] == :require_sri_for_list
322314
end
@@ -338,8 +330,6 @@ def validate_directive!(directive, value)
338330
end
339331
when :sandbox_list
340332
validate_sandbox_expression!(directive, value)
341-
when :media_type_list
342-
validate_media_type_expression!(directive, value)
343333
when :require_sri_for_list
344334
validate_require_sri_source_expression!(directive, value)
345335
when :require_trusted_types_for_list
@@ -364,20 +354,6 @@ def validate_sandbox_expression!(directive, sandbox_token_expression)
364354
end
365355
end
366356

367-
# Private: validates that a media type expression:
368-
# 1. is an array of strings
369-
# 2. each element is of the form type/subtype
370-
def validate_media_type_expression!(directive, media_type_expression)
371-
ensure_array_of_strings!(directive, media_type_expression)
372-
valid = media_type_expression.compact.all? do |v|
373-
# All media types are of the form: <type from RFC 2045> "/" <subtype from RFC 2045>.
374-
v =~ /\A.+\/.+\z/
375-
end
376-
if !valid
377-
raise ContentSecurityPolicyConfigError.new("#{directive} must be an array of valid media types (ex. application/pdf)")
378-
end
379-
end
380-
381357
# Private: validates that a require sri for expression:
382358
# 1. is an array of strings
383359
# 2. is a subset of ["string", "style"]

spec/lib/secure_headers/headers/policy_management_spec.rb

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ module SecureHeaders
4141
media_src: %w(utoob.com),
4242
navigate_to: %w(netscape.com),
4343
object_src: %w('self'),
44-
plugin_types: %w(application/x-shockwave-flash),
4544
prefetch_src: %w(fetch.com),
4645
require_sri_for: %w(script style),
4746
require_trusted_types_for: %w('script'),
@@ -146,18 +145,6 @@ module SecureHeaders
146145
end.to_not raise_error
147146
end
148147

149-
it "rejects anything not of the form type/subtype as a plugin-type value" do
150-
expect do
151-
ContentSecurityPolicy.validate_config!(ContentSecurityPolicyConfig.new(default_opts.merge(plugin_types: ["steve"])))
152-
end.to raise_error(ContentSecurityPolicyConfigError)
153-
end
154-
155-
it "accepts anything of the form type/subtype as a plugin-type value " do
156-
expect do
157-
ContentSecurityPolicy.validate_config!(ContentSecurityPolicyConfig.new(default_opts.merge(plugin_types: ["application/pdf"])))
158-
end.to_not raise_error
159-
end
160-
161148
it "doesn't allow report_only to be set in a non-report-only config" do
162149
expect do
163150
ContentSecurityPolicy.validate_config!(ContentSecurityPolicyConfig.new(default_opts.merge(report_only: true)))

vendor/bundle/ruby/3.2.0/bin/_guard-core

Lines changed: 0 additions & 29 deletions
This file was deleted.

vendor/bundle/ruby/3.2.0/bin/coderay

Lines changed: 0 additions & 29 deletions
This file was deleted.

vendor/bundle/ruby/3.2.0/bin/coveralls

Lines changed: 0 additions & 29 deletions
This file was deleted.

vendor/bundle/ruby/3.2.0/bin/guard

Lines changed: 0 additions & 29 deletions
This file was deleted.

vendor/bundle/ruby/3.2.0/bin/htmldiff

Lines changed: 0 additions & 29 deletions
This file was deleted.

vendor/bundle/ruby/3.2.0/bin/ldiff

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)