T09 · Insecure Skill Coding Practices
- Location
src/index.ts:65- Finding
Arbitrary HTTPS Requests Enable Server-Side Request Forgery
- Content
View full analysis
{ const url = agent_card_url || config.agentCardUrl; const card = await fetchJson(url, "GET"); return jsonToolResult(card); } ``` ```ts const endpoint = endpoint_url ? requireHttpsUrl(endpoint_url, "endpoint_url") : await getRuntimeEndpointFromAgentCard(agent_card_url); const outboundPayload = payload || buildServiceRequestPayload(service_request); assertPayloadHasNoObviousSecrets(outboundPayload); ``` ```ts async function getRuntimeEndpointFromAgentCard(agentCardUrl?: string): Promise { if (!agentCardUrl) { throw new Error("agent_card_url or endpoint_url is required for service requests."); } const card = await fetchJson(agentCardUrl, "GET"); const endpoint = extractRuntimeEndpoint(card); if (!endpoint) { throw new Error("Agent Card does not expose a usable HTTPS runtime endpoint in url, endpoints.a2a, endpoints.tasks, or endpoints.message."); } return endpoint; } function extractRuntimeEndpoint(card: unknown): string { if (!isObject(card)) { return ""; } const candidates: unknown[] = [card.url]; if (isObject(card.endpoints)) { candidates.push(card.endpoints.a2a, card.endpoints.tasks, card.endpoints.message, card.endpoints.rpc, card.endpoints.jsonrpc); } for (const candidate of candidates) { const endpoint = trimString(candidate); if (endpoint && endpoint.startsWith("https://")) { return requireHt ...[truncated 3216 chars]- Remediation
View remediation
