Appearance
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:
operatorfor 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=detectyaml
# applications[].policy.dlp
dlp:
mode: detectTry 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.jsonChoose 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=maskyaml
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: logAllow 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=trueyaml
signatures:
response_body: trueSettings reference
General
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
Data leak prevention (policy.dlp.enabled) | Looks for sensitive data in answers. | true | true, false | all |
Protection mode (mode) | detect reports; block masks and refuses. | empty (same as the application) | detect, block, empty | detect wins |
Paths not checked (skip) | Answers of these paths are not checked. | none | exact or prefix ending in * | all |
Refused answer status (block_status) | Status of the page sent instead of a refused answer. | 502 | 400 to 599 | block mode |
Detectors
Each of card, us_ssn, iban, aadhaar, uk_nino has the two settings detectors.KIND.action and detectors.KIND.block_at.
| Detector | Finds | Default 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 |
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
detectors.KIND.action | What is done with a match. mask turns letters and digits into *. | per detector above | off, log, mask, block | block mode for mask and block |
detectors.KIND.block_at | Refuses the answer at this many matches. | 0 (never) | 0 to 1000 | block mode |
Card numbers: keep the last 4 digits (detectors.card.keep_last4) | Masked cards keep four digits. | true | true, false | card detector |
Requests
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
Request bodies (requests.action) | Looks for the same data in request bodies. | off | off, log, block | block for block |
Requests not checked (requests.skip) | Paths that receive this data by design. | none | paths | requests on |
Pattern and dictionary
| Setting | What it does | Default | Allowed values | Applies in |
|---|---|---|---|---|
name | Identifies the entry; rule ID dlp.pattern.NAME or dlp.dictionary.NAME. | none (required) | lowercase letters, digits, _, -, up to 64 | all |
regex (patterns) | An RE2 expression. | none (required) | up to 1024 characters | all |
words, case_sensitive (dictionaries) | Whole words to match. | none | letters, digits, _, -; up to 64 characters each | all |
action | What is done with a match. | log | off, log, mask, block | all |
min_count | Fewer matches are ignored. | 1 | whole number | all |
block_at | Refuses the answer at this many matches. | 0 | 0 to 1000 | all |
Limits
| Limit | Value |
|---|---|
| Patterns | 64 |
| Dictionaries | 16, with 10,000 words in all |
| Matches handled per body | 1000: beyond it matches are counted, not masked, and an answer with masking or blocking findings is refused |
| Metric | waap_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.
Related
- Response headers
- WS-Security: signed and encrypted SOAP answers.