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
53047ee0
Commit
53047ee0
authored
Dec 05, 2019
by
Ryan Cobb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add spec for tracing csp
parent
83ce81d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
ee/spec/features/projects/tracings_spec.rb
ee/spec/features/projects/tracings_spec.rb
+48
-0
No files found.
ee/spec/features/projects/tracings_spec.rb
0 → 100644
View file @
53047ee0
# frozen_string_literal: true
require
'spec_helper'
describe
'Tracings Content Security Policy'
do
set
(
:user
)
{
create
(
:user
)
}
let
(
:project
)
{
create
(
:project
)
}
subject
{
response_headers
[
'Content-Security-Policy'
]
}
before
do
project
.
add_maintainer
(
user
)
sign_in
(
user
)
end
context
'when there is no global config'
do
before
do
expect_next_instance_of
(
Projects
::
TracingsController
)
do
|
controller
|
expect
(
controller
).
to
receive
(
:current_content_security_policy
)
.
and_return
(
ActionDispatch
::
ContentSecurityPolicy
.
new
)
end
end
it
'does not add CSP directives'
do
visit
project_tracing_path
(
project
)
is_expected
.
to
be_blank
end
end
context
'when a global CSP config exists'
do
before
do
csp
=
ActionDispatch
::
ContentSecurityPolicy
.
new
do
|
p
|
p
.
frame_src
:self
,
'https://should-get-overwritten.com'
end
expect_next_instance_of
(
Projects
::
TracingsController
)
do
|
controller
|
expect
(
controller
).
to
receive
(
:current_content_security_policy
).
and_return
(
csp
)
end
end
it
'overwrites frame-src'
do
visit
project_tracing_path
(
project
)
is_expected
.
to
eq
(
"frame-src *"
)
end
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