排除来自modsecurity日志的敏感数据

我正在设置Modsecurity,而且我注意到一些敏感数据(信用卡号)最终在日志中。 我应该如何防止呢? 最好是我希望它被logging,但与敏感的数据损坏。

access.log中敏感行的示例

id_offer=28&ch_name=%27+or+1%3D1&ch_address1=Korvstolsv%E4gen+2&ch_address2=&ch_zip=756+48&ch_city=STOCKHOLM&ch_email=aslask%40test.net&ch_phone=018-9999999&cardno=1234456712342345&cvc=123&expire_month=--&expire_year=--&send=Avbryt 

也许它可能是这样的呢? (滚动到右侧,敏感字段是cardno和cvs)

 id_offer=28&ch_name=%27+or+1%3D1&ch_address1=Korvstolsv%E4gen+2&ch_address2=&ch_zip=756+48&ch_city=STOCKHOLM&ch_email=aslask%40test.net&ch_phone=018-9999999&cardno=manglemanglemangle&cvc=xxx&expire_month=--&expire_year=--&send=Avbryt 

如果包含敏感数据,则可以select完全删除该部分。

由于我应该使用POST而不是GET的评论,这是一个POST。

 --36b1f462-A-- [30/May/2017:19:06:55 +0200] WS2mrwpABwsAACy1A9wAAAAG 185.624.636.40 61597 610.64.66.8 445 --36b1f462-B-- POST /wb/e/check.php HTTP/1.1 Host: example.com User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:53.0) Gecko/20100101 Firefox/53.0 Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8 Accept-Language: sv-SE,sv;q=0.8,en-US;q=0.5,en;q=0.3 Accept-Encoding: gzip, deflate, br Content-Type: application/x-www-form-urlencoded Content-Length: 216 Referer: https://example.com/wb/e/auth.php Connection: keep-alive Upgrade-Insecure-Requests: 1 --36b1f462-C-- id_offer=28&ch_name=%27+or+1%3D1&ch_address1=Korvstolsv%E4gen+2&ch_address2=&ch_zip=756+48&ch_city=STOCKHOLM&ch_email=aslask%40test.net&ch_phone=018-9999999&cardno=1234456712342345&cvc=123&expire_month=--&expire_year=--&send=Avbryt 

请仔细阅读以下内容: https : //www.feistyduck.com/library/modsecurity-handbook-free/online/ch04-logging.html “从审核日志中删除敏感数据”。

你的情况应该是:

 SecRule ARGS "@verifyCC \d{13,16}" "phase:5,nolog,pass,\ sanitiseMatched"