T09 · Insecure Skill Coding Practices
- Location
scripts/convert.sh:129- Finding
Cross-Origin Redirects May Disclose API Credentials and Document Contents
- Content
View full analysis
&2 exit 1 fi validate_file_extension "$input" validate_file_size "$input" curl -s -w "\n%{http_code}" \ --location --request POST "$ENDPOINT" \ --header "x-ti-app-id: $APP_ID" \ --header "x-ti-secret-code: $SECRET_CODE" \ --header "Content-Type: application/octet-stream" \ --data-binary "@$input" fi ``` ### Technical Analysis The initial endpoint is constructed from the hardcoded `api.textin.com` host, but every request enables curl's `--location` option. This causes curl to follow redirects returned by the remote server without validating that the redirect destination remains on the same HTTPS origin. The credentials are supplied as custom headers: - `x-ti-app-id` - `x-ti-secret-code` Custom headers can be applied to redirect requests, including requests to a different host. Depending on the redirect status and curl request behavior, the POST body can also be resent. The body contains either the complete document, base64-encoded images, or a user-supplied source URL. Consequently, hardcoding the initial endpoint does not guarantee that `api.textin.com` is the sole outbound destination. This contradicts th ...[truncated 1724 chars]- Remediation
View remediation
