Skip to content

nginx

nginx configuration: security mistakes, and a configuration test in a container.

A scope has file paths **/nginx.conf or **/nginx/**/*.conf.

Checks every nginx file for mistakes that expose a server: request forgery, path traversal through alias, header injection, and a disclosed version.

Runs at the commit stage, on macOS and Linux.

These mistakes parse and serve traffic, so they look like any other location block until an attacker uses them.

Change the block the way the rule page says.

A location for /proxy/(.*) with proxy_pass http://$1 sends requests to any host and reports ssrf. Point proxy_pass at a fixed upstream instead.

gspot ignore nginx/gixy --paths "<path>" --reason "<why>"
gspot ignore nginx/gixy --rule <rule> --reason "<why>"

Runs nginx -T on each main file inside the image, with a throwaway certificate and resolved upstream names.

Runs at the push stage, once per scope, with docker, and needs a running Docker daemon.

Only nginx itself can confirm that a file parses; otherwise the first test comes at the restart in production.

Fix the line nginx names. Set nginx.image to the one your deployment runs.

The line invalid_directive on; fails nginx -T. Remove it, or replace it with a known directive such as listen 443 ssl;.

gspot ignore nginx/syntax --paths "<path>" --reason "<why>"
Setting What it sets
nginx.image The image nginx -t runs in; name the one the deployment uses.
Rule file Installed when
.gspot/rules/NGINX.md Always
Tool Version
gixy 0.2.55
docker Any, install it yourself
openssl Any, install it yourself

.gspot/configurations/nginx/gixy.cfg