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)
_totalEstimatedgrew monotonically forever —BudgetTracker.release()now decrements_totalEstimatedalongside_totalReserved.settle()correctly preserves the estimate (it has committed to actual).stream()was not budget-enforced —client.stream()now reserves before the retry loop, settles on the firstusagechunk, 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.ProviderRequestErrorechoed raw provider error bodies, leaking API keys — constructor now redactssk-…,sk-proj-…,sk-ant-…,Bearer …, and JSON secret fields.- No SSRF protection on
baseUrl—addProvider()now validates throughvalidateBaseUrl(). Default rejectshttp://; loopback is always allowed whenallowInsecure: true; private network ranges requireallowPrivateNetwork: true. AWS instance metadata is always blocked. - Budget callback order was inverted —
onBudgetWarningnow fires beforeonBudgetExceededwhen a singlesettle()crosses 100%. extractJsoncould return garbage on truncated input — fallback now scans forward looking for a balanced, JSON.parse-valid substring.
Added
src/security/url-guard.tswithvalidateBaseUrl(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?: booleanfield onProviderConfigallowInsecureUrls?: booleanandallowPrivateNetwork?: booleanonHilbrasClientConfigConfigurationErroris now used at the budget-rejection paths in bothstream()andcomplete()redact()exported fromsrc/logging/logger.ts
Documentation
README.mdrewritten 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.mdupdated with v0.9.3 entrypackage.json: added keywords, homepage, repository, bugs fields for npm search discoverability
Verification
npm run build— cleannpm 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 (
RequestPipelineextraction) - v0.10.0-PR-2: API surface cleanup (wire
sdkLogger, dead-code removal, merge twoProviderConfigtypes) - v0.10.0-PR-3: Circuit-breaker scoping (per-client registry)
- v0.10.0-PR-4:
SDKConfigwiring (new HilbrasClient({ sdkConfig })actually works) - v0.10.0-PR-5: README architecture diagram refresh