summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-05-23 18:49:44 +0000
committerTimothy Andrew <mail@timothyandrew.net>2017-05-31 03:51:08 +0000
commitac6ec8ac96b584f168ce095383bf6c1f545927a4 (patch)
treeabba552e21e411437059a2534613844c169cb4a1
parent200e8582f8fc0c7949f052673b25e1aff1490f7e (diff)
downloadgitlab-ce-ac6ec8ac96b584f168ce095383bf6c1f545927a4.tar.gz
Merge branch 'dz-api-x-frame' into 'security-9-2'
Restrict API X-Frame-Options to same origin See merge request !2103
-rw-r--r--changelogs/unreleased/dz-api-x-frame.yml4
-rw-r--r--lib/api/api.rb1
2 files changed, 5 insertions, 0 deletions
diff --git a/changelogs/unreleased/dz-api-x-frame.yml b/changelogs/unreleased/dz-api-x-frame.yml
new file mode 100644
index 00000000000..0483a9e076a
--- /dev/null
+++ b/changelogs/unreleased/dz-api-x-frame.yml
@@ -0,0 +1,4 @@
+---
+title: Restrict API X-Frame-Options to same origin
+merge_request:
+author:
diff --git a/lib/api/api.rb b/lib/api/api.rb
index 1bf20f76ad6..6b78443cbcb 100644
--- a/lib/api/api.rb
+++ b/lib/api/api.rb
@@ -44,6 +44,7 @@ module API
end
before { allow_access_with_scope :api }
+ before { header['X-Frame-Options'] = 'SAMEORIGIN' }
rescue_from Gitlab::Access::AccessDeniedError do
rack_response({ 'message' => '403 Forbidden' }.to_json, 403)