This page shows where a visitor's answer to a secret question can surface
in a host's own logs and telemetry, and how to filter it with the filter
your transport already has. It uses patron registration: on the
library_card screen the patron chooses a library PIN, a secret_question
with the key library_pin.
It assumes the package's fields are in your schema, as in Add Journeys to the schema you already have.
What the package does and does not see
A secret question's response crosses GraphQL once, as part of the
responses argument of submitJourney, and reaches your host's submit/2
as the client sent it; your host seals it, as riddler's guide Seal and unseal a secret
answer shows. The
package logs no argument and no variable, emits no telemetry of its own, and
never puts the value in a response or an error: a presented secret question
carries held, never a value. A draft sent to the journey query has
the response under the key of each secret question on the presented screen
dropped before your draft function sees it.
What the package cannot reach is the request around it. The client sends the PIN inside the request your transport receives, and your transport, and Absinthe, see it before the package does.
Send responses as a variable
Have clients send responses (and a draft) as GraphQL variables, never
written inline in the document:
mutation Submit($journey: ID!, $screen: String!, $outcome: String!, $responses: RiddlerJSON!) {
submitJourney(journey: $journey, screen: $screen, outcome: $outcome, responses: $responses) {
answer { __typename }
findings { code elementKey }
}
}with the variables:
{
"journey": "J-4001",
"screen": "library_card",
"outcome": "card_chosen",
"responses": {"card_name": "A. Reader", "library_pin": "0000"}
}A value written inline is part of the document's text, the query string,
and a filter that works by key cannot remove it from there.
Filter the variables your transport logs
A filter works by name, so it matches the variable names your clients use.
With Phoenix, add those names to :filter_parameters:
config :phoenix, :filter_parameters, ["password", "responses", "draft"]Phoenix replaces the value of any parameter whose key contains one of those
terms with "[FILTERED]", at any depth of the parameters it logs, so a JSON
request's variables is logged with responses and draft filtered. The
match is on the key, and is case sensitive. A transport other than Phoenix
has its own filter; give it the same names.
Filter Absinthe's own telemetry
Absinthe 1.12 emits telemetry events that carry the operation's variables, a secret response included:
[:absinthe, :execute, :operation, :start]and[:absinthe, :execute, :operation, :stop], whose metadata carriesoptionsandblueprint;[:absinthe, :resolve, :field, :start]and[:absinthe, :resolve, :field, :stop], whose metadata carriesresolution, with the field's arguments.
A handler you attach to these events, or a tracing library that exports
their metadata, sees the PIN. Attach none that writes that metadata out
whole: read only the fields a handler needs, such as the operation name and
the duration, and drop options, blueprint and resolution before
anything leaves the process. This describes Absinthe 1.12; check the events
of the Absinthe version your host runs.
Check it
Submit a screen with a secret answer in a development build and search your log output and any exported traces for the value you sent. It should appear nowhere: not in the request line, not in the logged parameters, not in a span.