T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:51
- Finding
- Overly Permissive HTTP Method and Route Allowlist## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 51–154 **Vulnerability Type**: Insufficient request method and path validation **Risk Level**: Medium The helper attaches the user's Crawlora API key to requests after validating them against a route allowlist. However, it permits both `GET` and `POST` for every accepted route even though the endpoint reference documents the skill's 58 endpoints as `GET` operations. Several parameterized route patterns also use shell wildcards that can match `/` characters and therefore accept undocumented nested paths. Relevant code: ```sh case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the music-podcast-research skill" >&2 exit 2 ;; esac ``` ```sh case "$path" in /apple-podcasts/charts) ;; /apple-podcasts/charts/rankings) ;; /apple-podcasts/episodes/search) ;; /apple-podcasts/new) ;; /apple-podcasts/search) ;; /apple-podcasts/show/*) ;; /apple-podcasts/show/*/episodes) ;; /apple-podcasts/show/*/related) ;; /discogs/artist/*) ;; /discogs/artist/*/releases) ;; /discogs/label/*) ;; /discogs/label/*/releases) ;; /discogs/master/*) ;; /discogs/release/*) ;; /discogs/search) ;; # Additional fixed routes omitted for brevity. *) echo "path is not in the music-podcast-research skill catalog" >&2 exit 2 ;; esac ``` ```sh else [ -n "$body" ] || body="${rest[0]:-}" [ -n "$body" ] || body='{}' # Stream the body on stdin so curl never interprets a user value as its # @file shorthand (and cannot read local files supplied in a request body). printf '%s' "$body" | curl -fsS -X "$method" "${auth[@]}" \ -H "Content-Type: application/json" --data-binary @- "${base}${path}" fi ``` ### Technical Analysis Bash `case` patterns use glob semantics. A pattern such as `/discogs/artist/*` does not constrain `*` to a single path ...[truncated 2150 chars]
- Remediation
- ## Remediation Suggestions 1. Reject `POST` by default and permit only the method documented for each route. For the current endpoint catalog, restrict the helper to `GET`. 2. Replace broad shell wildcard checks with exact, anchored route validation. 3. For parameterized routes, require exactly one non-empty segment and reject embedded slashes. For example, validate an artist route against an equivalent of `^/discogs/artist/[^/]+$`. 4. Maintain a method-and-route table so authorization is performed on the tuple of HTTP method and normalized path rather than through independent checks. 5. Validate path parameter formats where known, such as numeric Discogs and Apple Podcasts identifiers. 6. Add negative tests covering nested suffixes, unsupported methods, empty identifiers, duplicate slashes, traversal syntax, query fragments, and undocumented routes. 7. Keep the existing fixed API origin, private temporary curl configuration, API-key character validation, and local-file upload protections, as these appropriately reduce credential and file-disclosure risks.
