Files
harness/tools/web/webfetch_test.go
T

17 lines
375 B
Go

package web
import (
"context"
"testing"
"github.com/stretchr/testify/require"
)
func TestWebFetch_BlocksPrivateHost(t *testing.T) {
tool := &WebFetchTool{}
res, err := tool.Execute(context.Background(),
[]byte(`{"url":"http://169.254.169.254/latest/meta-data/"}`))
require.NoError(t, err)
require.NotEmpty(t, res.Error, "private metadata IP must be rejected")
}