Skip to content

v0.9.3: Hardening — 6 P0 fixes, SSRF guard, streaming budget, error redaction

Latest

Choose a tag to compare

@lacrous lacrous released this 26 Aug 23:15

What's new

Hardening release closing all 6 P0 defects from the v0.9.2 audit. 820 → 878 passing tests, no breaking API changes.

Fixed (P0)

  • _totalEstimated grew monotonically foreverBudgetTracker.release() now decrements _totalEstimated alongside _totalReserved. settle() correctly preserves the estimate (it has committed to actual).
  • stream() was not budget-enforcedclient.stream() now reserves before the retry loop, settles on the first usage chunk, settles at end-of-stream if no usage chunk arrived, and releases on abort/throw/fallback. The v0.9.0 "Hard Budget Enforcement" headline now actually covers streams.
  • ProviderRequestError echoed raw provider error bodies, leaking API keys — constructor now redacts sk-…, sk-proj-…, sk-ant-…, Bearer …, and JSON secret fields.
  • No SSRF protection on baseUrladdProvider() now validates through validateBaseUrl(). Default rejects http://; loopback is always allowed when allowInsecure: true; private network ranges require allowPrivateNetwork: true. AWS instance metadata is always blocked.
  • Budget callback order was invertedonBudgetWarning now fires before onBudgetExceeded when a single settle() crosses 100%.
  • extractJson could return garbage on truncated input — fallback now scans forward looking for a balanced, JSON.parse-valid substring.

Added

  • src/security/url-guard.ts with validateBaseUrl(url, opts) exported from the public API
  • 58 new tests (820 → 878)
  • New test files: tests/security/url-guard.test.ts (27), tests/security/ssrf-integration.test.ts (8)
  • allowInsecure?: boolean field on ProviderConfig
  • allowInsecureUrls?: boolean and allowPrivateNetwork?: boolean on HilbrasClientConfig
  • ConfigurationError is now used at the budget-rejection paths in both stream() and complete()
  • redact() exported from src/logging/logger.ts

Documentation

  • README.md rewritten as a clean landing page with feature matrix and links
  • New docs: docs/security.md, docs/cost-and-budget.md, docs/providers.md, docs/observability.md
  • Removed: docs/STRATEGY.md, docs/EXECUTION-ENGINE-THESIS.md, old v0.1→v0.2 and v0.2→v0.3 migration files
  • CHANGELOG.md updated with v0.9.3 entry
  • package.json: added keywords, homepage, repository, bugs fields for npm search discoverability

Verification

  • npm run build — clean
  • npm test — 878/878 passing
  • No breaking changes; all 820 pre-existing tests pass without modification

Risk

Low. The hardening changes are surgical and additive. The only non-additive change is the SSRF guard default behavior (http:// rejected). Ollama users get allowInsecure: true to opt back in. AWS metadata was previously reachable through misconfiguration; that path is now closed even with allowInsecure.

Follow-ups (separate PRs)

  • v0.10.0-PR-1: God-file refactor (RequestPipeline extraction)
  • v0.10.0-PR-2: API surface cleanup (wire sdkLogger, dead-code removal, merge two ProviderConfig types)
  • v0.10.0-PR-3: Circuit-breaker scoping (per-client registry)
  • v0.10.0-PR-4: SDKConfig wiring (new HilbrasClient({ sdkConfig }) actually works)
  • v0.10.0-PR-5: README architecture diagram refresh