Summary
A cross-tenant authorization bypass in Chartbrew's template generation endpoint allows an authenticated user with legitimate permissions in their own team to access template models for projects that belong to other teams.
Because the authorization check is not properly awaited and the project-team relationship is not enforced, attackers can request and receive victim project data by referencing a different project's identifier.
Affected context
This issue affects Chartbrew deployments where multiple teams (tenants) share the same instance and rely on access-control logic to isolate project data.
The vulnerable path is the HTTP handler for:
GET /team/:team_id/template/generate/:project_id
The risk appears when:
- Users are authenticated and have template-generation permissions (
updateAnyonchart) in at least one team, and - The application does not strictly verify that the target
project_idbelongs to the specifiedteam_idor to the caller's actual team.
Exploit preconditions
- Attack surface: HTTP API endpoint
GET /team/:team_id/template/generate/:project_id. - Required access: Valid authenticated user account with template-generation permissions in at least one team.
- Trigger point: Attacker crafts a request where
team_idand/orproject_idreference a victim team's project, while still passing their own authorization check. - Why exploitation is possible:
- The handler calls
checkAccess(req, "updateAny", "chart")but does not await the returned promise, so the authorization result is effectively ignored or races. - The handler does not verify that
project_idis owned byreq.params.team_idor by the caller's team, enabling cross-tenant access by ID guessing or enumeration.
Why this happens
The root cause is an improper authorization implementation at the endpoint level, mapping to CWE-285: Improper Authorization.
Two related design flaws occur:
- The asynchronous authorization function is invoked without awaiting its result, so the access decision is never reliably enforced before returning data.
- The resource scoping logic fails to ensure that the requested
project_idbelongs to the team associated with the request or to the caller's actual team context.
Together, these issues break the intended multi-tenant isolation, allowing an authenticated user to read data tied to another tenant simply by referencing its project identifier.
Potential impact
- Exposure of template models and related configuration from other teams' projects.
- Unauthorized insight into how victim teams structure charts, queries, or data flows.
- Potential leakage of sensitive metadata embedded in templates (e.g., field names, query fragments, or structural hints about underlying data).
- Erosion of tenant isolation guarantees, undermining trust in a shared Chartbrew instance.
General mitigation guidance
Effective mitigation focuses on enforcing resource-scoped authorization and correct async access checks:
- Ensure that all authorization helpers returning promises are awaited and their decisions are handled before any sensitive data is returned.
- Implement strict ownership checks that bind each project to a specific team and validate that relationship for every request (e.g., query by
project_idandteam_idtogether). - Apply a consistent access-control layer that always evaluates both:
- The caller's permissions (role, team membership, capabilities), and
- The ownership and tenant context of the target resource.
- Adopt secure-by-default APIs for permission checks, where failing to await or evaluate the result is harder or more obvious.
- Limit the data returned by cross-team-capable endpoints and avoid exposing unnecessary internal details even on success.
How teams detect issues like this
Detection typically centers around identifying missing or ineffective authorization checks:
- Static analysis and code review:
- Search for authorization helpers (e.g.,
checkAccess) whose return values are ignored or not awaited in async handlers. - Flag handlers that accept tenant- or resource-identifiers in parameters (
team_id,project_id) but do not verify the relationship between them at the database layer. - Review endpoints that combine user-supplied IDs with multi-tenant resources, checking for explicit tenant scoping in queries (e.g.,
WHERE team_id = ? AND id = ?). - Automated tests and policies:
- Add multi-tenant integration tests that attempt cross-team access with valid but unauthorized accounts.
- Use security test tooling or API fuzzers configured to try cross-tenant ID substitution across endpoints.
- Runtime monitoring:
- Log and alert on patterns where a user repeatedly accesses resources tied to teams they are not a member of.

