T09 · Insecure Skill Coding Practices
- Location
scripts/setup_openclaw_https.sh:72- Finding
Unvalidated Domain and Email Inputs Reach Privileged Configuration and Commands
- Content
View full analysis
/dev/null <- Remediation
View remediation
&2 exit 1 fi ``` 2. **Validate the email address conservatively** - Reject control characters, whitespace, and leading hyphens. - Require a bounded, conventional mailbox format suitable for Certbot. 3. **Quote all variable expansions and terminate option parsing where supported** ```bash sudo tee -- "$CONFIG_FILE" > /dev/null sudo certbot certonly --nginx --non-interactive --agree-tos \ --email "$EMAIL" -d "$DOMAIN" ``` Apply equivalent quoting to the standalone Certbot command. 4. **Separate validation from configuration generation** - Generate the file only after all arguments pass validation. - Use a securely created temporary file with restrictive permissions. - Validate the temporary configuration before atomically installing it into `/etc/nginx/conf.d`. 5. **Use a safe bootstrap sequence** - First install an HTTP-only configuration that does not reference nonexistent certificate files. - Obtain the certificate. - Generate the final HTTPS configuration. - Run `nginx -t` and atomically install or reload only after successful validation. 6. **Reduce privileged processing** - Construct and validate content without privileges. - Use privilege elevation only for the final package installation, file installation, service management, and certificate operations. ]]>
