Skip to content

Commit

Permalink
there is no reason to deep dup config values since we can assume the …
Browse files Browse the repository at this point in the history
…configs we are modifying are dups of the originals
  • Loading branch information
oreoshake committed Mar 16, 2016
1 parent 3555996 commit c965ad8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions lib/secure_headers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def override_content_security_policy_directives(request, additions)
config.csp = config.dynamic_csp = {}
end

csp = Configuration.deep_copy(config.current_csp)
config.dynamic_csp = csp.merge(additions)
config.dynamic_csp = config.current_csp.merge(additions)
override_secure_headers_request_config(request, config)
end

Expand All @@ -65,8 +64,7 @@ def override_content_security_policy_directives(request, additions)
# script_src: %w(another-host.com)
def append_content_security_policy_directives(request, additions)
config = config_for(request)
csp = Configuration.deep_copy(config.current_csp)
config.dynamic_csp = CSP.combine_policies(csp, additions)
config.dynamic_csp = CSP.combine_policies(config.current_csp, additions)
override_secure_headers_request_config(request, config)
end

Expand Down

0 comments on commit c965ad8

Please sign in to comment.