Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
75046c3f
Commit
75046c3f
authored
Dec 06, 2021
by
Rajendra Kadam
Committed by
Alper Akgun
Dec 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add onetrust.com to one_trust_csp
parent
18fc6343
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
2 deletions
+19
-2
app/controllers/concerns/one_trust_csp.rb
app/controllers/concerns/one_trust_csp.rb
+2
-2
spec/features/users/one_trust_csp_spec.rb
spec/features/users/one_trust_csp_spec.rb
+17
-0
No files found.
app/controllers/concerns/one_trust_csp.rb
View file @
75046c3f
...
@@ -8,11 +8,11 @@ module OneTrustCSP
...
@@ -8,11 +8,11 @@ module OneTrustCSP
next
unless
helpers
.
one_trust_enabled?
||
policy
.
directives
.
present?
next
unless
helpers
.
one_trust_enabled?
||
policy
.
directives
.
present?
default_script_src
=
policy
.
directives
[
'script-src'
]
||
policy
.
directives
[
'default-src'
]
default_script_src
=
policy
.
directives
[
'script-src'
]
||
policy
.
directives
[
'default-src'
]
script_src_values
=
Array
.
wrap
(
default_script_src
)
|
[
"'unsafe-eval'"
,
'https://cdn.cookielaw.org
https://*.onetrust.com'
]
script_src_values
=
Array
.
wrap
(
default_script_src
)
|
[
"'unsafe-eval'"
,
'https://cdn.cookielaw.org
'
,
'
https://*.onetrust.com'
]
policy
.
script_src
(
*
script_src_values
)
policy
.
script_src
(
*
script_src_values
)
default_connect_src
=
policy
.
directives
[
'connect-src'
]
||
policy
.
directives
[
'default-src'
]
default_connect_src
=
policy
.
directives
[
'connect-src'
]
||
policy
.
directives
[
'default-src'
]
connect_src_values
=
Array
.
wrap
(
default_connect_src
)
|
[
'https://cdn.cookielaw.org'
]
connect_src_values
=
Array
.
wrap
(
default_connect_src
)
|
[
'https://cdn.cookielaw.org'
,
'https://*.onetrust.com'
]
policy
.
connect_src
(
*
connect_src_values
)
policy
.
connect_src
(
*
connect_src_values
)
end
end
end
end
...
...
spec/features/users/one_trust_csp_spec.rb
0 → 100644
View file @
75046c3f
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
'OneTrust content security policy'
do
let
(
:user
)
{
create
(
:user
)
}
before
do
stub_config
(
extra:
{
one_trust_id:
SecureRandom
.
uuid
})
end
it
'has proper Content Security Policy headers'
do
visit
root_path
expect
(
response_headers
[
'Content-Security-Policy'
]).
to
include
(
'https://cdn.cookielaw.org https://*.onetrust.com'
)
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment