Skip to content

Commit

Permalink
Merge pull request #2 from brentkearney/main
Browse files Browse the repository at this point in the history
Fix: respond_to_missing? should expect more than one argument
  • Loading branch information
ndbroadbent authored Nov 22, 2023
2 parents 174aec5 + 98abc28 commit a6e2101
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions lib/better_content_security_policy/content_security_policy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,21 @@ class ContentSecurityPolicy
default-src
font-src
form-action
frame-ancestors
frame-src
img-src
manifest-src
media-src
navigate-to
object-src
prefetch-src
require-trusted-types-for
script-src
script-src-attr
script-src-elem
style-src
style-src-attr
style-src-elem
trusted-types
worker-src
].freeze

Expand All @@ -31,6 +37,8 @@ class ContentSecurityPolicy
http
https
mediastream
ws
wss
].freeze

QUOTED_SOURCES = %w[
Expand All @@ -39,7 +47,10 @@ class ContentSecurityPolicy
unsafe-eval
unsafe-hashes
unsafe-inline
wasm-unsafe-eval
allow-duplicates
report-sample
script
strict-dynamic
].freeze

attr_accessor :directives, :report_uri, :report_only
Expand All @@ -65,8 +76,8 @@ def method_missing(directive_sym, *args)
@directives[directive]
end

def respond_to_missing?(directive)
valid_directive?(directive)
def respond_to_missing?(directive, *)
valid_directive?(directive) || super
end

# Converts sources from our Ruby DSL (camelcase) into proper Content-Security-Policy sources.
Expand Down

0 comments on commit a6e2101

Please sign in to comment.