Skip to content

Instantly share code, notes, and snippets.

@mitsuhiko
Last active July 11, 2018 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitsuhiko/3d7de39caec8c1a841c275d685c5504d to your computer and use it in GitHub Desktop.
Save mitsuhiko/3d7de39caec8c1a841c275d685c5504d to your computer and use it in GitHub Desktop.
{
"ip": "192.168.1.1",
"message": "Hello peter@gmail.com. You signed up with card 1234-1234-1234-1234. Your home folder is C:\\Users\\peter. Look at our compliance from 127.0.0.1",
"extra": {
"foo": 42,
"bar": true
}
}
{
"ip": null,
"message": "Hello *****@*****.***. You signed up with card ****-****-****-1234. Your home folder is C:\\Users\\[username] Look at our compliance from 5A2DF387CD660E9F3E0AB20F9E7805450D56C5DACE9B959FC620C336E2B5D09A",
"extra": {
"foo": null,
"bar": true
},
"metadata": {
"ip": {
"": {
"remarks": [
[["remove_ip", "IP address removed"]]
]
}
},
"message": {
"": {
"remarks": [
[["email_address", "potential email address"], [6, 21]],
[["creditcard_number", "creditcard number"], [48, 67]],
[["path_username", "username in path"], [98, 108]],
[["hash_ip", "IP address hashed"], [137, 201]]
],
"original_length": 142
}
},
"extra": {
"foo": {
"": {
"remarks": [
[["remove_foo"]]
]
}
}
}
}
}
{
"rules": {
"creditcard_numbers": {
"note": "creditcard number",
"pattern": "\\d{4}[- ]?\\d{4,6}[- ]?\\d{4,5}(?:[- ]?\\d{4})",
"type": "pattern",
"replace_with": {
"mask_range": [
6,
-4
],
"mask_with_char": "*",
"chars_to_ignore": "- "
}
},
"password_pairs": {
"note": "password",
"type": "remove_pair_value",
"key_pattern": "password|pw|pword|pwd",
"replace_with": {
"new_value": "[password]"
}
},
"email_address": {
"note": "potential email address",
"pattern": "[a-z0-9!#$%&'*+/=?^_`{|}~.-]+@[a-z0-9-]+(\\.[a-z0-9-]+)*",
"type": "pattern",
"replace_with": {
"mask_with_char": "*",
"chars_to_ignore": "@."
}
},
"path_username": {
"note": "username in path",
"pattern": "(?:\b[a-zA-Z]:)?(?:[/\\\\](users|home)[/\\\\])([^/\\\\]+)",
"replace_with": {
"new_value": "[username]"
},
"type": "pattern",
"replace_groups": [
1
]
},
"ipv4": {
"note": "ip address",
"pattern": "\\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b",
"type": "pattern",
"replace_with": {
"mask_with_char": "*",
"chars_to_ignore": "."
}
}
},
"applications": {
"freeform": [
"path_username",
"creditcard_numbers",
"email_address",
"ipv4"
],
"databag": [
"path_username",
"creditcard_numbers",
"email_address",
"ipv4",
"password_pairs"
]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment