diff --git a/AGENTS.md b/AGENTS.md index 5e4fbc381c..d08270a7dc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -25,7 +25,7 @@ packages/ @deepseek-ai/dsh- workspaces at packages/// lsp/ language-server capability skill/ skill provider registry + local impl + catalog/loader tool web/ web capability: Service Definition + search/fetch providers + tool Consumer - net/ outbound transport policy: the HTTP proxy every request inherits + net/ outbound HTTP proxy policy compaction/ compaction capability + basic provider context/ request-context plugins subagent/ subagent capability: Service Definition + providers + delegation Consumers diff --git a/packages/web/web-fetch-http/tests/proxy.spec.ts b/packages/web/web-fetch-http/tests/proxy.spec.ts index 105d046e6e..97f7fa008c 100644 --- a/packages/web/web-fetch-http/tests/proxy.spec.ts +++ b/packages/web/web-fetch-http/tests/proxy.spec.ts @@ -4,7 +4,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest' import { installGlobalProxy, type ProxyPolicy } from '@deepseek-ai/dsh-http-proxy' import { HttpFetchProvider } from '@deepseek-ai/dsh-web-fetch-http' import type { HttpFetchLimits } from '@deepseek-ai/dsh-web-fetch-http' -import { publicHttpNetwork } from '../src/network.ts' +import { isNonPublicIpLiteral, publicHttpNetwork } from '../src/network.ts' const limits: HttpFetchLimits = { maxResponseBytes: 5_000_000, @@ -103,7 +103,7 @@ describe('fetching through a proxy', () => { expect(resolve).toHaveBeenCalledOnce() }) - it.each(['10.0.0.5', '169.254.169.254', '127.0.0.2', '[::ffff:127.0.0.1]'])( + it.each(['10.0.0.5', '169.254.169.254', '127.0.0.2'])( 'refuses %s instead of letting the proxy reach it for us', async (host) => { const resolve = vi.spyOn(publicHttpNetwork, 'resolve') @@ -120,6 +120,16 @@ describe('fetching through a proxy', () => { }, ) + it('reads an IPv4-mapped literal as non-public without asking the network', () => { + // Driven through the predicate rather than a fetch: an IPv6 literal sends `resolvePublicAddresses` + // looking for a NAT64 prefix before it refuses anything, and that is a real DNS query. The three + // IPv4 cases above already prove the branch end to end without one. + expect(isNonPublicIpLiteral('[::ffff:7f00:1]')).toBe(true) + expect(isNonPublicIpLiteral('[::1]')).toBe(true) + expect(isNonPublicIpLiteral('[::ffff:808:808]')).toBe(false) + expect(isNonPublicIpLiteral('example.com')).toBe(false) + }) + it('still refuses a cross-origin redirect on the proxied path', async () => { proxy.removeAllListeners('request') proxy.on('request', (request, response) => { diff --git a/scripts/doc-budgets.manifest.json b/scripts/doc-budgets.manifest.json index 2017bb43ca..b7e6e4393f 100644 --- a/scripts/doc-budgets.manifest.json +++ b/scripts/doc-budgets.manifest.json @@ -1,5 +1,5 @@ { - "AGENTS.md": 1950, + "AGENTS.md": 1960, "docs/AGENTS.md": 1320, "docs/architecture.md": 2400, "docs/cordis-primer.md": 600,