The analyser doesn't take into account the special syntax of httptypes blocks, in which directives are arbitrary MIME types. This means that crossplane doesn't recognise Nginx configurations containing types blocks as valid when running in strict mode, which verifies that directive names are present in the analyser's allowlist. A similar problem occurs when check_ctx=True is set via the API.
To Reproduce
Run crossplane parse --strict on the following Nginx configuration:
{"status":"failed","errors":[{"file":"nginx.conf","error":"unknown directive \"text/html\" in nginx.conf:3","line":3},{"file":"nginx.conf","error":"unknown directive \"image/gif\" in nginx.conf:4","line":4},{"file":"nginx.conf","error":"unknown directive \"image/jpeg\" in nginx.conf:5","line":5}],"config":[{"file":"nginx.conf","status":"failed","errors":[{"error":"unknown directive \"text/html\" in nginx.conf:3","line":3},{"error":"unknown directive \"image/gif\" in nginx.conf:4","line":4},{"error":"unknown directive \"image/jpeg\" in nginx.conf:5","line":5}],"parsed":[{"directive":"http","line":1,"args":[],"block":[{"directive":"types","line":2,"args":[],"block":[]}]}]}]}
Expected behavior
No errors are encountered, and an AST is printed.
Your environment
crossplane v0.5.7 (although the problem also exists on master)
Describe the bug
The analyser doesn't take into account the special syntax of
http
types
blocks, in which directives are arbitrary MIME types. This means that crossplane doesn't recognise Nginx configurations containingtypes
blocks as valid when running in strict mode, which verifies that directive names are present in the analyser's allowlist. A similar problem occurs whencheck_ctx=True
is set via the API.To Reproduce
Run
crossplane parse --strict
on the following Nginx configuration:This outputs:
Expected behavior
No errors are encountered, and an AST is printed.
Your environment
crossplane v0.5.7 (although the problem also exists on master)