-
Notifications
You must be signed in to change notification settings - Fork 55
/
requirement.xml
186 lines (181 loc) · 6.39 KB
/
requirement.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?xml version="1.0" encoding="UTF-8"?>
<anonymizer xmlns="https://armenak.github.io/DataDefender/anonymizer">
<anonymizer-version>2.0</anonymizer-version>
<project>Sample Project</project>
<project-version>1.0</project-version>
<!--
Types defined below as return types, column types or function argument
types will be looked up under autoresolve classes in the order they
appear here. Having java.lang defined here, means later on you can
refer to a type as "String" rather than its full name, similar to how an
import works in a java file, but always by package.
Classes not found here will continue looking in the classpath, so a
class file under extensions (for example EmployeeNumber) will still be
loaded even if not found in a package defined here (see plan with id
employee-number under column-plans below).
-->
<autoresolve-classes>
<package name="java.lang"/>
<package name="org.apache.commons.lang3"/>
<package name="com.strider.datadefender.anonymizer.functions"/>
</autoresolve-classes>
<!--
Reusable plans that can be applied to any number of table columns under
the <tables> section below.
-->
<column-plans>
<plan id="lipsum-similar">
<function name="Lipsum#similar">
<argument name="text" type="String" pass-current-value="true"/>
</function>
</plan>
<plan id="employee-number">
<function name="EmployeeNumber#randomNumber" />
</plan>
<plan id="address" combiner="String::concat" combiner-glue=" ">
<function combiner-glue=" " name="RandomUtils#nextInt">
<argument type="int" value="11"/>
<argument type="int" value="5599"/>
</function>
<function name="Address#randomStreet"/>
<function combiner-glue=", " name="Address#randomCity"/>
<function name="Address#randomProvinceStateCode"/>
<function name="Address#randomCanadianOrUsFiveOrNineDigitPostalCode"/>
<function name="Address#randomCountry"/>
</plan>
<plan id="example-array">
<function name="Class#acceptsArray">
<argument type="int">
<element value="1"/>
<element value="2"/>
<element pass-current-value="true"/>
</argument>
</function>
</plan>
</column-plans>
<!--
Specify tables/columns to anonymize. Note that a table can be specified
more than once, each with different parameters (for instance one or more
could have a <where></where> clause or different exclusions, etc...
-->
<tables>
<table name="employees" primary-key="id">
<columns>
<column name="first_name" skip-empty="false">
<plan>
<function name="Bio#randomFirstName" />
</plan>
</column>
<column name="middle_name">
<plan>
<function name="Bio#randomFirstName" />
</plan>
</column>
<column name="preferred_name">
<plan>
<function name="Bio#randomFirstName" />
</plan>
</column>
<column name="last_name">
<plan>
<function name="Bio#randomLastName" />
</plan>
</column>
<column name="gender">
<plan>
<function name="Core#randomStringFromPattern">
<argument name="pattern" value="M|F|Z|N|O"/>
</function>
</plan>
</column>
<column name="birth_date">
<plan>
<function name="Core#randomDate">
<argument name="start" type="String" value="1970-01-01"/>
<argument name="end" type="String" value="2005-01-01"/>
<argument name="format" type="String" value="yyyy-MM-dd"/>
</function>
</plan>
</column>
<column name="employee_number">
<plan-ref ref-id="employee-number"/>
</column>
<column name="address">
<plan-ref ref-id="address"/>
</column>
<column name="email">
<!-- excludes only this column if it's value matches -->
<exclusions>
<exclude equals="zbateson@example.com"/>
</exclusions>
<plan>
<function name="Bio#randomEmail">
<argument name="domainName" value="unreal.mydomain.com"/>
</function>
</plan>
</column>
<column name="hr-notes">
<plan-ref ref-id="lipsum-similar"/>
</column>
</columns>
</table>
<table name="users" primary-key="id">
<!-- excludes the entire row if an 'exclude' matches. For the row
with a username equal to zbateson, neither username nor password
will be changed -->
<exclusions>
<exclude name="username" in="zbateson,armenak"/>
<exclude name="email" equals="another@example.com"/>
</exclusions>
<columns>
<column name="username">
<plan>
<function name="Bio#randomUser" />
</plan>
</column>
<column name="password">
<plan>
<function name="String#valueOf">
<argument value="ae2b1fca515949e5d54fb22b8ed95575"/>
</function>
</plan>
</column>
</columns>
</table>
<table name="forms-fields">
<!-- updates happen using the specified primary key(s) in the generated where clause of the update query -->
<primary-key>
<key>formname</key>
<key>fieldname</key>
</primary-key>
<where>fieldname = 'email-recipients' OR fieldname = 'email-cc-recipients'</where>
<columns>
<column name="fieldvalue">
<plan>
<function name="Bio#randomEmail">
<argument name="domainName" value="unreal.ubc.ca"/>
</function>
</plan>
</column>
</columns>
</table>
<table name="forms-fields">
<primary-key>
<key>formname</key>
<key>fieldname</key>
</primary-key>
<where>fieldname = 'comments'</where>
<!-- you can still have exclusions separately from the where clause -->
<exclusions>
<exclude name="formname" equals="specialform"/>
<exclude name="formname" in="otherspecialform,thirdspecialform"/>
<exclude name="formname" in="fourth|fifth" in-separator="|" />
</exclusions>
<columns>
<column name="fieldvalue">
<plan-ref ref-id="lipsum-similar"/>
</column>
</columns>
</table>
</tables>
</anonymizer>