Help hiding sensitive information in validation responses #4016
Unanswered
Rory-Powell
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there, I'm looking for some advice for removing sensitive inputs from validation error messages for PII reasons.
For example the following response:
Is returned from here:
graphql-js/src/execution/values.ts
Lines 125 to 129 in 8c749e9
If possible I'd like to avoid this behaviour for certain fields in my schema which are sensitive.
So far I have attempted to define my own scalars,
SensitiveString
,SensitivePhoneNumber
etc, throwing a custom error, and in myformatError
error handler (using apollo server) manually parsing and removing the sensitive input values. This is important so that Personally Identifiable Information isn't logged or captured by tracing tools.This worked for logging, however tracing tools (datadogs dd-trace in particular) hooks into the execute error response prior to my error handler being activated, meaning that the sensitive information is still captured in traces.
One important thing to note is that this isn't an issue when values are embedded into queries, as a different validation mechanism is used:
graphql-js/src/validation/rules/ValuesOfCorrectTypeRule.ts
Lines 169 to 177 in 8cfa3de
Here I can simply make sure I throw an instance of
GraphQLError
from my custom scalar and custom error message will be respected and not wrapped.Is there a way to make sure the input values wrapping doesn't take place when variables aren't embedded in the query and the
coerceVariableValues
is used?Beta Was this translation helpful? Give feedback.
All reactions