Chore/Prevent invalid http redirect (#4990)

prevent invalid http redirect
This commit is contained in:
Henry Heng
2025-07-31 12:24:08 +01:00
committed by GitHub
parent ed27ad0c58
commit 89a806f722
6 changed files with 181 additions and 30 deletions
@@ -1,7 +1,6 @@
import { z } from 'zod'
import fetch from 'node-fetch'
import { DynamicStructuredTool } from '../OpenAPIToolkit/core'
import { checkDenyList } from '../../../src/httpSecurity'
import { secureFetch } from '../../../src/httpSecurity'
export const desc = `Use this when you want to execute a POST request to create or update a resource.`
@@ -127,10 +126,7 @@ export class RequestsPostTool extends DynamicStructuredTool {
...this.headers
}
// Check if URL is allowed by security policy
await checkDenyList(inputUrl)
const res = await fetch(inputUrl, {
const res = await secureFetch(inputUrl, {
method: 'POST',
headers: requestHeaders,
body: JSON.stringify(inputBody)