Skip to content

Implement a replacement filter to cleanup private data in stored responses #8

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

Merged
merged 1 commit into from
Nov 21, 2020

Conversation

micoli
Copy link
Contributor

@micoli micoli commented Nov 11, 2020

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #X, partially #Y, mentioned in #Z
Documentation if this is a new feature, link to pull request in https://github.com/php-http/documentation that adds relevant documentation
License MIT

What's in this PR?

Add a filter by regular expression in filesystemRecorder responses

Why?

to not store private data in commited responses

Example Usage

        $original = new Response(200, ['X-Foo' => 'Bar', 'X-Bar' => 'private-token-065a1bb33f000032ab'], 'The content');

        $recorder = new FilesystemRecorder($this->workspace, $this->filesystem, [
            '!private-token-[0-9a-z]+!' => 'private-token-xxxx',
            '!The content!' => 'The big content'
        ]);

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix
  • Documentation pull request created (if not simply a bugfix)

To Do

  • If the PR is not complete but you want to discuss the approach, list what remains to be done here

@GaryPEGEOT
Copy link
Collaborator

Hi @micoli ! Interesting feature, you might want to do a PR to https://github.com/php-http/HttplugBundle to provide integration for Symfony. Can you rebase master ?

@micoli
Copy link
Contributor Author

micoli commented Nov 21, 2020

I've just rebased on master. I'll have a look at https://github.com/php-http/HttplugBundle also? thanks for the tip

Copy link
Collaborator

@GaryPEGEOT GaryPEGEOT left a comment

Choose a reason for hiding this comment

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

Some minor fixes needed. Can you also rebase master again ? 😃

@micoli micoli force-pushed the request_filters branch 2 times, most recently from 5ec58fe to e9afac3 Compare November 21, 2020 13:53
Copy link
Collaborator

@GaryPEGEOT GaryPEGEOT left a comment

Choose a reason for hiding this comment

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

All good, thanks @micoli !

@GaryPEGEOT GaryPEGEOT merged commit 3eeb6e8 into php-http:master Nov 21, 2020
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