Skip to content

Data leaks and response signatures Since v0.1 ​

Data leak prevention reads the answers of the application and hides or refuses sensitive data: card numbers, US Social Security numbers, IBANs, Aadhaar and UK National Insurance numbers, and patterns and word lists of your own. It can look for the same data in request bodies. Response signatures refuse answers that leak SQL errors, stack traces, directory listings or web shell output.

Before you begin ​

  • Role: operator for the application.
  • Answers are read only for the content types and up to the size in Response bodies. A longer answer is checked in its first part. A value to mask there refuses the answer, because the unread rest would pass unmasked. Raise Body inspected for such pages or skip them.
  • Use test numbers when you try detectors, never real customer data.

Turn on data leak prevention ​

Add the module with the defaults. Card numbers, US SSNs and IBANs are masked. Aadhaar and UK National Insurance numbers are logged. Start in detect: the trace of each answer shows what would be masked and the events name the detector, the count and a masked sample.

text
1. Open Applications > All applications > the application > Response checks > Data leaks.
2. On the Detectors and settings tab, set Protection mode to detect.
3. Select Preview changes, then Apply.
sh
waap dlp set -app shop -m "data leaks" mode=detect
yaml
# applications[].policy.dlp
dlp:
  mode: detect

Try it before you rely on it ​

The Test a text tab scans a sample as an answer body. It shows the text as it would be sent, with each rule's count and masked first match.

sh
waap dlp test -app shop -f sample.json

Choose what each detector does ​

Per detector: off, log, mask or block. block_at refuses an answer that holds that many matches (a bulk leak) whatever the action, and masks fewer. Keep the last 4 digits set to false hides card numbers completely.

text
1. On the Detectors and settings tab, choose the action and the refuse-from count per detector.
2. Select Preview changes, then Apply.
sh
waap dlp set -app shop -m "detectors" detectors.card.action=mask detectors.card.block_at=50 detectors.aadhaar.action=mask
yaml
dlp:
  detectors:
    card: {action: mask, block_at: 50, keep_last4: true}
    aadhaar: {action: mask}

Add your own patterns and words ​

Patterns are RE2 expressions. Dictionaries are lists of whole words. Each has an action and min_count: fewer matches are ignored. On the Dictionaries tab, Words from a text file adds the words of a file (one per line, # comments skipped) to a new or existing dictionary.

text
1. Open the Patterns tab or the Dictionaries tab and add an entry.
2. Select Preview changes, then Apply.
sh
waap dlp list set -app shop -list patterns -f patterns.yaml -m "employee ids"
waap dlp list set -app shop -list dictionaries -f dictionaries.yaml -m "code names"
yaml
# policy.dlp.patterns
- name: employee-id
  regex: "EMP-[0-9]{6}"
  action: mask
  min_count: 1
# policy.dlp.dictionaries
- name: code-names
  words: [bluebird, nightowl]
  action: log

Allow pages that may show the data ​

Add the page to Paths not checked (never checked), or add an exception for one rule on some paths (ignore_rules: [dlp.card]), from the event's False positive action.

Check request bodies ​

Request bodies set to log reports card numbers and the other data posted to the application (forms, JSON, XML, text). List the payment page under Requests not checked. block refuses such requests. Requests are never changed: mask means log there.

Refuse answers that leak errors ​

Turn on response signatures to refuse answers that leak SQL errors, stack traces, directory listings or web shell output. It costs about 5 to 10 ms per 64 KiB answer, so use it on applications that need it, and skip large static answers with the response skip paths.

text
1. Open the Response signatures tab and turn on the response check.
2. Select Preview changes, then Apply.
sh
waap apps set -app shop -m "response signatures" policy.signatures.response_body=true
yaml
signatures:
  response_body: true

Settings reference ​

General ​

SettingWhat it doesDefaultAllowed valuesApplies in
Data leak prevention (policy.dlp.enabled)Looks for sensitive data in answers.truetrue, falseall
Protection mode (mode)detect reports; block masks and refuses.empty (same as the application)detect, block, emptydetect wins
Paths not checked (skip)Answers of these paths are not checked.noneexact or prefix ending in *all
Refused answer status (block_status)Status of the page sent instead of a refused answer.502400 to 599block mode

Detectors ​

Each of card, us_ssn, iban, aadhaar, uk_nino has the two settings detectors.KIND.action and detectors.KIND.block_at.

DetectorFindsDefault action
Card numbers (card)13 to 19 digits, issuer prefix and length, Luhn check.mask
US Social Security numbers (us_ssn)SSNs written with dashes, with area, group and serial rules.mask
IBANs (iban)Country length and mod 97 check.mask
Aadhaar numbers (aadhaar)12 digits, Verhoeff check.log
UK National Insurance numbers (uk_nino)Prefix rules.log
SettingWhat it doesDefaultAllowed valuesApplies in
detectors.KIND.actionWhat is done with a match. mask turns letters and digits into *.per detector aboveoff, log, mask, blockblock mode for mask and block
detectors.KIND.block_atRefuses the answer at this many matches.0 (never)0 to 1000block mode
Card numbers: keep the last 4 digits (detectors.card.keep_last4)Masked cards keep four digits.truetrue, falsecard detector

Requests ​

SettingWhat it doesDefaultAllowed valuesApplies in
Request bodies (requests.action)Looks for the same data in request bodies.offoff, log, blockblock for block
Requests not checked (requests.skip)Paths that receive this data by design.nonepathsrequests on

Pattern and dictionary ​

SettingWhat it doesDefaultAllowed valuesApplies in
nameIdentifies the entry; rule ID dlp.pattern.NAME or dlp.dictionary.NAME.none (required)lowercase letters, digits, _, -, up to 64all
regex (patterns)An RE2 expression.none (required)up to 1024 charactersall
words, case_sensitive (dictionaries)Whole words to match.noneletters, digits, _, -; up to 64 characters eachall
actionWhat is done with a match.logoff, log, mask, blockall
min_countFewer matches are ignored.1whole numberall
block_atRefuses the answer at this many matches.00 to 1000all

Limits ​

LimitValue
Patterns64
Dictionaries16, with 10,000 words in all
Matches handled per body1000: beyond it matches are counted, not masked, and an answer with masking or blocking findings is refused
Metricwaap_dlp_matches_total{app,detector,action}; rule IDs dlp.*

Troubleshooting ​

A page that should show a number is refused ​

  • Cause: a detector masks or blocks on that page.
  • Check: the event dlp.* rule and masked sample.
  • Fix: add the page to Paths not checked, or use the event's False positive action for that one rule.

A large answer is refused ​

  • Cause: a value to mask lies in the part that was read, and the rest was not inspected.
  • Fix: raise Body inspected, or skip the page.