mirror of
https://github.com/BaaRai/ARTEX.git
synced 2026-11-13 11:40:53 +08:00
WebFetch and the custom http tool followed redirects with net/http's default policy, so a pinned host could send the client to a target nobody approved. RedirectCheck is now the CheckRedirect policy of both clients. - Gate off, or no scope (operator test endpoint): only the 10-hop limit, same error text; nothing is parsed, resolved, read or written. - Gate on: each hop runs through the call's decision code (URL rules on the hop URL, block rules before any lookup, exemptions, resolution, pins). A hop no pin covers is not followed and never waits: its request row is found or created and the call fails with TARGET_APPROVAL_PENDING. http -> https asks again for port 443 unless a (host, 0) pin exists. An unreadable hop is blocked with TARGET_GATE_UNAVAILABLE. - Rows raised by a hop record redirect_from in the audit targets. - Norma v0.4.7 has WebFetchConfig.CheckRedirect but no agentcore option, so the four agent kinds build WebFetch themselves (same proxy, CA and position in the tool list) instead of EnableWebFetch. Norma carries the policy to the direct retry client.
20 lines
963 B
Go
20 lines
963 B
Go
package agent
|
|
|
|
import (
|
|
"github.com/Autumn-27/artex/intercept"
|
|
actool "github.com/Autumn-27/norma/tool"
|
|
)
|
|
|
|
// withWebFetch returns tools plus the WebFetch tool of an agent session. Every
|
|
// agent kind builds WebFetch here instead of through agentcore's EnableWebFetch,
|
|
// which has no option for a redirect policy: every redirect hop goes through the
|
|
// target gate (intercept.RedirectCheck), on the client that uses proxy and on
|
|
// the direct retry client alike. The tool is added after the session's own
|
|
// tools, where agentcore adds it, so the tool list keeps its order. caCert is the
|
|
// recording proxy's CA, trusted to verify the HTTPS it re-signs. tools is not
|
|
// modified.
|
|
func withWebFetch(tools []actool.CoreTool, proxy, caCert string) []actool.CoreTool {
|
|
webFetch := actool.NewWebFetch(actool.WebFetchConfig{Proxy: proxy, CACert: caCert, CheckRedirect: intercept.RedirectCheck("WebFetch")})
|
|
return append(tools[:len(tools):len(tools)], webFetch)
|
|
}
|