fix: crash in HeaderParser in dicer. (#15963)
Resolves [Dependabot Alert 74](https://github.com/twentyhq/twenty/security/dependabot/74). Upgraded `graphql-upload` from `13.0.0` to `16.0.2`. Type exports changed. API remains the same. Tested the following upload flows: - profile picture - workspace logo - rich text editor (image, video, file) - record profile picture - file associated to record. They all work as intended, nothing breaks.
This commit is contained in:
+19
-7
@@ -1,7 +1,7 @@
|
||||
import { AdvancedTextEditor } from '@/advanced-text-editor/components/AdvancedTextEditor';
|
||||
import { useAdvancedTextEditor } from '@/advanced-text-editor/hooks/useAdvancedTextEditor';
|
||||
import { type Meta, type StoryObj } from '@storybook/react';
|
||||
import { expect, fn, userEvent } from '@storybook/test';
|
||||
import { expect, fn, userEvent, waitFor } from '@storybook/test';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { ComponentDecorator, RouterDecorator } from 'twenty-ui/testing';
|
||||
import { I18nFrontDecorator } from '~/testing/decorators/I18nFrontDecorator';
|
||||
@@ -395,8 +395,13 @@ export const WithLists: Story = {
|
||||
},
|
||||
play: async ({ canvasElement, step }) => {
|
||||
await step('Verify bullet list is rendered', async () => {
|
||||
await waitFor(() =>
|
||||
expect(canvasElement.querySelectorAll('ul li').length).toBeGreaterThan(
|
||||
0,
|
||||
),
|
||||
);
|
||||
|
||||
const listItems = canvasElement.querySelectorAll('ul li');
|
||||
expect(listItems.length).toBeGreaterThan(0);
|
||||
|
||||
const firstItem = listItems[0];
|
||||
expect(firstItem).toBeInTheDocument();
|
||||
@@ -404,8 +409,13 @@ export const WithLists: Story = {
|
||||
});
|
||||
|
||||
await step('Verify ordered list is rendered', async () => {
|
||||
await waitFor(() =>
|
||||
expect(canvasElement.querySelectorAll('ol li').length).toBeGreaterThan(
|
||||
0,
|
||||
),
|
||||
);
|
||||
|
||||
const orderedListItems = canvasElement.querySelectorAll('ol li');
|
||||
expect(orderedListItems.length).toBeGreaterThan(0);
|
||||
|
||||
const firstOrderedItem = orderedListItems[0];
|
||||
expect(firstOrderedItem).toBeInTheDocument();
|
||||
@@ -433,11 +443,13 @@ export const WithLists: Story = {
|
||||
const orderedList = canvasElement.querySelector('ol');
|
||||
expect(orderedList).toBeInTheDocument();
|
||||
|
||||
const bulletListItems = canvasElement.querySelectorAll('ul li');
|
||||
expect(bulletListItems.length).toBe(3);
|
||||
await waitFor(() =>
|
||||
expect(canvasElement.querySelectorAll('ul li').length).toBe(3),
|
||||
);
|
||||
|
||||
const orderedListItems = canvasElement.querySelectorAll('ol li');
|
||||
expect(orderedListItems.length).toBe(4);
|
||||
await waitFor(() =>
|
||||
expect(canvasElement.querySelectorAll('ol li').length).toBe(4),
|
||||
);
|
||||
});
|
||||
},
|
||||
};
|
||||
|
||||
@@ -110,7 +110,7 @@
|
||||
"graphql-subscriptions": "2.0.0",
|
||||
"graphql-tag": "2.12.6",
|
||||
"graphql-type-json": "0.3.2",
|
||||
"graphql-upload": "13.0.0",
|
||||
"graphql-upload": "16.0.2",
|
||||
"graphql-yoga": "4.0.5",
|
||||
"html-to-text": "^9.0.5",
|
||||
"imapflow": "1.1.0",
|
||||
@@ -185,7 +185,7 @@
|
||||
"@types/dompurify": "^3.0.5",
|
||||
"@types/express": "^4.17.13",
|
||||
"@types/express-session": "^1.18.0",
|
||||
"@types/graphql-upload": "^8.0.12",
|
||||
"@types/graphql-upload": "^16.0.7",
|
||||
"@types/html-to-text": "^9.0.4",
|
||||
"@types/lodash.chunk": "^4.2.9",
|
||||
"@types/lodash.differencewith": "^4.5.9",
|
||||
|
||||
+10
@@ -1,5 +1,15 @@
|
||||
import { Test, type TestingModule } from '@nestjs/testing';
|
||||
|
||||
jest.mock('graphql-upload/GraphQLUpload.mjs', () => ({
|
||||
__esModule: true,
|
||||
default: {},
|
||||
}));
|
||||
|
||||
jest.mock('graphql-upload/processRequest.mjs', () => ({
|
||||
__esModule: true,
|
||||
FileUpload: {},
|
||||
}));
|
||||
|
||||
import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
import { PermissionsService } from 'src/engine/metadata-modules/permissions/permissions.service';
|
||||
|
||||
+3
-1
@@ -1,10 +1,12 @@
|
||||
import { UseFilters, UseGuards, UsePipes } from '@nestjs/common';
|
||||
import { Args, Mutation, Resolver } from '@nestjs/graphql';
|
||||
|
||||
import { FileUpload, GraphQLUpload } from 'graphql-upload';
|
||||
import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
|
||||
|
||||
import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder.interface';
|
||||
|
||||
import type { FileUpload } from 'graphql-upload/processRequest.mjs';
|
||||
|
||||
import { SignedFileDTO } from 'src/engine/core-modules/file/file-upload/dtos/signed-file.dto';
|
||||
import { FileUploadService } from 'src/engine/core-modules/file/file-upload/services/file-upload.service';
|
||||
import { PreventNestToAutoLogGraphqlErrorsFilter } from 'src/engine/core-modules/graphql/filters/prevent-nest-to-auto-log-graphql-errors.filter';
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import { UseFilters, UseGuards, UsePipes } from '@nestjs/common';
|
||||
import { Args, Mutation, Resolver } from '@nestjs/graphql';
|
||||
|
||||
import { FileUpload, GraphQLUpload } from 'graphql-upload';
|
||||
import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
|
||||
|
||||
import type { FileUpload } from 'graphql-upload/processRequest.mjs';
|
||||
|
||||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars';
|
||||
import { FileDTO } from 'src/engine/core-modules/file/dtos/file.dto';
|
||||
|
||||
@@ -13,7 +13,7 @@ import crypto from 'crypto';
|
||||
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { GraphQLJSONObject } from 'graphql-type-json';
|
||||
import { FileUpload, GraphQLUpload } from 'graphql-upload';
|
||||
import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
|
||||
import { isDefined } from 'twenty-shared/utils';
|
||||
import { WorkspaceActivationStatus } from 'twenty-shared/workspace';
|
||||
import { In, Repository } from 'typeorm';
|
||||
@@ -21,6 +21,8 @@ import { In, Repository } from 'typeorm';
|
||||
import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder.interface';
|
||||
import { SupportDriver } from 'src/engine/core-modules/twenty-config/interfaces/support.interface';
|
||||
|
||||
import type { FileUpload } from 'graphql-upload/processRequest.mjs';
|
||||
|
||||
import {
|
||||
AuthException,
|
||||
AuthExceptionCode,
|
||||
|
||||
@@ -16,11 +16,13 @@ import {
|
||||
|
||||
import assert from 'assert';
|
||||
|
||||
import { FileUpload, GraphQLUpload } from 'graphql-upload';
|
||||
import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
|
||||
import { assertIsDefinedOrThrow, isDefined } from 'twenty-shared/utils';
|
||||
|
||||
import { FileFolder } from 'src/engine/core-modules/file/interfaces/file-folder.interface';
|
||||
|
||||
import type { FileUpload } from 'graphql-upload/processRequest.mjs';
|
||||
|
||||
import { BillingSubscriptionEntity } from 'src/engine/core-modules/billing/entities/billing-subscription.entity';
|
||||
import { BillingSubscriptionService } from 'src/engine/core-modules/billing/services/billing-subscription.service';
|
||||
import { DomainValidRecords } from 'src/engine/core-modules/dns-manager/dtos/domain-valid-records';
|
||||
|
||||
@@ -6,7 +6,7 @@ import fs from 'fs';
|
||||
import bytes from 'bytes';
|
||||
import { useContainer } from 'class-validator';
|
||||
import session from 'express-session';
|
||||
import { graphqlUploadExpress } from 'graphql-upload';
|
||||
import graphqlUploadExpress from 'graphql-upload/graphqlUploadExpress.mjs';
|
||||
|
||||
import { NodeEnvironment } from 'src/engine/core-modules/twenty-config/interfaces/node-environment.interface';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user