Skip to content

Security: Missing Authorization Check in ensureTeamPlan Middleware#540

Open
tomaioo wants to merge 1 commit into
forwardemail:masterfrom
tomaioo:fix/security/missing-authorization-check-in-ensuretea
Open

Security: Missing Authorization Check in ensureTeamPlan Middleware#540
tomaioo wants to merge 1 commit into
forwardemail:masterfrom
tomaioo:fix/security/missing-authorization-check-in-ensuretea

Conversation

@tomaioo

@tomaioo tomaioo commented Jul 7, 2026

Copy link
Copy Markdown

Summary

Security: Missing Authorization Check in ensureTeamPlan Middleware

Problem

Severity: High | File: app/controllers/web/my-account/ensure-team-plan.js:L6

The ensureTeamPlan middleware sets ctx.state.isTeamPlanRequired based on whether the domain plan is 'team', but it does NOT enforce any restriction. The variable name suggests it should block non-team plans, yet it always calls next(). This is likely a logic bug where the developer intended to check if team plan is required and throw an error if not met, but instead only sets a boolean flag without enforcement.

Solution

Add proper authorization logic. If the intent is to require a team plan, throw an error when ctx.state.domain.plan !== 'team'. If the intent is just to set a flag for downstream use, rename the variable to avoid confusion. Current implementation: ctx.state.isTeamPlanRequired = ctx.state.domain.plan !== 'team'; should likely be: if (ctx.state.domain.plan !== 'team') throw Boom.paymentRequired(ctx.translateError('TEAM_PLAN_REQUIRED'));

Changes

  • app/controllers/web/my-account/ensure-team-plan.js (modified)

The `ensureTeamPlan` middleware sets `ctx.state.isTeamPlanRequired` based on whether the domain plan is 'team', but it does NOT enforce any restriction. The variable name suggests it should block non-team plans, yet it always calls `next()`. This is likely a logic bug where the developer intended to check if team plan is required and throw an error if not met, but instead only sets a boolean flag without enforcement.

Signed-off-by: tomaioo <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant