T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:42
- Finding
- Overbroad Route and HTTP Method Allowlist Permits Undocumented Authenticated Requests<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh:42-75` **Vulnerability Type**: Insufficient route and HTTP method validation **Risk Level**: Medium ### Vulnerable Code ```bash # This skill's helper is limited to its documented Crawlora route set. Keep # caller-account surfaces and unrelated API routes out of the helper even if # someone supplies an undocumented path directly. case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the pinterest-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 pinterest-research skill" >&2 exit 2 ;; esac case "$path" in /pinterest/board/*/*) ;; /pinterest/categories) ;; /pinterest/ideas/*) ;; /pinterest/pin/*) ;; /pinterest/search) ;; /pinterest/user/*) ;; /pinterest/user/*/boards) ;; /pinterest/user/*/pins) ;; *) echo "path is not in the pinterest-research skill catalog" >&2 exit 2 ;; esac ``` ### Technical Analysis The endpoint reference defines all eight supported Pinterest operations as `GET` requests. However, the script accepts both `GET` and `POST` for every path admitted by its route allowlist. This permits authenticated POST requests even though no documented endpoint requires that method. The path allowlist uses shell `case` glob patterns. In Bash patterns, `*` can match slash characters, unlike a segment-aware URL router. Consequently: - `/pinterest/user/*` can match arbitrary nested paths below `/pinterest/user/`. - `/pinterest/pin/*` and `/pinterest/ideas/*` can accept values containing additional path segments. - `/pinterest/board/*/*` does not strictly enforce exactly two nonempty path parameters. - The more specific user board and pin patterns do not meaningfully constrain routing because the earlier `/pinterest/user/*` pattern already accepts those paths and other nested rout ...[truncated 2108 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove POST support because every documented endpoint is GET-only: ```bash if [ "$method" != "GET" ]; then echo "only GET is supported by the pinterest-research skill" >&2 exit 2 fi ``` 2. Replace broad shell globs with segment-aware validation. Ensure each parameter is nonempty and cannot contain `/`, query delimiters, fragments, percent encoding, or traversal sequences. 3. Explicitly distinguish the three supported user route forms instead of relying on `/pinterest/user/*`: ```bash segment='[A-Za-z0-9._-]+' if [[ "$path" =~ ^/pinterest/categories$ ]] || [[ "$path" =~ ^/pinterest/search$ ]] || [[ "$path" =~ ^/pinterest/pin/${segment}$ ]] || [[ "$path" =~ ^/pinterest/ideas/${segment}$ ]] || [[ "$path" =~ ^/pinterest/board/${segment}/${segment}$ ]] || [[ "$path" =~ ^/pinterest/user/${segment}$ ]] || [[ "$path" =~ ^/pinterest/user/${segment}/boards$ ]] || [[ "$path" =~ ^/pinterest/user/${segment}/pins$ ]]; then : else echo "path is not in the pinterest-research skill catalog" >&2 exit 2 fi ``` 4. If valid Pinterest identifiers require a broader character set, define and document that set explicitly rather than allowing arbitrary path content. 5. Add negative tests covering extra path segments, empty parameters, unsupported methods, encoded delimiters, duplicate slashes, and undocumented nested routes. 6. Maintain a method-to-route mapping if POST endpoints are added later, allowing POST only for the exact endpoints that require it. ]]>
