comparison src/http/modules/ngx_http_grpc_module.c @ 7883:41f4bd4c51f1

Disabled control characters and space in header names. Control characters (0x00-0x1f, 0x7f), space, and colon were never allowed in header names. The only somewhat valid use is header continuation which nginx never supported and which is explicitly obsolete by RFC 7230. Previously, such headers were considered invalid and were ignored by default (as per ignore_invalid_headers directive). With this change, such headers are unconditionally rejected. It is expected to make nginx more resilient to various attacks, in particular, with ignore_invalid_headers switched off (which is inherently unsecure, though nevertheless sometimes used in the wild).
author Maxim Dounin <mdounin@mdounin.ru>
date Mon, 28 Jun 2021 18:01:18 +0300
parents 0302a4f0b6c4
children 419c066cb710
comparison
equal deleted inserted replaced
7882:b4073527be81 7883:41f4bd4c51f1
3382 3382
3383 if (ch >= 'A' && ch <= 'Z') { 3383 if (ch >= 'A' && ch <= 'Z') {
3384 return NGX_ERROR; 3384 return NGX_ERROR;
3385 } 3385 }
3386 3386
3387 if (ch == '\0' || ch == CR || ch == LF) { 3387 if (ch <= 0x20 || ch == 0x7f) {
3388 return NGX_ERROR; 3388 return NGX_ERROR;
3389 } 3389 }
3390 } 3390 }
3391 3391
3392 return NGX_OK; 3392 return NGX_OK;