Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable literal scrubbed user query logging #26

Merged
merged 1 commit into from
Aug 18, 2023
Merged

Conversation

zinic
Copy link
Contributor

@zinic zinic commented Aug 14, 2023

Description

This changeset improves the openCypher front end by adding an emitter type that can contain output configuration information. This type is used to add a switch in the format functions for stripping literals when outputting openCypher from the query model.

Stripped literals are replaced with a parameter named $STRIPPED. This allows the query to remain syntactically correct while removing any sensitive information contained in the literal values.

Property names and other syntax elements are currently not considered sensitive.

Output Example

{"level":"info","query":"match p = ()-[:HasSession]->(n)-[]->() where n.pii = $STRIPPED return p","time":"2023-08-14T09:38:22.575719651-07:00","message":"Executing user cypher query"}

Other Changes

  • Refactor the emitter type to output to the io.Writer type for flexibility.
  • Refactor GraphQuery to output user queries into the application structured log.

Motivation and Context

It's very hard to trace what queries may be problematic from the BH application log. In order to enable log output for user queries we need to first scrub any literal data in it.

How Has This Been Tested?

Added unit tests to cover the new path.

Types of changes

  • Chore (a change that does not modify the application functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • Documentation updates are needed, and have been made accordingly.
  • I have added and/or updated tests to cover my changes.
  • All new and existing tests passed.
  • My changes include a database migration.

Copy link
Contributor

@superlinkx superlinkx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After a proper code review session, this all checks out. Excited to have this diagnostic tool in our bag.

@zinic zinic merged commit c3f2338 into main Aug 18, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants