Summary
src/core/costEngine.ts catches errors from getPricing() and returns { totalCost: 0 } for any unrecognized model. The budget manager receives zero cost and never increments totalSpent.
Affected File
src/core/costEngine.ts
try {
pricing = pricingRegistry.getPricing(model);
} catch {
return { inputCost: 0, outputCost: 0, totalCost: 0 }; // budget bypass
}
Impact
An attacker who discovers any unlisted model name makes unlimited LLM calls without consuming any declared budget, completely defeating the cost enforcement the library promises.
Suggested Fix
Treat unknown models as a hard error at track() time:
if (!pricing) throw new Error(`Unknown model: ${model}. Add it to the pricing registry.`);
Severity
Critical
Summary
src/core/costEngine.tscatches errors fromgetPricing()and returns{ totalCost: 0 }for any unrecognized model. The budget manager receives zero cost and never incrementstotalSpent.Affected File
src/core/costEngine.tsImpact
An attacker who discovers any unlisted model name makes unlimited LLM calls without consuming any declared budget, completely defeating the cost enforcement the library promises.
Suggested Fix
Treat unknown models as a hard error at
track()time:Severity
Critical