Skip to content

feat(access-control): per-group chat-deploy auth modes + polish#5818

Merged
waleedlatif1 merged 5 commits into
stagingfrom
feat/chat-deploy-auth-modes
Jul 21, 2026
Merged

feat(access-control): per-group chat-deploy auth modes + polish#5818
waleedlatif1 merged 5 commits into
stagingfrom
feat/chat-deploy-auth-modes

Conversation

@waleedlatif1

Copy link
Copy Markdown
Collaborator

Summary

  • Add a per-permission-group "Auth modes chat deployments may use" control in the Access Control group's Platform tab, mirroring the existing public-file-share auth-mode control. Admins can now restrict which chat auth modes are allowed (i.e. disable Public, Password, Email, or SSO).
  • Enforced server-side on chat create (POST /api/chat) and update (PATCH /api/chat/manage/[id]) via a new validateChatDeployAuth (throws ChatDeployAuthNotAllowedError → 403), reusing the same getUserPermissionConfig resolver the file-share gate uses.
  • The chat deploy modal's "Access control" options are filtered to the allowed set (the currently-saved mode stays visible so existing state always shows; the route remains the source of truth).
  • Remove the dead Template deploy option (hideDeployTemplate had no consumer anywhere).
  • Shrink the Access Control block permission icons (size-[9px]) so they no longer touch their tile borders, and normalize the tiles to the size-[16px] shorthand.

Implementation notes

  • New config field allowedChatDeployAuthTypes (ShareAuthType[] | null, null = all allowed) added to permissionGroupConfigSchema, PermissionGroupConfig, DEFAULT_PERMISSION_GROUP_CONFIG, parsePermissionGroupConfig, and the permissionGroupFullConfigSchema contract. No DB migration — config is a JSONB blob and the parser defaults the field for existing rows.
  • Enforcement mirrors validatePublicFileSharing; no-ops for non-enterprise / access-control-disabled orgs.

Type of Change

  • Feature + cleanup

Testing

  • Added unit tests for validateChatDeployAuth (allow-list hit/miss, null = all, non-enterprise no-op) and 403 enforcement tests on both chat create and update routes. Full suite: 87 passing.
  • tsc, biome, and check:api-validation all clean.

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

- Add a per-permission-group 'Auth modes chat deployments may use'
  control, mirroring the existing public-file-share auth-mode control,
  so admins can disable specific chat auth modes (Public, Password, ...)
- Enforce it server-side on chat create/update via validateChatDeployAuth
  (ChatDeployAuthNotAllowedError -> 403), and filter the chat deploy UI's
  Access-control options to the allowed set (keeping the saved mode visible)
- Remove the dead 'Template' deploy option (hideDeployTemplate had no consumer)
- Shrink access-control block permission icons (size-[9px]) so they no
  longer touch their tile borders; normalize the tiles to size-[16px]
@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped Jul 21, 2026 9:39pm

Request Review

@cursor

cursor Bot commented Jul 21, 2026

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes chat deployment authentication policy on create/update and in copilot deploy paths; misconfiguration could block deployments or leave grandfathered modes in place, but behavior mirrors existing file-share gates with tests.

Overview
Adds per-permission-group control over which chat deployment auth modes (Public, Password, Email, SSO) members may use, parallel to the existing public file-share auth allow-list.

Config & admin UI: New allowedChatDeployAuthTypes on permission group config (replaces unused hideDeployTemplate). Access Control’s Platform tab gets a Chat section with a multi-select for allowed modes; empty selections are blocked so admins must use Hide Chat to disable deploy entirely. File-share auth picker gets the same “at least one mode” guard.

Enforcement: New validateChatDeployAuth / ChatDeployAuthNotAllowedError gates chat create (POST /api/chat), update (PATCH /api/chat/manage/[id]) when authType changes, and copilot chat deploy—unchanged saved modes stay editable (grandfathered). Blocked modes return 403.

Deploy modal: Access control options are filtered via usePermissionConfig; the chat’s saved auth type stays visible/selectable even if newly disallowed.

Minor UI polish: smaller block icons in permission group tiles (size-[9px]).

Reviewed by Cursor Bugbot for commit 97b8db6. Configure here.

Comment thread apps/sim/app/api/chat/route.ts
@greptile-apps

greptile-apps Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds per-group controls for chat deployment authentication modes. The main changes are:

  • Adds configuration and admin UI for allowed chat authentication modes.
  • Enforces the allow-list in create, update, and Copilot deployment paths.
  • Filters deployment modal options while preserving saved modes.
  • Removes the unused template deployment option and adjusts permission icons.

Confidence Score: 5/5

This looks safe to merge.

  • The latest fixes cover REST and Copilot deployment paths.
  • First deployments and changed authentication modes are checked against the effective permission configuration.
  • No blocking issue remains within the follow-up scope.

Important Files Changed

Filename Overview
apps/sim/app/api/chat/route.ts Enforces the configured authentication-mode allow-list before creating a chat deployment.
apps/sim/app/api/chat/manage/[id]/route.ts Validates authentication-mode changes while allowing unrelated edits to saved deployments.
apps/sim/lib/copilot/tools/handlers/deployment/deploy.ts Applies the same authentication-mode enforcement to Copilot-driven chat deployments.
apps/sim/ee/access-control/utils/permission-check.ts Adds the shared validator for effective permission-group chat authentication settings.
apps/sim/app/workspace/[workspaceId]/w/[workflowId]/components/panel/components/deploy/components/deploy-modal/components/chat/chat.tsx Filters selectable authentication modes and keeps a saved mode visible for existing deployments.
apps/sim/lib/permission-groups/types.ts Adds the new allow-list to permission configuration types, defaults, and parsing.

Reviews (4): Last reviewed commit: "fix(access-control): never leave a new c..." | Re-trigger Greptile

…auth

- Enforce validateChatDeployAuth on the copilot executeDeployChat path
  (it called performChatDeploy directly, bypassing the HTTP-route gate)
- Enforce on update only when the auth mode actually changes, so a
  grandfathered saved mode can be re-saved (e.g. title-only edits)
- Chat deploy UI now grandfathers only the saved mode, not the unsaved
  'public' default; snap a new chat off a disallowed default to the first
  allowed mode so it can't submit a value the server rejects
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

…nv is off

Treat savedAuthType === 'sso' as SSO-enabled when building auth options so an
existing SSO chat isn't dropped and silently downgraded by the snap effect.
Mirrors the file-share modal.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

Guard the chat-deploy and file-share auth-mode multiselects so the last
allowed mode can't be removed while the feature is enabled — an empty
allow-list would silently block every deployment/share. Disabling the
feature entirely stays the job of the Hide Chat toggle / Public Sharing
checkbox.
… modes

Surface SSO in the chat deploy options whenever the permission group
explicitly allows it (not only when the env flag is on or the chat is
saved as SSO), so a group whose only allowed mode is SSO can't produce an
empty option set that strands a new chat on a disallowed default. Also
drop a redundant trailing comment in the copilot deploy handler.
@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@greptile

@waleedlatif1

Copy link
Copy Markdown
Collaborator Author

@cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 97b8db6. Configure here.

@waleedlatif1
waleedlatif1 merged commit 7ee8f46 into staging Jul 21, 2026
20 checks passed
@waleedlatif1
waleedlatif1 deleted the feat/chat-deploy-auth-modes branch July 21, 2026 21:46
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