Skip to content

feat(auth): pin the slack install to one workspace via SLACK_TEAM_ID - #202

Open
github-actions[bot] wants to merge 7 commits into
mainfrom
refactor/provider-agnostic-connections
Open

feat(auth): pin the slack install to one workspace via SLACK_TEAM_ID#202
github-actions[bot] wants to merge 7 commits into
mainfrom
refactor/provider-agnostic-connections

Conversation

@github-actions

@github-actions github-actions Bot commented Sep 2, 2026

Copy link
Copy Markdown
Contributor

Opened automatically when refactor/provider-agnostic-connections was pushed.

The title is written from the diff and rewritten as you push, because this is squashed onto main and the title becomes the commit subject and the changelog line. Retitle it yourself and it is yours — the automation stops touching it.


Summary by cubic

Pins Slack installs to the optional SLACK_TEAM_ID workspace instead of whichever workspace the browser session has open; when unset, the existing any-workspace behavior remains. Mismatched OAuth callbacks now fail before writing or replacing Slack grants, and the Slack-only connection guard is now provider-agnostic for future providers.

  • Validates SLACK_TEAM_ID at boot and rejects subdomains and enterprise IDs.
  • Uses provider IDs in GUARDED_CONNECTIONS for shared checks across connection and callback endpoints.
  • Renames the scope display to provider-neutral ScopeGroups, with Slack-specific copy supplied by the page and updated examples.

Written for commit a97b31e. Summary will update on new commits.

Review in cubic

A workspace subdomain is the obvious thing to paste, and Slack then refuses the
install with an error that names neither the variable nor the reason. The value
is checked at boot instead, next to the pair() check that already refuses half a
credential pair.

Unset stays fine, because pinning the workspace is optional.
@vercel

vercel Bot commented Sep 2, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
crm-agent Ready Ready Preview Sep 2, 2026 9:32am UTC
crm-api Ready Ready Preview Sep 2, 2026 9:32am UTC
crm-app Ready Ready Preview Sep 2, 2026 9:32am UTC

Request Review

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 12 files

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread packages/auth/src/auth.ts
Comment thread packages/auth/src/env.ts Outdated
The value is sent to Slack as the workspace to install into, and it is matched
against the team id the callback reports. An E... enterprise id matches neither,
so it refused every install at the callback rather than at boot.

rememberSlackInstall also keys the workspace grant on the team id, so an
enterprise id can never name a row this app writes.
SLACK_TEAM_ID only asked Slack to pick the workspace. The callback was accepted
whatever workspace it reported, so an install into a second workspace stored its
own SlackInstallation, and replaceSlackConnection then deleted the pinned
workspace's grant and every other Slack account row.

The token exchange names the workspace it installed into, so the callback is
refused before rememberSlackInstall writes anything.
This branch renames slack-scope-groups.tsx to scope-groups.tsx, so the example
in AGENTS.md named a file that no longer exists once it lands. The example now
matches the real component and its real call site, including the caption prop
that keeps the Slack wording out of a component another provider will reuse.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread AGENTS.md Outdated
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