Add a new @sensitive directive to prevent marked fields from logging
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 3.5k
- Forks
- 468
- Avg merge
- 3h 9m
- Merged PRs (30d)
- 2
Description
What problem does this feature proposal attempt to solve?
Right now, sensitve information like tokens, password, bank account data etc. is logged with the incoming request when using LogGraphQLQueries class.
Which possible solutions should be considered?
A new directive like @sensitive on argument/field level should mark fields as such and then prevents them from being logged as plain text.
directive @sensitive(
"An optional reason why the field is marked as sensitive"
reason: String
) on ARGUMENT_DEFINITION
type Mutation {
login(
email: String! @sensitive(reason: "should not be logged")
password: String! @sensitive(reason: "it's a password")
): LoginResponse
}
The logging class should then check if the request variables contain @sensitive directive and if reason is good enough, they should not appear in log files ;)
Some default fields might be added anyway, just in case. E.g.: password password_confirmation So no matter if the directive is defined at any field, those passwords will and should never appear in log files.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the LogGraphQLQueries class and the proposed @sensitive directive examples to understand how request variables enter logs. Clarify the directive's scope, reason handling, and default sensitive fields first; done should mean sensitive values no longer appear as plain text in the relevant log output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, php
- Domain
- api, security
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100