You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
getPlan() returns Object.prototype members for a plan id like "constructor" #223
getPlan in packages/core-contracts/src/plans.ts is:
returnPLANS[planId]??PLANS.free;
PLANS is a plain object literal, so a lookup by a key that names an Object.prototype member returns that member instead of falling back to Free. getPlan("constructor") returns the Object function, which is truthy, so the ?? never fires. The caller then reads .id as undefined, .maxPagesPerAudit as undefined, and planMaxPages() produces NaN from it, which silently disables the clamp it was supposed to apply.
The key comes from a database column, not from request input, so this is latent rather than exploitable today. It is one bad row or one webhook mapping change away from being live, and the failure is silent in the direction that removes a limit.
Found while reviewing per-plan container sizing, where an unrecognized plan id has to fail closed to Free.
Acceptance Criteria
getPlan("constructor"), getPlan("__proto__") and getPlan("toString") each return the Free plan
The fix uses an own-property check (Object.hasOwn) or a null-prototype registry rather than a denylist of key names
A test covers those three keys plus an ordinary unknown id
Checked against current main (ad95fb2): REPRODUCES. getPlan is still return PLANS[planId as PlanId] ?? PLANS.free; over a plain object literal (packages/core-contracts/src/plans.ts:191-193).
I loaded plans.ts from main with Bun and called it:
Activity
nc9 commentedon Oct 11, 2026
Checked against current main (ad95fb2): REPRODUCES.
getPlanis stillreturn PLANS[planId as PlanId] ?? PLANS.free;over a plain object literal (packages/core-contracts/src/plans.ts:191-193).I loaded
plans.tsfrom main with Bun and called it:Only the ordinary unknown id falls back to Free.
fix(core-contracts): guard plan registry lookup against Object protot…