-
Notifications
You must be signed in to change notification settings - Fork 69
chore: fix vulnerabilities #796
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| legacy-peer-deps=true | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. переехали на react19, но |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| 'use strict'; | ||
|
|
||
| module.exports = { | ||
| extends: ['@commitlint/config-conventional'] | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| import path from 'path'; | ||
| import {TestCase as PlaywrightTestCase, TestResult as PlaywrightTestResult} from '@playwright/test/reporter'; | ||
| import sizeOf from 'image-size'; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| import {getImageSize} from '../../image-size'; | ||
| import _ from 'lodash'; | ||
| import stripAnsi from 'strip-ansi'; | ||
|
|
||
|
|
@@ -16,7 +16,6 @@ import { | |
| ImageFile, | ||
| ImageInfoDiff, | ||
| ImageInfoFull, ImageInfoNoRef, ImageInfoPageError, ImageInfoPageSuccess, ImageInfoSuccess, ImageInfoUpdated, | ||
| ImageSize, | ||
| TestError, TestStepCompressed, TestStepKey | ||
| } from '../../types'; | ||
| import type {CoordBounds} from 'looks-same'; | ||
|
|
@@ -58,6 +57,7 @@ export interface TestResultWithGuiStatus extends Omit<PlaywrightTestResult, 'sta | |
| } | ||
|
|
||
| const ANY_IMAGE_ENDING_REGEXP = new RegExp(Object.values(ImageTitleEnding).map(ending => `${ending}$`).join('|')); | ||
| const SCREENSHOT_COMPARISON_ERROR_REGEXP = /Screenshot comparison failed|expect\(.*\)\.toHaveScreenshot\(expected\) failed/; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. матчимся на оба текста скриншотного падения в разных версиях pwt, чтобы правильно покрасить цвет скриншотного ретрая |
||
|
|
||
| export const DEFAULT_DIFF_OPTIONS = { | ||
| diffColor: '#ff00ff' | ||
|
|
@@ -150,7 +150,7 @@ const getImageData = (attachment: PlaywrightAttachment | undefined): PlaywrightI | |
|
|
||
| return { | ||
| path: attachment.path as string, | ||
| size: !attachment.size ? _.pick(sizeOf(attachment.path as string), ['height', 'width']) as ImageSize : attachment.size, | ||
| size: attachment.size || getImageSize(attachment.path as string), | ||
| relativePath: attachment.relativePath || path.relative(process.cwd(), attachment.path as string) | ||
| }; | ||
| }; | ||
|
|
@@ -212,7 +212,7 @@ export class PlaywrightTestResultAdapter implements ReporterTestResult { | |
|
|
||
| if (/snapshot .*doesn't exist/.test(message) && message.includes('.png')) { | ||
| result.name = ErrorName.NO_REF_IMAGE; | ||
| } else if (message.includes('Screenshot comparison failed')) { | ||
| } else if (SCREENSHOT_COMPARISON_ERROR_REGEXP.test(message)) { | ||
| result.name = ErrorName.IMAGE_DIFF; | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,5 @@ | ||
| import crypto from 'crypto'; | ||
| import SparkMD5 from 'spark-md5'; | ||
| import {isEmpty, pick} from 'lodash'; | ||
| import url from 'url'; | ||
| import type {AxiosRequestConfig} from 'axios'; | ||
| import { | ||
| ERROR, | ||
|
|
@@ -30,7 +29,13 @@ import type { | |
| import type {ReporterTestResult} from './adapters/test-result'; | ||
|
|
||
| export const getShortMD5 = (str: string): string => { | ||
| return crypto.createHash('md5').update(str, 'ascii').digest('hex').substr(0, 7); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. удаляем, чтобы убрать |
||
| let asciiString = ''; | ||
|
|
||
| for (let index = 0; index < str.length; index++) { | ||
| asciiString += String.fromCharCode(str.charCodeAt(index) % 256); | ||
| } | ||
|
|
||
| return SparkMD5.hashBinary(asciiString).substring(0, 7); | ||
| }; | ||
|
|
||
| const statusPriority: TestStatus[] = [ | ||
|
|
@@ -191,9 +196,13 @@ export const isUrl = (str: string): boolean => { | |
| return false; | ||
| } | ||
|
|
||
| const parsedUrl = url.parse(str); | ||
| try { | ||
| const parsedUrl = new URL(str); | ||
|
|
||
| return !!parsedUrl.host && !!parsedUrl.protocol; | ||
| return Boolean(parsedUrl.host && parsedUrl.protocol); | ||
| } catch { | ||
| return false; | ||
| } | ||
| }; | ||
|
|
||
| export const fetchFile = async <T = unknown>(url: string, options?: AxiosRequestConfig) : Promise<{data: T | null, status: number | string, error?: unknown}> => { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -45,6 +45,7 @@ export const start = async (args: ServerArgs): Promise<ServerReadyData> => { | |
| const app = App.create(args); | ||
| const server = express(); | ||
|
|
||
| server.set('query parser', 'extended'); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. для обратной совместимости при переходе на express@5 |
||
| server.use(bodyParser.json({limit: MAX_REQUEST_SIZE})); | ||
|
|
||
| await guiApi.initServer(server); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import fs from 'fs'; | ||
| import {sync as probeImageSize} from 'probe-image-size'; | ||
| import type {ImageSize} from './types'; | ||
|
|
||
| const MAX_HEADER_SIZE = 512 * 1024; | ||
|
|
||
| export const getImageSize = (image: string | Buffer): ImageSize => { | ||
| let buffer: Buffer; | ||
|
|
||
| if (typeof image === 'string') { | ||
| const descriptor = fs.openSync(image, 'r'); | ||
| try { | ||
| buffer = Buffer.alloc(Math.min(fs.fstatSync(descriptor).size, MAX_HEADER_SIZE)); | ||
| fs.readSync(descriptor, buffer, 0, buffer.length, 0); | ||
|
Comment on lines
+13
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
For valid JPEGs containing multiple large ICC/EXIF APP segments, the SOF dimension marker can occur after the first 512 KiB. This truncates such files before passing them to Useful? React with 👍 / 👎. |
||
| } finally { | ||
| fs.closeSync(descriptor); | ||
| } | ||
| } else { | ||
| buffer = image; | ||
| } | ||
|
|
||
| const size = probeImageSize(buffer); | ||
| if (!size) { | ||
| throw new TypeError('Unsupported or invalid image'); | ||
| } | ||
|
|
||
| return {width: size.width, height: size.height}; | ||
| }; | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,11 +4,13 @@ import PropTypes from 'prop-types'; | |
| import {connect} from 'react-redux'; | ||
| import {Button, Icon, Label} from '@gravity-ui/uikit'; | ||
| import {isEmpty} from 'lodash'; | ||
| import {version} from '../../../../package.json'; | ||
| import packageJson from '../../../../package.json'; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. вебпак кидает ворнинги в старом формате: |
||
| import useLocalStorage from '@/static/hooks/useLocalStorage'; | ||
| import {LocalStorageKey, UiMode} from '@/constants/local-storage'; | ||
| import {useAnalytics} from '@/static/new-ui/hooks/useAnalytics'; | ||
|
|
||
| const {version} = packageJson; | ||
|
|
||
| function ReportInfo(props) { | ||
| const analytics = useAnalytics(); | ||
| const {gui, timestamp} = props; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import React from 'react'; | ||
| import {useDispatch, useSelector} from 'react-redux'; | ||
| import {useDispatch, useSelector} from '@/static/new-ui/modules/react-redux'; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. просто типизированная обертка, чтобы не описывать типы каждый раз |
||
| import {NumberInput, Button, Icon} from '@gravity-ui/uikit'; | ||
| import {Plus, Minus} from '@gravity-ui/icons'; | ||
| import styles from './index.module.css'; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,14 +19,10 @@ import {SettingsAction} from '@/static/modules/actions/settings'; | |
| import {ProcessingAction} from '@/static/modules/actions/processing'; | ||
| import {StaticAccepterAction} from '@/static/modules/actions/static-accepter'; | ||
| import type actionNames from '../action-names'; | ||
| import type defaultState from '../default-state'; | ||
| import type {Tree} from '../../../tests-tree-builder/base'; | ||
| import {FeaturesAction} from '@/static/modules/actions/features'; | ||
| import {SnapshotsAction} from '@/static/modules/actions/snapshots'; | ||
| import {BrowsersAction} from '@/static/modules/actions/browsers'; | ||
|
|
||
| export type Store = Omit<typeof defaultState, 'tree'> & {tree: Tree}; | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. нигде больше не используется |
||
|
|
||
| export type Action< | ||
| Type extends typeof actionNames[keyof typeof actionNames], | ||
| Payload = void | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fresh evidence in the current tree is that this matrix was updated but still retains
20.x, while the same change declares Node>=22.22.0and locksreact-router@8.3.0, which has that same minimum; moreover, the Build and Publish steps at lines 31–36 run exclusively for this unsupported Node 20 job. The unchanged e2e workflow also installs and builds on Node 20, so CI continues exercising the upgraded toolchain outside its supported runtime; move these build/publish conditions and the e2e job to at least Node 22.22.Useful? React with 👍 / 👎.