公共 API 参考(@saas/contracts + @core/saas-kit + apps/api 对外接口)
    Preparing search index...

    租户作用域路由的 fail-closed 闸门(global-tenancy §9.3 / FR-5·数据隔离边界种子)。

    Fail-closed gate for tenant-scoped routes (global-tenancy §9.3 / FR-5, seed of the data-isolation boundary). It only asserts that an active tenant has been resolved for the request (by TenantIsolationMiddleware into AsyncLocalStorage); the actual row filtering is enforced centrally in the repository adapter, so no handler scatters where tenant_id by hand.

    S11 · 高危#4 复合全局:本守卫经 TenantIsolationModule 注册为全局 APP_GUARD(deny-by-default 租户墙), 运行于全局会话墙之后(AppModule 中 AuthModule 先于 TenantIsolationModule → 401 先于 403)。所有 路由默认要求已绑定 active 租户;唯显式旁路可豁免:@Public()(无会话=无租户·认证面/webhook) 或 @TenantIsolationExempt()(需会话但合法无租户·建租申请/跨租治理/个人 PIPL/用户级 storage·payment)。 元数据经 Reflector.getAllAndOverride 读回(handler 优先 class·同 AuthorizationGuard 口径)。 逐路由 @UseGuards(TenantIsolationGuard) 仍可与全局并存(幂等·无短路冲突)。

    Implements

    • CanActivate
    Index
    • 裁决:@Public/@TenantIsolationExempt 任一即旁路;否则无活动租户抛 403。

      Parameters

      • context: ExecutionContext

        Nest 执行上下文(取 handler/class 元数据 + 租户会话)

      Returns boolean

      放行返回 true;否则抛 ForbiddenException

      无活动租户上下文时。