T09 · Insecure Skill Coding Practices
- Location
scripts/crawl4ai-docker.sh:18- Finding
Unsafe JSON Construction from User-Controlled Shell Arguments
- Content
View full analysis
- Remediation
View remediation
10000 )); then echo "max_tokens must be an integer between 1 and 10000" >&2 exit 1 fi payload=$(jq -n \ --arg url "$url" \ --arg instruction "$instruction" \ --arg provider "$provider" \ --argjson max_tokens "$max_tokens" \ '{ urls: [$url], extraction_strategy: { type: "llm", provider: $provider, instruction: $instruction, max_tokens: $max_tokens } }') ``` Additional hardening should include: - Allowlist supported extraction strategies and LLM providers. - Permit only explicitly required URL schemes, normally `https`. - Reject embedded credentials and unexpected control characters in URLs. - Enforce URL and instruction length limits. - Use `curl --fail-with-body --show-error` and return nonzero on API failures. - Apply server-side schema validation because client-side validation alone is not a security boundary. ]]>
