Skip to content

Commit

Permalink
Restrict graphql content types (#458)
Browse files Browse the repository at this point in the history
* include subdomains in hsts rule

* handle web and graphql content-types separately

* revert hsts include subdomains
  • Loading branch information
matkev authored Dec 8, 2023
1 parent a4fe43c commit 6a4173a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
7 changes: 7 additions & 0 deletions lib/elixir_boilerplate_graphql/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ defmodule ElixirBoilerplateGraphQL.Router do
@moduledoc false
use Plug.Router

plug(
Plug.Parsers,
parsers: [:json],
pass: [],
json_decoder: Phoenix.json_library()
)

plug(:match)
plug(:dispatch)

Expand Down
7 changes: 0 additions & 7 deletions lib/elixir_boilerplate_web/endpoint.ex
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,6 @@ defmodule ElixirBoilerplateWeb.Endpoint do
plug(Plug.RequestId)
plug(Plug.Telemetry, event_prefix: [:phoenix, :endpoint])

plug(
Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
)

plug(Sentry.PlugContext,
body_scrubber: {ElixirBoilerplate.Errors.Sentry, :scrub_params},
remote_address_reader: {ElixirBoilerplate.Errors.Sentry, :scrubbed_remote_address}
Expand Down
7 changes: 7 additions & 0 deletions lib/elixir_boilerplate_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ defmodule ElixirBoilerplateWeb.Router do
import Phoenix.LiveView.Router

pipeline :browser do
plug(
Plug.Parsers,
parsers: [:urlencoded, :multipart, :json],
pass: ["*/*"],
json_decoder: Phoenix.json_library()
)

plug(:accepts, ["html", "json"])

plug(:session)
Expand Down

0 comments on commit 6a4173a

Please sign in to comment.