mirror of
https://github.com/falcosecurity/falco.git
synced 2025-07-17 16:21:31 +00:00
update(userspace/falco): enforce check that content-type actually starts with "application/json" string.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com> Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
This commit is contained in:
parent
b359f71511
commit
bb8b75a2cd
@ -150,7 +150,8 @@ bool k8s_audit_handler::handlePost(CivetServer *server, struct mg_connection *co
|
|||||||
// Ensure that the content-type is application/json
|
// Ensure that the content-type is application/json
|
||||||
const char *ct = server->getHeader(conn, string("Content-Type"));
|
const char *ct = server->getHeader(conn, string("Content-Type"));
|
||||||
|
|
||||||
if(ct == NULL || strstr(ct, "application/json") == NULL)
|
// content type *must* start with application/json
|
||||||
|
if(ct == NULL || strncmp(ct, "application/json", strlen("application/json")) != 0)
|
||||||
{
|
{
|
||||||
mg_send_http_error(conn, 400, "Wrong Content Type");
|
mg_send_http_error(conn, 400, "Wrong Content Type");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user