Skip to content

Instantly share code, notes, and snippets.

@maartenvanvliet
Created November 9, 2019 08:41
Show Gist options
  • Save maartenvanvliet/0becb2ee3b71fc1504f139c58407a4f1 to your computer and use it in GitHub Desktop.
Save maartenvanvliet/0becb2ee3b71fc1504f139c58407a4f1 to your computer and use it in GitHub Desktop.
block introspection by
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