Skip to content

Commit 58d734c

Browse files
committed
fix(mothership): fix table and knowledgebase BOLA in resource attachment resolution
1 parent 74bc60c commit 58d734c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

apps/sim/lib/copilot/chat/process-contents.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -721,15 +721,15 @@ export async function resolveActiveResourceContext(
721721
case 'knowledgebase': {
722722
const ctx = await processKnowledgeFromDb(
723723
resourceId,
724-
undefined,
724+
userId,
725725
'@active_resource',
726726
workspaceId
727727
)
728728
if (!ctx) return null
729729
return { type: 'active_resource', tag: '@active_resource', content: ctx.content }
730730
}
731731
case 'table': {
732-
return await resolveTableResource(resourceId)
732+
return await resolveTableResource(resourceId, workspaceId)
733733
}
734734
case 'file': {
735735
return await resolveFileResource(resourceId, workspaceId)
@@ -745,9 +745,13 @@ export async function resolveActiveResourceContext(
745745
return null
746746
}
747747
}
748-
async function resolveTableResource(tableId: string): Promise<AgentContext | null> {
748+
async function resolveTableResource(
749+
tableId: string,
750+
workspaceId: string
751+
): Promise<AgentContext | null> {
749752
const table = await getTableById(tableId)
750753
if (!table) return null
754+
if (table.workspaceId !== workspaceId) return null
751755
return {
752756
type: 'active_resource',
753757
tag: '@active_resource',

0 commit comments

Comments
 (0)