mirror of
https://github.com/HeyPuter/puter.git
synced 2026-09-12 16:25:51 +00:00
Covers PUT-1708, PUT-1709 and PUT-1743. Twelve routes, every one setting requireUserActor -- that option is what installs requireAuthGate, requireVerifiedAccount and requireNonAccessTokenGate, because server.ts derives `needsAuth` from the route options. Reads need it as much as writes: without an auth option a route gets no suspension check and admits access tokens, so a just-disabled member could still read the roster and a scoped third-party token could read the audit log. Authority is checked before anything observable. Validating the body first made POST /members answer 400 before 403, and resolving :username first turned the member routes into a global username-existence oracle. Provisioning applies the same username and email rules as signup rather than its own -- USERNAME_REGEX, USERNAME_MAX_LENGTH, RESERVED_USERNAMES and validator.isEmail, now exported from AuthController. Without them a workspace could mint accounts signup would refuse, claim unregistered reserved names, and mail arbitrary unvalidated addresses. Handle problems are 400 or 409 rather than a bare Error, which the server turns into a 500 and a deduped critical alarm -- an uppercase handle should not page on-call. Disable drops sessions through SessionStore.removeByUuid rather than a raw DELETE. The store invalidates every composite cache key; without that a disabled member kept authenticating from cache for the session TTL, which is exactly the "takes effect on the next request, not after a cache TTL" property disable is supposed to have. Revoking also preserves last_ip/last_user_agent, which the member-facing audit view reads. Audit writes live in TeamService at the point of each action rather than in the route, so a caller reaching the service directly cannot skip them, and the SQL lives in TeamStore. Audit reads map internal user ids to usernames, and remain readable by the owner after the workspace is soft-deleted -- otherwise the delete_team entry was written and immediately unreachable. teams_enabled gates route registration through an optional isEnabled() the server honours, so with it off the paths do not exist rather than existing and refusing. It does not gate DDL. TeamIsolation.http.test.ts asserts the negative the feature rests on: the workspace manages accounts and cannot read them, including through a full-access token and after the member is disabled. It asserts outcomes rather than the absence of an implicator.
69 lines
3.0 KiB
TypeScript
69 lines
3.0 KiB
TypeScript
/*
|
|
* Copyright (C) 2024-present Puter Technologies Inc.
|
|
*
|
|
* This file is part of Puter.
|
|
*
|
|
* Puter is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published
|
|
* by the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU Affero General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Affero General Public License
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
import { AppController } from './apps/AppController.js';
|
|
import { AppFeedbackController } from './feedback/AppFeedbackController.js';
|
|
import { AuthController } from './auth/AuthController.js';
|
|
import { BroadcastController } from './broadcast/BroadcastController.js';
|
|
import { DesktopController } from './desktop/DesktopController.js';
|
|
import { DriverController } from './drivers/DriverController.js';
|
|
import { EventsController } from './events/EventsController.js';
|
|
import { FSController } from './fs/FSController.js';
|
|
import { HomepageController } from './homepage/HomepageController.js';
|
|
import { HostingController } from './hosting/HostingController.js';
|
|
import { LegacyFSController } from './fs/LegacyFSController.js';
|
|
import { NotificationController } from './notification/NotificationController.js';
|
|
import { OIDCController } from './oidc/OIDCController.js';
|
|
import { PuterAIController } from './puterai/PuterAIController.js';
|
|
import { ShareController } from './share/ShareController.js';
|
|
import { TeamController } from './team/TeamController.js';
|
|
import { StaticAssetsController } from './static/StaticAssetsController.js';
|
|
import { StaticPagesController } from './static/StaticPagesController.js';
|
|
import { SystemController } from './system/SystemController.js';
|
|
import { WebDAVController } from './webdav/WebDAVController.js';
|
|
import { WispController } from './wisp/WispController.js';
|
|
import type { IPuterControllerRegistry } from './types.js';
|
|
import { PeerController } from './peer/PeerController.js';
|
|
|
|
export const puterControllers = {
|
|
staticAssets: StaticAssetsController,
|
|
staticPages: StaticPagesController,
|
|
auth: AuthController,
|
|
apps: AppController,
|
|
appFeedback: AppFeedbackController,
|
|
desktop: DesktopController,
|
|
hosting: HostingController,
|
|
system: SystemController,
|
|
fs: FSController,
|
|
legacyFs: LegacyFSController,
|
|
puterAi: PuterAIController,
|
|
drivers: DriverController,
|
|
broadcast: BroadcastController,
|
|
notification: NotificationController,
|
|
events: EventsController,
|
|
share: ShareController,
|
|
team: TeamController,
|
|
webdav: WebDAVController,
|
|
oidc: OIDCController,
|
|
wisp: WispController,
|
|
peer: PeerController,
|
|
// Last so its catch-all static fallback doesn't shadow earlier routes.
|
|
homepage: HomepageController,
|
|
} satisfies IPuterControllerRegistry;
|