Pull request #3428: JS Norm: Check Content-Type
Merge in SNORT/snort3 from ~OSERHIIE/snort3:js_content_type to master
Squashed commit of the following:
commit
457cf486d8846108cb3cda7ea9bf99aaae4c5985
Author: Oleksandr Serhiienko <oserhiie@cisco.com>
Date: Tue May 17 22:59:38 2022 +0300
http_inspect: implement general approach of checking Content-Type header
Adding a general approach of checking Content-Type header values.
Comparison uses normalized header value and returns appropriate
code value if matched. The headers comparison is strict and precise.
Additional header parameters, like charset, are ignored. Comparison
happens against MIME type/subtupe only.
commit
79fae25f1bf59d6bcf34f2f6b92a2b8666ee830d
Author: Oleksandr Serhiienko <oserhiie@cisco.com>
Date: Tue May 17 13:29:09 2022 +0300
http_inspect: add Content-Type header validation for Enhanced JS Normalizer
Avoid lookup for Inline JavaScript if media-type is not of HTML type.
Accepted media-types follows:
* application/xhtml+xml
* text/html
If Content-Type header is not specified, default media-type will be
application/octet-stream which is not allowed. The normalization
will be skipped.