Skip to content

feat(den): support Entra SSO auto-join#1895

Closed
pascalandr wants to merge 11 commits into
different-ai:devfrom
Pagecran:pr/entra-sso-auto-join
Closed

feat(den): support Entra SSO auto-join#1895
pascalandr wants to merge 11 commits into
different-ai:devfrom
Pagecran:pr/entra-sso-auto-join

Conversation

@pascalandr

@pascalandr pascalandr commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

Isolates Entra SSO auto-join hardening: Microsoft provider env/config, profile mapping, auto-join membership helper, auth/org integration, and tests.

Verification

  • bun test ee/apps/den-api/test/entra-sso.test.ts — passed, 14 tests.
  • git diff --name-status upstream/dev...pr/entra-sso-auto-join reviewed; no tasks/**, docs/scrs/**, codemaps, or generated app-version included.

Known risks

  • Full Den API build was not rerun on this branch; focused Entra tests passed.

Linked issues

@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

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

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Jun 10, 2026 4:54pm

@vercel

vercel Bot commented May 22, 2026

Copy link
Copy Markdown
Contributor

@pascalandr is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

Merge upstream/dev into pr/entra-sso-auto-join and preserve soft member removal behavior.
Accept invite tokens as well as invitation IDs, claim placeholder invitation members without duplicates, run member-change hooks for new Entra SSO joins, and restore the high dev-mode sign-up rate limit.

@cubic-dev-ai cubic-dev-ai 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.

2 issues found across 6 files

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="ee/apps/den-api/src/orgs.ts">

<violation number="1" location="ee/apps/den-api/src/orgs.ts:650">
P2: Post-member-change hooks are skipped when an invitation is accepted via the placeholder-claim path. Claiming a placeholder member sets `createdMember = false`, so downstream hooks (provisioning, audit, seat tracking) never fire for this common invitation acceptance path. Previously hooks ran unconditionally after any invitation acceptance.</violation>
</file>

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

Re-trigger cubic

Comment thread ee/apps/den-api/src/orgs.ts Outdated
const member = await acceptInvitation(invitation, input.userId)
await runPostOrganizationMemberChangeHooks({ organizationId: invitation.organizationId, memberId: member.id, change: "added" })
const accepted = await acceptInvitation(invitation, input.userId)
if (accepted.createdMember) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2: Post-member-change hooks are skipped when an invitation is accepted via the placeholder-claim path. Claiming a placeholder member sets createdMember = false, so downstream hooks (provisioning, audit, seat tracking) never fire for this common invitation acceptance path. Previously hooks ran unconditionally after any invitation acceptance.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At ee/apps/den-api/src/orgs.ts, line 650:

<comment>Post-member-change hooks are skipped when an invitation is accepted via the placeholder-claim path. Claiming a placeholder member sets `createdMember = false`, so downstream hooks (provisioning, audit, seat tracking) never fire for this common invitation acceptance path. Previously hooks ran unconditionally after any invitation acceptance.</comment>

<file context>
@@ -514,20 +646,17 @@ export async function acceptInvitationForUser(input: {
-  const member = await acceptInvitation(invitation, input.userId)
-  await runPostOrganizationMemberChangeHooks({ organizationId: invitation.organizationId, memberId: member.id, change: "added" })
+  const accepted = await acceptInvitation(invitation, input.userId)
+  if (accepted.createdMember) {
+    await runPostOrganizationMemberChangeHooks({ organizationId: invitation.organizationId, memberId: accepted.member.id, change: "added" })
+  }
</file context>

@pascalandr pascalandr Jun 10, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks — cubic correctly identified that the acceptance transition must run the post-member-change hooks. I tightened this in da92d43: placeholder invite creation no longer fires member-added hooks, and the placeholder-claim acceptance path still sets createdMember so provisioning/audit/seat hooks run exactly on acceptance. Regression: bun test --conditions development ee/apps/den-api/test/org-invitation-lifecycle.test.ts (4 pass). Typecheck: pnpm --filter @openwork-ee/den-api exec tsc --noEmit.

Annotate invitation member lookup helpers as nullable so the placeholder-claim flow typechecks while preserving duplicate-member prevention.
Add mocked Den API invitation lifecycle tests for preview by invite token, accept by invite token, placeholder-member claim without duplicate active members, and retained team association.
Run invitation placeholder claims through post member-change hooks, keep repeated removals idempotent with active-member guards, and fix nullable placeholder member typing surfaced by Den API typecheck.
Ensure placeholder invitation creation is not treated as a member-added lifecycle event while placeholder claim on acceptance still emits the post-member-change hook with regression coverage.
Add removedAt filters to active organization, Entra auto-join, and plugin grant target member lookups so stale removed rows cannot regain access.
@pascalandr

Copy link
Copy Markdown
Contributor Author

Superseded by the clean replacement PR #2174.

@pascalandr pascalandr closed this Jun 11, 2026
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.

[Question] Is it possible to use the program in an air-gapped network?

1 participant