The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(server): timeline calendar events denied on the ORM v2 read path (#24403)
Félix Malfait8d4a11e49858
diff --git a/.github/workflows/ci-server.yaml b/.github/workflows/ci-server.yamlindex 8ea0c817d76..c03d703015a 100644--- a/.github/workflows/ci-server.yaml+++ b/.github/workflows/ci-server.yaml@@ -322,7 +322,7 @@ jobs:# the 16-way split the unflagged shards use.ORM_V2_SHARD_COUNTER: 5TEST_FORCED_FEATURE_FLAGS: ${{ matrix.orm-v2 && 'IS_ORM_V2_READ_PATH_ENABLED' || '' }}- ORM_V2_TEST_PATH_PATTERN: '(find-many|find-one|find-duplicates|group-by|composite-field-pagination|filter-by-relation-field|order-by-relation-field|nested-relation|soft-deleted-relation|relation-join-rls|object-records-permissions|merge-many|mutate-by-relation-field|mutation-relation-filter-rls|upsert|unique-field|object-generated|files-field)'+ ORM_V2_TEST_PATH_PATTERN: '(find-many|find-one|find-duplicates|group-by|composite-field-pagination|filter-by-relation-field|order-by-relation-field|nested-relation|soft-deleted-relation|relation-join-rls|object-records-permissions|merge-many|mutate-by-relation-field|mutation-relation-filter-rls|upsert|unique-field|object-generated|files-field|timeline-from-object-record)'steps:- name: Fetch custom Github Actions and base branch historyuses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1diff --git a/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts b/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.tsindex 38de45bafd5..d307d13952d 100644--- a/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts+++ b/packages/twenty-server/src/engine/core-modules/calendar/timeline-calendar-event.service.ts@@ -54,10 +54,19 @@ export class TimelineCalendarEventService {async () => {const offset = (page - 1) * pageSize;+ // Runs under a system auth context, which resolves no role, so without+ // this the participant relations (person, workspaceMember) are read with+ // empty permissions and denied for everyone. Channel-level redaction of+ // title and description below is what gates the caller's access.+ // TODO run under the caller's role via resolveRolePermissionConfig instead+ // of bypassing, once roles that cannot read person degrade to a redacted+ // timeline rather than a denied one+ // https://github.com/twentyhq/core-team-issues/issues/2777const calendarEventRepository =await this.globalWorkspaceOrmManager.getRepository<CalendarEventWorkspaceEntity>(workspaceId,'calendarEvent',+ { shouldBypassPermissionChecks: true },);const totalNumberOfCalendarEvents = await calendarEventRepository.count(