Skip to content

Export useful sanitizing functions: printWithReducedWhitespace, hideStringAndNumericLiterals and hideLiterals#2057

Merged
trevor-scheer merged 2 commits intoapollographql:masterfrom
mcohen75:export-sanitizing-transforms
Nov 2, 2021
Merged

Export useful sanitizing functions: printWithReducedWhitespace, hideStringAndNumericLiterals and hideLiterals#2057
trevor-scheer merged 2 commits intoapollographql:masterfrom
mcohen75:export-sanitizing-transforms

Conversation

@mcohen75
Copy link
Copy Markdown
Contributor

@mcohen75 mcohen75 commented Jul 29, 2020

GraphQL execution requests can include PII. At Indeed we have need of a mechanism to sanitize requests of PII in order to maintain GDPR and CCPA requirements. I'm certain many other companies have this need, and expect this to also be useful for companies requiring HIPPA compliance.

The existing hideStringAndNumericLiterals and hideLiterals functions look to be well suited for this purpose. Here I've exported these functions, along with printWithReducedWhitespace which is a nice companion to both. I've updated the existing test for hideLiterals to cover more scenarios and added a test for hideStringAndNumericLiterals.

  • Update CHANGELOG.md* with your change (include reference to issue & this PR)
  • Make sure all of the significant new logic is covered by tests
  • Rebase your changes on master so that they can be merged easily
  • Make sure all tests and linter rules pass

@mcohen75
Copy link
Copy Markdown
Contributor Author

It looks like there is a test that prevents me from updating the CHANGELOG:

 FAIL  packages/apollo/src/__tests__/git.test.ts
  ● Git integration › Returns commit, branch, message, committer, and remoteUrl

    expect(received).toMatch(expected)

    Expected pattern: /(https?:\/\/|git@)github.com(\/|:)apollographql\/apollo-tooling(.git)?/
    Received string:  "git@github.com:mcohen75/apollo-tooling.git"

      11 |     expect(info.remoteUrl).toBeDefined();
      12 |     // Match both ssh and http/s remotes
    > 13 |     expect(info.remoteUrl).toMatch(
         |                            ^
      14 |       /(https?:\/\/|git@)github.com(\/|:)apollographql\/apollo-tooling(.git)?/
      15 |     );
      16 |     expect(info.message).toBeDefined();

      at Object.it (src/__tests__/git.test.ts:13:28)

It seems to only allow the remote to be the apollographql project.

@trevor-scheer trevor-scheer force-pushed the export-sanitizing-transforms branch from 569cf73 to ca6c8a6 Compare November 2, 2021 22:57
@trevor-scheer trevor-scheer self-assigned this Nov 2, 2021
@trevor-scheer
Copy link
Copy Markdown
Contributor

Thanks @mcohen75, and sorry this took so long to get around to. I hope you don't mind, but I rebased your PR to get it all caught up and added a CHANGELOG entry. Thanks for expanding on the test cases! This is good to go 👍

@trevor-scheer trevor-scheer merged commit 3476149 into apollographql:master Nov 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants