Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
16d7d99
chore: merge release v3.16.2 back to main [skip ci]
github-actions[bot] Apr 6, 2026
cb0e6af
fix(google-workspace): clarify that email filter variables apply to c…
tofikwest Apr 7, 2026
ecc04a6
Merge pull request #2469 from trycompai/fix/gws-variable-labels
tofikwest Apr 7, 2026
52bb3f6
fix(documents): allow CSV and Excel file uploads for evidence forms
tofikwest Apr 7, 2026
c440317
fix(documents): fix RBAC schema, matrix validation, and step 3 MIME m…
tofikwest Apr 7, 2026
5a90324
fix(notifications): dont send task reminders to employees
github-actions[bot] Apr 7, 2026
e1b29a5
fix(portal): sync activeOrganizationId when navigating between orgs (…
github-actions[bot] Apr 7, 2026
f06febb
fix(documents): use lenient row schema so file upload bypasses row va…
tofikwest Apr 7, 2026
edababd
Merge branch 'main' into worktree-fix+evidence-upload-csv-xlsx
tofikwest Apr 7, 2026
7ded778
fix(documents): use original row index for validation error paths
tofikwest Apr 7, 2026
da7d2d0
chore(deps): update tiptap, lucide-react, electron and remove unused …
github-actions[bot] Apr 7, 2026
6511fa1
Merge branch 'main' into worktree-fix+evidence-upload-csv-xlsx
tofikwest Apr 7, 2026
77d71bd
fix(documents): fix TS strict index access on matrix row
tofikwest Apr 7, 2026
68195a3
Merge pull request #2471 from trycompai/worktree-fix+evidence-upload-…
tofikwest Apr 7, 2026
b3d26e7
feat(trigger): add org tags to all trigger job runs (#2476)
Marfuen Apr 7, 2026
3574357
fix(ci): pin bun version in trigger workflows and regenerate lockfile…
github-actions[bot] Apr 7, 2026
4650bd9
fix(ci): pin bun version in trigger workflows and regenerate lockfile
github-actions[bot] Apr 7, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions apps/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
"@tanstack/react-form": "^1.23.8",
"@tanstack/react-query": "^5.90.7",
"@tanstack/react-table": "^8.21.3",
"@tiptap/extension-mention": "3.16.0",
"@tiptap/extension-table": "3.16.0",
"@tiptap/react": "3.16.0",
"@tiptap/extension-mention": "3.22.1",
"@tiptap/extension-table": "3.22.1",
"@tiptap/react": "3.22.1",
"@trigger.dev/react-hooks": "4.4.3",
"@trigger.dev/sdk": "4.4.3",
"@trycompai/auth": "workspace:*",
Expand Down Expand Up @@ -96,7 +96,7 @@
"framer-motion": "^12.18.1",
"geist": "^1.3.1",
"jspdf": "^4.2.0",
"lucide-react": "^0.577.0",
"lucide-react": "^1.7.0",
"mammoth": "^1.11.0",
"motion": "^12.35.0",
"nanoid": "^5.1.6",
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/ai-elements/reasoning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ export const ReasoningContent = memo(
)}
{...props}
>
<Streamdown plugins={streamdownPlugins} {...props}>
<Streamdown plugins={streamdownPlugins}>
{children}
</Streamdown>
</CollapsibleContent>
Expand Down
4 changes: 2 additions & 2 deletions apps/app/src/trigger/tasks/task/task-schedule.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,11 +235,11 @@ export const taskSchedule = schedules.task({
: ('todo' as const);

// Check if user is unsubscribed
const isUnsubscribed = await isUserUnsubscribed(db, recipient.email, 'taskAssignments', recipient.task.organizationId);
const isUnsubscribed = await isUserUnsubscribed(db, recipient.email, 'taskReminders', recipient.task.organizationId);

if (isUnsubscribed) {
logger.info(
`Skipping notification: user ${recipient.email} is unsubscribed from task assignments`,
`Skipping notification: user ${recipient.email} is unsubscribed from task reminders`,
);
return;
}
Expand Down
4 changes: 2 additions & 2 deletions apps/framework-editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
"@tailwindcss/postcss": "^4.1.17",
"@tanstack/react-table": "^8.21.3",
"@tanstack/react-virtual": "^3.13.8",
"@tiptap/react": "^3.13.0",
"@tiptap/react": "3.22.1",
"@trycompai/company": "workspace:*",
"@trycompai/db": "workspace:*",
"@trycompai/ui": "workspace:*",
"better-auth": "^1.4.22",
"framer-motion": "^12.23.9",
"lucide-react": "^0.518.0",
"lucide-react": "^1.7.0",
"next": "^16.2.0",
"nuqs": "^2.4.3",
"react": "^19.0.0",
Expand Down
33 changes: 33 additions & 0 deletions apps/portal/src/app/(app)/(home)/[orgId]/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { auth } from '@/app/lib/auth';
import { headers } from 'next/headers';
import { redirect } from 'next/navigation';

export default async function OrgLayout({
children,
params,
}: {
children: React.ReactNode;
params: Promise<{ orgId: string }>;
}) {
const { orgId } = await params;
const requestHeaders = await headers();

const session = await auth.api.getSession({ headers: requestHeaders });

if (!session?.user) {
return redirect('/auth');
}

// Sync activeOrganizationId if it doesn't match the URL's orgId.
// Without this, multi-org users get 403s because HybridAuthGuard
// resolves memberId from the session's activeOrganizationId, not the URL.
const currentActiveOrgId = session.session.activeOrganizationId;
if (!currentActiveOrgId || currentActiveOrgId !== orgId) {
await auth.api.setActiveOrganization({
headers: requestHeaders,
body: { organizationId: orgId },
});
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Silent failure of org switch renders children with wrong context

Medium Severity

The setActiveOrganization function silently swallows all errors in production, including network failures and non-OK API responses. This allows [orgId]/layout.tsx to render with a stale activeOrganizationId, leading to 403s or incorrect data from API calls, and making these issues undiagnosable without production logging.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit da7d2d0. Configure here.


return <>{children}</>;
}
31 changes: 31 additions & 0 deletions apps/portal/src/app/lib/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,44 @@ async function getSession(options: { headers: ReadonlyHeaders | Headers }): Prom
}
}

/**
* Set the active organization for the current session.
* Calls the API's better-auth organization endpoint so both
* server and client session state stay in sync.
*/
async function setActiveOrganization(options: {
headers: ReadonlyHeaders | Headers;
body: { organizationId: string };
}): Promise<void> {
try {
const response = await fetch(`${API_URL}/api/auth/organization/set-active`, {
method: 'POST',
headers: {
...headersToObject(options.headers),
'Content-Type': 'application/json',
},
body: JSON.stringify({ organizationId: options.body.organizationId }),
cache: 'no-store',
});

if (!response.ok && IS_DEVELOPMENT) {
console.error('[auth] Failed to set active organization:', response.status);
}
} catch (error) {
if (IS_DEVELOPMENT) {
console.error('[auth] Failed to set active organization:', error);
}
}
}

/**
* Auth object matching the interface used throughout the portal.
* All methods call the NestJS API — no local better-auth instance.
*/
export const auth = {
api: {
getSession,
setActiveOrganization,
},
};

Expand Down
Loading
Loading