nginx
nginx configuration: security mistakes, and a configuration test in a container.
Selected when
Section titled “Selected when”A scope has file paths **/nginx.conf or **/nginx/**/*.conf.
Checks
Section titled “Checks”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.
What to do
Section titled “What to do”Change the block the way the rule page says.
Example
Section titled “Example”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.
Turn it off
Section titled “Turn it off”gspot ignore nginx/gixy --paths "<path>" --reason "<why>"gspot ignore nginx/gixy --rule <rule> --reason "<why>"syntax
Section titled “syntax”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.
What to do
Section titled “What to do”Fix the line nginx names. Set nginx.image to the one your deployment runs.
Example
Section titled “Example”The line invalid_directive on; fails nginx -T. Remove it, or replace it with a known directive such as listen 443 ssl;.
Turn it off
Section titled “Turn it off”gspot ignore nginx/syntax --paths "<path>" --reason "<why>"Settings
Section titled “Settings”| Setting | What it sets |
|---|---|
nginx.image |
The image nginx -t runs in; name the one the deployment uses. |
Rules for coding agents
Section titled “Rules for coding agents”| Rule file | Installed when |
|---|---|
.gspot/rules/NGINX.md |
Always |
Tools and versions
Section titled “Tools and versions”| Tool | Version |
|---|---|
| gixy | 0.2.55 |
| docker | Any, install it yourself |
| openssl | Any, install it yourself |
Files gspot writes
Section titled “Files gspot writes”.gspot/configurations/nginx/gixy.cfg