-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add anonymizer feature #27
base: master
Are you sure you want to change the base?
Conversation
6fa3604
to
26da8ec
Compare
I'm not sure it's possible (or the goal), but it would be awesome to run this command in a production env, and instead of executing thoose queries it will create an anonymized dump of the DB in a target folder. no ? Besides that, i find that to be a nice way to handle anonymisation through annotation, it feel simple to export and apply to another project. |
not the purpose here but your thought kind of already exists here : |
26da8ec
to
373df0c
Compare
Tests/Entity/AnonymizedPropertiesAndTruncateAnonymizedEntityAction.php
Outdated
Show resolved
Hide resolved
} elseif ($anonymizedProperty->isComposed()) { | ||
$composedFieldParts = $anonymizedProperty->explodeComposedFieldValue(); | ||
|
||
return sprintf('%s = concat(concat("%s", %s), "%s")', $anonymizedProperty->getColumnName(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes for example I'm pretty sure the concat expression varies by platform.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 seems ok at least for mysql & posgresql. WDYT?
7131a13
to
a1cdb88
Compare
a1cdb88
to
12699cf
Compare
Hi there,
here is a first implementation to answer to this #5 feature request.
Concept is:
provides 2 annotation (at entity & property levels):
AnonymizedEntity
&AnonymizedProperty
AnonymizedEntity
has 2 possible actions (anonymize & truncate) and a where sql clause to be able to keep some data as they are (admin account or something like that)AnonymizedProperty
has 3 types (static, composed, expression) and a value field:=> static : a static value that will be applied on all raw of the table
=> composed : a composed value based on another field of the entity which allow you to update all lines into a format like:
email="test+<id>@test.com
where id is the identifier of the table which allow to answer to unique index issue (at sql level)=> expression : a valid sql expression like
CONCAT(FLOOR(1 + (RAND() * 1000)), id)
to answer to unique constraints issue (at validator level)This MR mainly contains a command that :
Would love some feedback before going further and writing test/doc ;)