Skip to content

Secure Outbound Transport Test Plan

This document describes the test strategy, local test harness design, and test-seam boundaries for verifying the built-in outbound transport in MultiModel Dev OS.


1. Test Harness Architecture & Test Seam Boundaries

To uphold the project's zero-dependency, local-first safety posture while enabling local testing against loopback servers:

  • No Public allowPrivateNetworks Override: Production destination policy strictly rejects private/loopback IP addresses (127.0.0.0/8, ::1, 10.0.0.0/8). There is no environment variable, public CLI flag, or runtime configuration parameter that allows bypassing private-network rejection in production.
  • Injected Connector / Socket Factory Seam: Integration tests connect to local test servers (127.0.0.1:0) via an internal, test-only injected connector or socket factory seam.
  • Internal Helper Isolation: Test helpers and mock connectors are internal to tests/ fixtures and are never exported through the package public API (src/index.js or src/gateway/index.js).
  • Verifier Assertion: Release verifiers assert that no test connector or private-network bypass capability reaches production runtime code.
  • Certificate Management: Test certificates for TLS testing are static synthetic PEM certificate fixtures stored in tests/fixtures/certs/. Standard Node.js node:crypto standard library does not provide a zero-dependency X.509 certificate generation API, so static PEM fixtures are committed to test fixtures rather than generated at runtime. The test suite has zero dependency on globally installed openssl CLI executables.

2. Test Suites & Matrix

Test SuiteFileFocus AreasKey Verification Assertions
Destination Policytests/unit/transport-destination-policy.test.jsURL canonicalization & IP classificationValidates IPv4/IPv6 classification, loopback/private IP rejection, IPv4-mapped IPv6 detection, and URL scheme normalization.
DNS Resolution & Pinningtests/unit/transport-dns-pinning.test.jsDNS resolution & socket pinningValidates custom lookup socket pinning, DNS timeout handling, and DNS rebinding prevention across multiple IP answers.
TLS & Hostname Identitytests/unit/transport-tls.test.jsTLS security & SNI verificationVerifies rejectUnauthorized: true, SNI hostname matching, certificate hostname mismatch rejection, and self-signed certificate blocking.
Header Security & Authtests/unit/transport-headers.test.jsCredential injection & CR/LF guardsAsserts Bearer token construction via ResolvedCredential, CR/LF header injection rejection, and strict header allowlisting.
Resource Limits & Timeoutstests/unit/transport-resource-limits.test.jsSize caps & timeout phase lifecyclesTests request/response byte bounds, connect timeout, header timeout, idle stream timeout, and total execution timeout cancellation.
Streaming & SSE Adaptertests/unit/transport-sse-streaming.test.jsSSE streaming & backpressureVerifies text/event-stream response validation, AsyncIterable socket wrapper, backpressure drain handling, and socket destruction on abort.
Adversarial Securitytests/integration/transport-adversarial.test.jsSSRF, redirects, compression bombsSimulates HTTP 3xx redirect blocking, proxy environment variable isolation (HTTP_PROXY), compression bomb rejection, and secret redaction.

3. Test Fixture Specifications

Mock DNS Fixture

javascript
export function createMockResolver(mappings = {}) {
  return {
    async resolve4(hostname) {
      if (mappings[hostname]?.a) return mappings[hostname].a;
      throw new Error(`ENOTFOUND ${hostname}`);
    },
    async resolve6(hostname) {
      if (mappings[hostname]?.aaaa) return mappings[hostname].aaaa;
      throw new Error(`ENOTFOUND ${hostname}`);
    }
  };
}

Mock HTTPS Server Fixture

Local HTTPS server initialized with synthetic test certificates (for TLS testing) and local mock routes returning 200 OK, 302 Found, or slow streaming chunks.

Released under the MIT License.