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
8d40556a
Commit
8d40556a
authored
Oct 27, 2021
by
dcouture
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace whitelist with allowlist in specs
parent
29399b2e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
9 deletions
+10
-9
spec/features/ide/clientside_preview_csp_spec.rb
spec/features/ide/clientside_preview_csp_spec.rb
+2
-2
spec/features/ide/static_object_external_storage_csp_spec.rb
spec/features/ide/static_object_external_storage_csp_spec.rb
+2
-2
spec/features/projects/sourcegraph_csp_spec.rb
spec/features/projects/sourcegraph_csp_spec.rb
+3
-2
spec/support/shared_examples/csp.rb
spec/support/shared_examples/csp.rb
+3
-3
No files found.
spec/features/ide/clientside_preview_csp_spec.rb
View file @
8d40556a
...
...
@@ -12,7 +12,7 @@ RSpec.describe 'IDE Clientside Preview CSP' do
end
it_behaves_like
'setting CSP'
,
'frame-src'
do
let
(
:
white
listed_url
)
{
'https://sandbox.gitlab-static.test'
}
let
(
:
allow
listed_url
)
{
'https://sandbox.gitlab-static.test'
}
let
(
:extended_controller_class
)
{
IdeController
}
subject
do
...
...
@@ -23,7 +23,7 @@ RSpec.describe 'IDE Clientside Preview CSP' do
before
do
stub_application_setting
(
web_ide_clientside_preview_enabled:
true
)
stub_application_setting
(
web_ide_clientside_preview_bundler_url:
white
listed_url
)
stub_application_setting
(
web_ide_clientside_preview_bundler_url:
allow
listed_url
)
sign_in
(
user
)
end
...
...
spec/features/ide/static_object_external_storage_csp_spec.rb
View file @
8d40556a
...
...
@@ -12,7 +12,7 @@ RSpec.describe 'Static Object External Storage Content Security Policy' do
end
it_behaves_like
'setting CSP'
,
'connect-src'
do
let_it_be
(
:
white
listed_url
)
{
'https://static-objects.test'
}
let_it_be
(
:
allow
listed_url
)
{
'https://static-objects.test'
}
let_it_be
(
:extended_controller_class
)
{
IdeController
}
subject
do
...
...
@@ -22,7 +22,7 @@ RSpec.describe 'Static Object External Storage Content Security Policy' do
end
before
do
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:static_objects_external_storage_url
).
and_return
(
white
listed_url
)
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:static_objects_external_storage_url
).
and_return
(
allow
listed_url
)
allow_any_instance_of
(
ApplicationSetting
).
to
receive
(
:static_objects_external_storage_auth_token
).
and_return
(
'letmein'
)
sign_in
(
user
)
...
...
spec/features/projects/sourcegraph_csp_spec.rb
View file @
8d40556a
...
...
@@ -13,7 +13,8 @@ RSpec.describe 'Sourcegraph Content Security Policy' do
end
it_behaves_like
'setting CSP'
,
'connect-src'
do
let_it_be
(
:whitelisted_url
)
{
'https://sourcegraph.test'
}
let_it_be
(
:sourcegraph_url
)
{
'https://sourcegraph.test'
}
let_it_be
(
:allowlisted_url
)
{
"
#{
sourcegraph_url
}
/.api/"
}
let_it_be
(
:extended_controller_class
)
{
Projects
::
BlobController
}
subject
do
...
...
@@ -23,7 +24,7 @@ RSpec.describe 'Sourcegraph Content Security Policy' do
end
before
do
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:sourcegraph_url
).
and_return
(
whitelisted
_url
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:sourcegraph_url
).
and_return
(
sourcegraph
_url
)
allow
(
Gitlab
::
CurrentSettings
).
to
receive
(
:sourcegraph_enabled
).
and_return
(
true
)
sign_in
(
user
)
...
...
spec/support/shared_examples/csp.rb
View file @
8d40556a
...
...
@@ -28,7 +28,7 @@ RSpec.shared_examples 'setting CSP' do |rule_name|
context
'when feature is enabled'
do
it
"appends to
#{
rule_name
}
"
do
is_expected
.
to
eql
(
"
#{
rule_name
}
#{
default_csp_values
}
#{
white
listed_url
}
"
)
is_expected
.
to
eql
(
"
#{
rule_name
}
#{
default_csp_values
}
#{
allow
listed_url
}
"
)
end
end
...
...
@@ -46,7 +46,7 @@ RSpec.shared_examples 'setting CSP' do |rule_name|
context
'when feature is enabled'
do
it
"uses default-src values in
#{
rule_name
}
"
do
is_expected
.
to
eql
(
"default-src
#{
default_csp_values
}
;
#{
rule_name
}
#{
default_csp_values
}
#{
white
listed_url
}
"
)
is_expected
.
to
eql
(
"default-src
#{
default_csp_values
}
;
#{
rule_name
}
#{
default_csp_values
}
#{
allow
listed_url
}
"
)
end
end
...
...
@@ -64,7 +64,7 @@ RSpec.shared_examples 'setting CSP' do |rule_name|
context
'when feature is enabled'
do
it
"uses default-src values in
#{
rule_name
}
"
do
is_expected
.
to
eql
(
"font-src
#{
default_csp_values
}
;
#{
rule_name
}
#{
white
listed_url
}
"
)
is_expected
.
to
eql
(
"font-src
#{
default_csp_values
}
;
#{
rule_name
}
#{
allow
listed_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