Test file upload scenarios that exercise cf.waf.content_scan.* fields. Requires the zone to have
Malicious Uploads Detection enabled (Enterprise + add-on).
ATTENTION: For testing, please remember to disable the WARP client.
cf.waf.content_scan.has_malicious_obj, infected files return 403.
Clean files reach the origin.
lookup_json_string(http.request.body.raw, "file")
so the scanner knows where to look.
num_obj counts all content objects. Use rules like
cf.waf.content_scan.num_obj > 2 to limit bulk uploads.
| Field | Type | Description |
|---|---|---|
| cf.waf.content_scan.has_obj | Boolean | Request contains at least one content object |
| cf.waf.content_scan.has_malicious_obj | Boolean | At least one object is malicious (infected/suspicious) |
| cf.waf.content_scan.num_obj | Integer | Total number of content objects detected |
| cf.waf.content_scan.num_malicious_obj | Integer | Number of malicious content objects |
| cf.waf.content_scan.obj_sizes | Array<Integer> | File sizes (bytes) in detection order |
| cf.waf.content_scan.obj_types | Array<String> | MIME types in detection order |
| cf.waf.content_scan.obj_results | Array<String> | Scan results: clean | suspicious | infected |
not scanned
|
| cf.waf.content_scan.has_failed | Boolean | AV scanner timed out or could not scan an object |
cf.waf.content_scan.* fields
Any payload that is NOT text/html, text/x-shellscript,
application/json, text/csv, or text/xml.
Includes executables, documents, archives, images, audio/video.
Detection is by heuristics — the Content-Type header is ignored
since it can be spoofed.
# Block all malicious uploads
(cf.waf.content_scan.has_malicious_obj)
# Block malicious uploads to a specific endpoint
(cf.waf.content_scan.has_malicious_obj and http.request.uri.path contains "/upload")
# Block if scanner could not scan (fail-closed posture)
(cf.waf.content_scan.has_failed)
# Block more than 2 objects in a single request
(cf.waf.content_scan.num_obj > 2 and http.request.uri.path eq "/upload")
# Block bots uploading files
(cf.waf.content_scan.has_obj and cf.bot_management.score lt 10)
# Custom scan expression for Base64 in JSON (configure in dashboard Security->Settings->Malicious uploads detection)
lookup_json_string(http.request.body.raw, "file")