T09 · Insecure Skill Coding Practices
- Location
examples/fetch-wrapper.md:27- Finding
Bearer Token Forwarding to a Caller-Controlled Network Destination
- Content
View full analysis
{ controller.abort() }, timeout) try { // Send request const response = await fetch(fullURL, { ...options, headers, signal: controller.signal, // HTTPS-specific configuration credentials: import.meta.env.PROD ? 'same-origin' : 'include', redirect: 'follow' }) ``` ### Technical Analysis The wrapper automatically attaches the browser's ambient bearer token to every request. At the same time, `options.baseURL` allows a caller to override the request destination. There is no same-origin check, HTTPS enforcement, or destination allowlist before the `Authorization` header is added. Consequently, code that can invoke this wrapper may cause the bearer token to be transmitted to an unintended origin. The `credentials` setting does not protect the bearer token because it only controls browser-managed credentials such as cookies. The explicitly assigned `Authorization` header remains attached to the request. Following redirects also increases the need for strict destination validation, although browser redirect behavior may limit forwarding of authorization headers in some cross-origin cases. This network behavior is related to the Skill's declared authenticated API-wrapper functionality, but unconstrained destination selection exceeds the minimum privilege required. An authenticated client should only release credentials to expl ...[truncated 1070 chars]- Remediation
View remediation
