T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:44
- Finding
- Overbroad Route Patterns and Unrestricted POST Requests Bypass the Intended API Allowlist<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 44–119 **Vulnerability Type**: Incomplete endpoint and HTTP-method allowlisting **Risk Level**: Medium ### Vulnerable Code ```bash case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the resale-secondhand-research skill" >&2 exit 2 ;; esac # Reject path syntax that could smuggle a route through a shell glob check. case "$path" in ""|*[?#%]*|*..*|*//* ) echo "invalid path for the resale-secondhand-research skill" >&2 exit 2 ;; esac case "$path" in /depop/brands) ;; /depop/categories) ;; /depop/item/*) ;; /depop/item/*/similar) ;; /depop/search) ;; /depop/search-sellers) ;; /depop/search/facets) ;; /depop/shop/*) ;; /depop/sizes) ;; /depop/suggest) ;; /etsy/listing/*) ;; /etsy/listing/*/reviews) ;; /etsy/search) ;; /etsy/shop/*) ;; /etsy/shop/*/listings) ;; /etsy/shop/*/reviews) ;; /etsy/shop/search) ;; /goat/collection) ;; /goat/countries) ;; /goat/curated) ;; /goat/listings/count) ;; /goat/product/*) ;; /goat/product/*/recommended) ;; /goat/search) ;; /goat/search/facets) ;; /goat/searches/trending) ;; /goat/suggest) ;; /leboncoin/listing) ;; /leboncoin/search) ;; /mercari/autocomplete) ;; /mercari/home) ;; /mercari/item/*) ;; /mercari/master) ;; /mercari/search) ;; /poshmark/brand/*) ;; /poshmark/brands) ;; /poshmark/categories) ;; /poshmark/category/*) ;; /poshmark/closet/*) ;; /poshmark/listing/*) ;; /poshmark/search) ;; /poshmark/trend/*) ;; /stockx/brands) ;; /stockx/categories) ;; /stockx/product/*) ;; /stockx/releases) ;; /stockx/search) ;; /vinted/brand) ;; /vinted/brands) ;; /vinted/catalog) ;; /vinted/categories) ;; /vinted/category) ;; /vinted/item) ;; /vinted/member) ;; /whatnot/browse) ;; /whatnot/categories) ;; /whatnot/live/*) ;; *) echo "path is not in the resale-secondhand-research skill c ...[truncated 3026 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace wildcard route authorization with exact, anchored validation for each parameterized endpoint. Each path parameter should explicitly prohibit `/`. For example: ```bash if [[ "$path" =~ ^/etsy/shop/[^/]+$ ]]; then : elif [[ "$path" =~ ^/etsy/shop/[^/]+/(listings|reviews)$ ]]; then : else echo "path is not in the skill catalog" >&2 exit 2 fi ``` 2. Bind permitted methods to exact routes instead of validating the method independently. If all documented endpoints are read-only, reject every method except `GET`: ```bash [ "$method" = "GET" ] || { echo "only GET is supported for documented endpoints" >&2 exit 2 } ``` 3. If POST endpoints are added later, define an explicit route-to-method mapping and permit POST only for those exact routes. 4. Validate parameter formats where known, such as numeric listing IDs, constrained usernames, country codes, or documented slugs. This reduces ambiguity and prevents nested-route matching. 5. Add regression tests confirming rejection of: - Extra path segments such as `/etsy/shop/example/admin` - Incorrect methods such as `POST /etsy/search` - Encoded or malformed separators - Empty path parameters - Valid prefixes followed by undocumented suffixes 6. Generate the route validator from the same endpoint metadata used to generate `reference/endpoints.md`, reducing the risk of documentation and enforcement diverging. ]]>
