Skip to content

Commit

Permalink
update(userspace/falco): enforce check that content-type actually sta…
Browse files Browse the repository at this point in the history
…rts with "application/json" string.

Signed-off-by: Federico Di Pierro <[email protected]>

Co-authored-by: Leonardo Grasso <[email protected]>
  • Loading branch information
2 people authored and poiana committed Dec 9, 2021
1 parent b359f71 commit bb8b75a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion userspace/falco/webserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ bool k8s_audit_handler::handlePost(CivetServer *server, struct mg_connection *co
// Ensure that the content-type is application/json
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");

Expand Down

0 comments on commit bb8b75a

Please sign in to comment.