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
6d485027
Commit
6d485027
authored
Apr 05, 2022
by
Dominic Couture
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add customers-dot URL to CSP not only in dev
Changelog: fixed
parent
75e3e1fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
19 deletions
+3
-19
lib/gitlab/content_security_policy/config_loader.rb
lib/gitlab/content_security_policy/config_loader.rb
+1
-1
spec/lib/gitlab/content_security_policy/config_loader_spec.rb
.../lib/gitlab/content_security_policy/config_loader_spec.rb
+2
-18
No files found.
lib/gitlab/content_security_policy/config_loader.rb
View file @
6d485027
...
...
@@ -37,13 +37,13 @@ module Gitlab
allow_webpack_dev_server
(
directives
)
allow_letter_opener
(
directives
)
allow_snowplow_micro
(
directives
)
if
Gitlab
::
Tracking
.
snowplow_micro_enabled?
allow_customersdot
(
directives
)
if
ENV
[
'CUSTOMER_PORTAL_URL'
].
present?
end
allow_websocket_connections
(
directives
)
allow_cdn
(
directives
,
Settings
.
gitlab
.
cdn_host
)
if
Settings
.
gitlab
.
cdn_host
.
present?
allow_sentry
(
directives
)
if
Gitlab
.
config
.
sentry
&
.
enabled
&&
Gitlab
.
config
.
sentry
&
.
clientside_dsn
allow_framed_gitlab_paths
(
directives
)
allow_customersdot
(
directives
)
if
ENV
[
'CUSTOMER_PORTAL_URL'
].
present?
# The follow section contains workarounds to patch Safari's lack of support for CSP Level 3
# See https://gitlab.com/gitlab-org/gitlab/-/issues/343579
...
...
spec/lib/gitlab/content_security_policy/config_loader_spec.rb
View file @
6d485027
...
...
@@ -107,24 +107,8 @@ RSpec.describe Gitlab::ContentSecurityPolicy::ConfigLoader do
stub_env
(
'CUSTOMER_PORTAL_URL'
,
customer_portal_url
)
end
context
'when in production'
do
before
do
allow
(
Rails
).
to
receive
(
:env
).
and_return
(
ActiveSupport
::
StringInquirer
.
new
(
'production'
))
end
it
'does not add CUSTOMER_PORTAL_URL to CSP'
do
expect
(
directives
[
'frame_src'
]).
to
eq
(
::
Gitlab
::
ContentSecurityPolicy
::
Directives
.
frame_src
+
" http://localhost/admin/ http://localhost/assets/ http://localhost/-/speedscope/index.html http://localhost/-/sandbox/mermaid"
)
end
end
context
'when in development'
do
before
do
allow
(
Rails
).
to
receive
(
:env
).
and_return
(
ActiveSupport
::
StringInquirer
.
new
(
'development'
))
end
it
'adds CUSTOMER_PORTAL_URL to CSP'
do
expect
(
directives
[
'frame_src'
]).
to
eq
(
::
Gitlab
::
ContentSecurityPolicy
::
Directives
.
frame_src
+
" http://localhost/rails/letter_opener/ https://customers.example.com http://localhost/admin/ http://localhost/assets/ http://localhost/-/speedscope/index.html http://localhost/-/sandbox/mermaid"
)
end
it
'adds CUSTOMER_PORTAL_URL to CSP'
do
expect
(
directives
[
'frame_src'
]).
to
eq
(
::
Gitlab
::
ContentSecurityPolicy
::
Directives
.
frame_src
+
" http://localhost/admin/ http://localhost/assets/ http://localhost/-/speedscope/index.html http://localhost/-/sandbox/mermaid
#{
customer_portal_url
}
"
)
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