summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlessio Caiazza <acaiazza@gitlab.com>2019-09-11 00:42:46 +0000
committerMayra Cabrera <mcabrera@gitlab.com>2019-09-11 00:42:46 +0000
commitce201834270cb9a0b045f159acec1b51279942c4 (patch)
treeda9d380fae4626db23f824401356a71903df1fd1
parentd20ce7de3e9174fba2b35673bcc23085136523b3 (diff)
downloadgitlab-ce-ce201834270cb9a0b045f159acec1b51279942c4.tar.gz
Fix CSP failure patching graphiql view
Backporting https://github.com/rmosolgo/graphiql-rails/pull/71
-rw-r--r--Gemfile4
-rw-r--r--Gemfile.lock4
-rw-r--r--app/views/graphiql/rails/editors/show.html.erb18
3 files changed, 23 insertions, 3 deletions
diff --git a/Gemfile b/Gemfile
index ac848cce5e8..3ead3cb5f36 100644
--- a/Gemfile
+++ b/Gemfile
@@ -84,7 +84,9 @@ gem 'rack-cors', '~> 1.0.0', require: 'rack/cors'
# GraphQL API
gem 'graphql', '~> 1.9.11'
-gem 'graphiql-rails', '~> 1.4.10'
+# TODO: remove app/views/graphiql/rails/editors/show.html.erb when https://github.com/rmosolgo/graphiql-rails/pull/71 will be released
+# https://gitlab.com/gitlab-org/gitlab-ce/issues/67263
+gem 'graphiql-rails', '~> 1.7.0'
gem 'apollo_upload_server', '~> 2.0.0.beta3'
gem 'graphql-docs', '~> 1.6.0', group: [:development, :test]
diff --git a/Gemfile.lock b/Gemfile.lock
index 48053e5740e..301b54f9a9f 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -398,7 +398,7 @@ GEM
rake (~> 12)
grape_logging (1.7.0)
grape
- graphiql-rails (1.4.10)
+ graphiql-rails (1.7.0)
railties
sprockets-rails
graphql (1.9.11)
@@ -1142,7 +1142,7 @@ DEPENDENCIES
grape-entity (~> 0.7.1)
grape-path-helpers (~> 1.1)
grape_logging (~> 1.7)
- graphiql-rails (~> 1.4.10)
+ graphiql-rails (~> 1.7.0)
graphql (~> 1.9.11)
graphql-docs (~> 1.6.0)
grpc (~> 1.19.0)
diff --git a/app/views/graphiql/rails/editors/show.html.erb b/app/views/graphiql/rails/editors/show.html.erb
new file mode 100644
index 00000000000..abb1ed0e772
--- /dev/null
+++ b/app/views/graphiql/rails/editors/show.html.erb
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title><%= GraphiQL::Rails.config.title || 'GraphiQL' %></title>
+
+ <%= stylesheet_link_tag("graphiql/rails/application") %>
+ <%= javascript_include_tag("graphiql/rails/application", nonce: true) %>
+ </head>
+ <body>
+ <%= content_tag :div, 'Loading...', id: 'graphiql-container', data: {
+ graphql_endpoint_path: graphql_endpoint_path,
+ initial_query: GraphiQL::Rails.config.initial_query,
+ logo: GraphiQL::Rails.config.logo,
+ headers: GraphiQL::Rails.config.resolve_headers(self),
+ query_params: GraphiQL::Rails.config.query_params
+ } %>
+ </body>
+</html>