T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/crawlora.sh:44
- Finding
- Overbroad Authenticated API Route and HTTP Method Authorization<![CDATA[ ## Vulnerability Details **File Location**: `scripts/crawlora.sh`, lines 44–100 **Vulnerability Type**: Overly permissive route allowlisting and HTTP method authorization **Risk Level**: Medium ### Vulnerable Code ```bash case "$method" in GET|POST) ;; *) echo "only GET and POST are supported by the business-review-trust-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 business-review-trust-research skill" >&2 exit 2 ;; esac case "$path" in /bbb/business) ;; /bbb/business/complaints) ;; /bbb/business/more-info) ;; /bbb/business/reviews) ;; /bbb/category) ;; /bbb/scamtracker/*) ;; /bbb/scamtracker/search) ;; /bbb/scamtracker/state-stats) ;; /bbb/search) ;; /capterra/product) ;; /capterra/product/reviews) ;; /capterra/search) ;; /kickstarter/comments) ;; /kickstarter/discover) ;; /kickstarter/project) ;; /kickstarter/updates) ;; /producthunt/category/*) ;; /producthunt/category/*/products) ;; /producthunt/leaderboard) ;; /producthunt/product/*) ;; /producthunt/product/*/about) ;; /producthunt/product/*/alternatives) ;; /producthunt/product/*/customers) ;; /producthunt/product/*/launches) ;; /producthunt/product/*/makers) ;; /producthunt/product/*/reviews) ;; /producthunt/search) ;; /trustmrr/acquire) ;; /trustmrr/categories) ;; /trustmrr/category/*) ;; /trustmrr/leaderboard) ;; /trustmrr/marketplace) ;; /trustmrr/startup/*) ;; /trustmrr/startups) ;; /trustpilot/business-units/search) ;; /trustpilot/business/*) ;; /trustpilot/business/*/related) ;; /trustpilot/business/*/reviews) ;; /trustpilot/categories) ;; /trustpilot/categories/search) ;; /trustpilot/category/*) ;; *) echo "path is not in the business-review-trust-research skill catalog" >&2 exit 2 ;; esac ``` ### Technical Analysis The endpoint ...[truncated 3463 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. **Bind each route to its documented HTTP method.** Since the audited endpoint reference lists `GET` endpoints, reject `POST` unless a specific endpoint is explicitly documented to require it. 2. **Validate path structure rather than using unrestricted glob prefixes.** Require every dynamic identifier to be exactly one path segment and reject additional descendants. For example: ```bash case "$method:$path" in GET:/producthunt/search) ;; GET:/producthunt/leaderboard) ;; GET:/producthunt/product/*) ;; *) echo "unsupported method or path" >&2 exit 2 ;; esac ``` A plain `*` remains insufficient for single-segment enforcement. Before matching, split the path into segments or apply an anchored regular expression that excludes `/` from identifiers. 3. **Use anchored regular expressions for dynamic routes.** For example: ```bash if [[ "$method" == "GET" && "$path" =~ ^/producthunt/product/[A-Za-z0-9._-]+(/(about|alternatives|customers|launches|makers|reviews))?$ ]]; then : else echo "unsupported method or path" >&2 exit 2 fi ``` Define similarly constrained expressions for every dynamic route family. 4. **Reject empty and malformed dynamic segments.** Apply endpoint-specific character and length restrictions to Product Hunt IDs, Trustpilot slugs, TrustMRR slugs, category slugs, and BBB Scam Tracker IDs. 5. **Generate the client allowlist from the endpoint catalog.** This reduces drift between `reference/endpoints.md` and the executable authorization logic. 6. **Add negative security tests.** Verify that the helper rejects: - Undocumented descendant paths. - Extra path segments. - Unsupported methods, especially `POST`. - Encoded or malformed separators. - Empty identifiers. - Routes that are similar to, but not exactly part of, the documented catalog. 7. **Retain existing protections.** Preserve the fixed HTTP ...[truncated 131 chars]
