T09 · Insecure Skill Coding Practices
- Location
send.sh:62- Finding
Untrusted Arguments Are Interpolated into JSON Without Escaping
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 ;; esac ``` 2. Use `jq` to encode the nested content and outer request instead of manually concatenating JSON: ```bash CONTENT=$(jq -cn --arg text "$MESSAGE" '{text: $text}') PAYLOAD=$(jq -cn \ --arg receive_id "$TARGET" \ --arg content "$CONTENT" \ '{receive_id: $receive_id, msg_type: "text", content: $content}') RESULT=$(printf '%s' "$PAYLOAD" | curl -sS --fail-with-body \ -X POST \ --get \ --data-urlencode "receive_id_type=$MSG_TYPE" \ "https://open.feishu.cn/open-apis/im/v1/messages" \ -H "Authorization: Bearer $TOKEN" \ -H "Content-Type: application/json" \ --data-binary @-) ``` 3. Validate target identifiers against the expected Feishu identifier syntax and impose reasonable length limits. 4. Treat all hook-derived values as untrusted, even when supplied by the OpenClaw event system. 5. Use `curl -sS --fail-with-body` and explicitly handle transport failures and non-success HTTP status codes. ]]>
