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';
|
||||
|
||||
|
||||
@@ -23777,6 +23777,15 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/busboy@npm:^1.5.0":
|
||||
version: 1.5.4
|
||||
resolution: "@types/busboy@npm:1.5.4"
|
||||
dependencies:
|
||||
"@types/node": "npm:*"
|
||||
checksum: 10c0/0bdd209069a445d5a71277e558978ec0db1b1a3d108335da96477d017177ae349c4d81d604db0bea19e3c99c10af2d60dbac20e36cef7cb7a517e5a4760738bd
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/bytes@npm:^3.1.1":
|
||||
version: 3.1.4
|
||||
resolution: "@types/bytes@npm:3.1.4"
|
||||
@@ -24232,15 +24241,16 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/graphql-upload@npm:^8.0.12":
|
||||
version: 8.0.12
|
||||
resolution: "@types/graphql-upload@npm:8.0.12"
|
||||
"@types/graphql-upload@npm:^16.0.7":
|
||||
version: 16.0.7
|
||||
resolution: "@types/graphql-upload@npm:16.0.7"
|
||||
dependencies:
|
||||
"@types/express": "npm:*"
|
||||
"@types/koa": "npm:*"
|
||||
"@types/node": "npm:*"
|
||||
fs-capacitor: "npm:^8.0.0"
|
||||
graphql: "npm:0.13.1 - 16"
|
||||
checksum: 10c0/f9055d03aa3b4d751c3989afee0a7baf3131a945573bd97ef8996cdf0ec79e6e8e5bf16e7b6d69f353fdf4f0dfaa158e751c059928e2149974120212665e391d
|
||||
graphql: "npm:^16.3.0"
|
||||
checksum: 10c0/ed6118873e66a5949c50a37b13d6f823d28a38a2ec54f23b334027e80f8988643c41976542c99185a24dde0847688183e9eddb913695e6068887b33f8237d070
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -25000,6 +25010,13 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/object-path@npm:^0.11.1":
|
||||
version: 0.11.4
|
||||
resolution: "@types/object-path@npm:0.11.4"
|
||||
checksum: 10c0/fb7f71b170013cf23d323782f12d25e8fa3e2d4048ee3d4d71ca7fe9c553ceeaaa720560bae9925a1c6b893f6d02bbaefad6d68be52c0bd6b136722a5baba77d
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"@types/openid-client@npm:^3.7.0":
|
||||
version: 3.7.0
|
||||
resolution: "@types/openid-client@npm:3.7.0"
|
||||
@@ -29340,15 +29357,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"busboy@npm:^0.3.1":
|
||||
version: 0.3.1
|
||||
resolution: "busboy@npm:0.3.1"
|
||||
dependencies:
|
||||
dicer: "npm:0.3.0"
|
||||
checksum: 10c0/15b3382816f657302956ba68e48342891b4f36ae1164f1ad47d96302dd2cda634672513d03c7e5dde0dc90e2889becf3fa32f9b3b391d0f8ab4a5a675b5b5581
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"bytes@npm:3.1.2, bytes@npm:^3.1.2":
|
||||
version: 3.1.2
|
||||
resolution: "bytes@npm:3.1.2"
|
||||
@@ -32737,15 +32745,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"dicer@npm:0.3.0":
|
||||
version: 0.3.0
|
||||
resolution: "dicer@npm:0.3.0"
|
||||
dependencies:
|
||||
streamsearch: "npm:0.1.2"
|
||||
checksum: 10c0/4486f0448233145216cfadd5f6bbb4c26c3a28824da5344322b06051632e99d6af2b44f893fa8b30f1749ad175b4e565d301c760d0437226d9e41ccdb6546f35
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"didyoumean@npm:^1.2.2":
|
||||
version: 1.2.2
|
||||
resolution: "didyoumean@npm:1.2.2"
|
||||
@@ -36454,13 +36453,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fs-capacitor@npm:^6.2.0":
|
||||
version: 6.2.0
|
||||
resolution: "fs-capacitor@npm:6.2.0"
|
||||
checksum: 10c0/68443988ca28f734339f8346316a224b69af1b9bf8a3d8c7b649bc410d3d36dc145536f8e8ca5225fb5589f67a7502f4666a3a63670592c7d0c843bba4b3daca
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"fs-capacitor@npm:^8.0.0":
|
||||
version: 8.0.0
|
||||
resolution: "fs-capacitor@npm:8.0.0"
|
||||
@@ -37575,17 +37567,27 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"graphql-upload@npm:13.0.0":
|
||||
version: 13.0.0
|
||||
resolution: "graphql-upload@npm:13.0.0"
|
||||
"graphql-upload@npm:16.0.2":
|
||||
version: 16.0.2
|
||||
resolution: "graphql-upload@npm:16.0.2"
|
||||
dependencies:
|
||||
busboy: "npm:^0.3.1"
|
||||
fs-capacitor: "npm:^6.2.0"
|
||||
http-errors: "npm:^1.8.1"
|
||||
"@types/busboy": "npm:^1.5.0"
|
||||
"@types/node": "npm:*"
|
||||
"@types/object-path": "npm:^0.11.1"
|
||||
busboy: "npm:^1.6.0"
|
||||
fs-capacitor: "npm:^8.0.0"
|
||||
http-errors: "npm:^2.0.0"
|
||||
object-path: "npm:^0.11.8"
|
||||
peerDependencies:
|
||||
graphql: 0.13.1 - 16
|
||||
checksum: 10c0/487936b1cbeead5e630b057355b408e4852e5d605bf452dd21bc1a1cf29923d4c3ee567257c4469bcd18989f983bdb608b8c9319d3fa738e43fff318ea6f96e8
|
||||
"@types/express": ^4.0.29
|
||||
"@types/koa": ^2.11.4
|
||||
graphql: ^16.3.0
|
||||
peerDependenciesMeta:
|
||||
"@types/express":
|
||||
optional: true
|
||||
"@types/koa":
|
||||
optional: true
|
||||
checksum: 10c0/292e786cc20cb1edc1744dd12a40be17955cf66f7e0ebd47ed69a2570b01c19d3f631d7353d1329f80f666ac39bdafc70d3b46ed8c26d9ce72abe46d77102503
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
@@ -38545,7 +38547,7 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"http-errors@npm:^1.8.1, http-errors@npm:~1.8.0":
|
||||
"http-errors@npm:~1.8.0":
|
||||
version: 1.8.1
|
||||
resolution: "http-errors@npm:1.8.1"
|
||||
dependencies:
|
||||
@@ -54169,13 +54171,6 @@ __metadata:
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"streamsearch@npm:0.1.2":
|
||||
version: 0.1.2
|
||||
resolution: "streamsearch@npm:0.1.2"
|
||||
checksum: 10c0/408a3db5b5643c1d6eb65c9d8ccc011b4857bfca41946d808b7f165b5b85f47755b2ff56ec1c4bbbeb5a496afcde9adfea12f9f67bd09ff3f04ae3f1f58d37c6
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"streamsearch@npm:^1.1.0":
|
||||
version: 1.1.0
|
||||
resolution: "streamsearch@npm:1.1.0"
|
||||
@@ -56337,7 +56332,7 @@ __metadata:
|
||||
"@types/dompurify": "npm:^3.0.5"
|
||||
"@types/express": "npm:^4.17.13"
|
||||
"@types/express-session": "npm:^1.18.0"
|
||||
"@types/graphql-upload": "npm:^8.0.12"
|
||||
"@types/graphql-upload": "npm:^16.0.7"
|
||||
"@types/html-to-text": "npm:^9.0.4"
|
||||
"@types/lodash.chunk": "npm:^4.2.9"
|
||||
"@types/lodash.differencewith": "npm:^4.5.9"
|
||||
@@ -56402,7 +56397,7 @@ __metadata:
|
||||
graphql-subscriptions: "npm:2.0.0"
|
||||
graphql-tag: "npm:2.12.6"
|
||||
graphql-type-json: "npm:0.3.2"
|
||||
graphql-upload: "npm:13.0.0"
|
||||
graphql-upload: "npm:16.0.2"
|
||||
graphql-yoga: "npm:4.0.5"
|
||||
html-to-text: "npm:^9.0.5"
|
||||
imapflow: "npm:1.1.0"
|
||||
|
||||
Reference in New Issue
Block a user