T09 · Insecure Skill Coding Practices
- Location
scripts/create-and-reload.sh:53- Finding
Unvalidated arguments permit Nginx configuration injection
- Content
View full analysis
- Remediation
View remediation
&2; exit 1; } ``` 2. Validate the domain as a sequence of valid DNS labels. Reject whitespace, control characters, slashes, braces, semicolons, quotes, and newlines. 3. Require the port to contain only decimal digits and enforce the range `1-65535`: ```bash [[ "$PORT" =~ ^[0-9]+$ ]] && (( PORT >= 1 && PORT <= 65535 )) || { echo "Invalid port" >&2; exit 1; } ``` 4. Reject carriage returns and newline characters explicitly in every value inserted into the configuration. 5. Generate configuration only from validated typed values; do not attempt to make arbitrary input safe through shell quoting because Nginx has its own configuration grammar. 6. Test the generated configuration in an isolated staging context before replacing the active file. ]]>
