Forum Discussion
gerald_wegener_
Nimbostratus
Oct 03, 2006Question about the posted SocialSecurity Scrubber
For the iRule you have posted for finding/scrubbing social security numbers is it necessary to calculate $ssn_len since it seems that based on the regexp the length would always be 11?
In the exerpt below would it be OK to eliminate the line:
-> set ssn_len [expr {[lindex $ssn_idx 1] - $ssn_start + 1}]
and replace $ssn_len with 11 in the payload replace line:
-> HTTP::payload replace $ssn_start 11 "xxx-xx-xxxx"
Are there cases where the $ssn_len would not be 11?
Thank You.
Exerpt from SSN scrubber:
when HTTP_RESPONSE_DATA {
Find the SSN numbers
set ssn_indices [regexp -all -inline -indices {\d{3}-\d{2}-\d{4}} [HTTP::payload]]
Scrub the SSN's from the response
foreach ssn_idx $ssn_indices {
set ssn_start [lindex $ssn_idx 0]
set ssn_len [expr {[lindex $ssn_idx 1] - $ssn_start + 1}]
HTTP::payload replace $ssn_start $ssn_len "xxx-xx-xxxx"
- That code was lifted from the Credit Card Scrubber rule which has variable lengths. I don't see any problem in hard coding the length to 11 as that is the length of the regular expression string that is being matched.
- gerald_wegener_
Nimbostratus
Hi,
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects