Created
November 9, 2019 08:41
-
-
Save maartenvanvliet/0becb2ee3b71fc1504f139c58407a4f1 to your computer and use it in GitHub Desktop.
block introspection by
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule GraphqlService.Schema.IntrospectBlocker do | |
# by https://github.com/sb8244 | |
@behaviour Absinthe.Middleware | |
def call(resolution, _config) do | |
case Absinthe.Resolution.path(resolution) |> IO.inspect do | |
["__schema" | _] -> | |
%{resolution | errors: ["__schema introspection is disabled"] } | |
["__type" | _] -> | |
%{resolution | errors: ["__type introspection is disabled"] } | |
_ -> | |
resolution | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment