Skip to content

Commit bbe05ad

Browse files
authored
chore: upgrade dependencies to fix security vulnerabilities (#3281)
1 parent a49ccd0 commit bbe05ad

File tree

19 files changed

+2894
-2824
lines changed

19 files changed

+2894
-2824
lines changed

e2e/server/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ RUN \
2828

2929
# build ui
3030
FROM base AS builder
31+
ENV NODE_ENV=test
3132
WORKDIR /app
3233
COPY --from=deps /app/node_modules ./node_modules
3334
COPY . .

e2e/tests/routes.crud-all-fields.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ test('should CRUD route with all fields', async ({ page }) => {
172172
).toBeVisible();
173173

174174
// clear the editor, will show JSON format is not valid
175-
await uiClearMonacoEditor(page, pluginEditor);
175+
await uiClearMonacoEditor(page);
176176
await expect(
177177
addPluginDialog.getByText('JSON format is not valid')
178178
).toBeVisible();

e2e/tests/ssls.crud-all-fields.spec.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,30 @@ const snis = [
3131
'www.full-test.example.com',
3232
'api.full-test.example.com',
3333
];
34-
const { cert, key } = genTLS();
3534

3635
const initialLabels = {
3736
env: 'production',
3837
version: 'v1',
3938
team: 'backend',
4039
};
4140

42-
const sslDataAllFields: Partial<APISIXType['SSL']> = {
43-
snis,
44-
cert,
45-
key,
46-
labels: initialLabels,
47-
status: 1, // Enabled
48-
};
49-
5041
test.beforeAll(async () => {
5142
await deleteAllSSLs(e2eReq);
5243
});
5344

5445
test('should CRUD SSL with all fields', async ({ page }) => {
5546
test.slow();
5647

48+
// Generate TLS certificates at runtime
49+
const { cert, key } = await genTLS();
50+
const sslDataAllFields: Partial<APISIXType['SSL']> = {
51+
snis,
52+
cert,
53+
key,
54+
labels: initialLabels,
55+
status: 1, // Enabled
56+
};
57+
5758
await sslsPom.toIndex(page);
5859
await sslsPom.isIndexPage(page);
5960

e2e/tests/ssls.crud-required-fields.spec.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,20 @@ import { deleteAllSSLs } from '@/apis/ssls';
2626
import type { APISIXType } from '@/types/schema/apisix';
2727

2828
const snis = ['test.example.com', 'www.test.example.com'];
29-
const { cert, key } = genTLS();
30-
const sslData: Partial<APISIXType['SSL']> = {
31-
snis,
32-
cert,
33-
key,
34-
};
3529

3630
test.beforeAll(async () => {
3731
await deleteAllSSLs(e2eReq);
3832
});
3933

4034
test('should CRUD SSL with required fields', async ({ page }) => {
35+
// Generate TLS certificates at runtime
36+
const { cert, key } = await genTLS();
37+
const sslData: Partial<APISIXType['SSL']> = {
38+
snis,
39+
cert,
40+
key,
41+
};
42+
4143
await sslsPom.toIndex(page);
4244
await sslsPom.isIndexPage(page);
4345

e2e/tests/ssls.list.spec.ts

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -45,23 +45,26 @@ test('should navigate to SSLs page', async ({ page }) => {
4545
});
4646
});
4747

48-
const { cert, key } = genTLS();
49-
50-
const ssls: APISIXType['SSL'][] = Array.from({ length: 11 }, (_, i) => ({
51-
id: randomId('ssl_id'),
52-
snis: [`ssl-${i + 1}.example.com`, `www.ssl-${i + 1}.example.com`],
53-
cert,
54-
key,
55-
labels: {
56-
env: 'test',
57-
version: `v${i + 1}`,
58-
},
59-
status: 1,
60-
}));
48+
let ssls: APISIXType['SSL'][] = [];
6149

6250
test.describe('page and page_size should work correctly', () => {
6351
test.describe.configure({ mode: 'serial' });
52+
6453
test.beforeAll(async () => {
54+
// Generate TLS certificates at runtime
55+
const { cert, key } = await genTLS();
56+
ssls = Array.from({ length: 11 }, (_, i) => ({
57+
id: randomId('ssl_id'),
58+
snis: [`ssl-${i + 1}.example.com`, `www.ssl-${i + 1}.example.com`],
59+
cert,
60+
key,
61+
labels: {
62+
env: 'test',
63+
version: `v${i + 1}`,
64+
},
65+
status: 1,
66+
}));
67+
6568
await deleteAllSSLs(e2eReq);
6669
await Promise.all(ssls.map((d) => putSSLReq(e2eReq, d)));
6770
});

e2e/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,6 @@
2727
},
2828
"include": [
2929
"./**/*.ts",
30+
"../src/types/global.d.ts"
3031
]
3132
}

e2e/utils/common.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export const fileExists = async (filePath: string) => {
4343

4444
export const randomId = (info: string) => `${info}_${nanoid()}`;
4545

46-
export const genTLS = () => {
47-
const { cert, private: key } = selfsigned.generate();
46+
export const genTLS = async () => {
47+
const { cert, private: key } = await selfsigned.generate();
4848
return { cert, key };
4949
};

e2e/utils/ui/index.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ export async function uiFillHTTPStatuses(
6464
}
6565
}
6666

67-
export const uiClearMonacoEditor = async (page: Page, editor: Locator) => {
68-
await editor.click();
69-
await page.keyboard.press('ControlOrMeta+A');
70-
await page.keyboard.press('Backspace');
71-
await editor.blur();
67+
export const uiClearMonacoEditor = async (page: Page) => {
68+
await page.evaluate(() => {
69+
const editor = window.__monacoEditor__;
70+
editor.getModel()?.setValue('');
71+
});
7272
};
7373

7474
export const uiGetMonacoEditor = async (
@@ -83,7 +83,7 @@ export const uiGetMonacoEditor = async (
8383
await expect(editor).toBeVisible({ timeout: 10000 });
8484

8585
if (clear) {
86-
await uiClearMonacoEditor(page, editor);
86+
await uiClearMonacoEditor(page);
8787
}
8888

8989
return editor;
@@ -95,7 +95,9 @@ export const uiFillMonacoEditor = async (
9595
value: string
9696
) => {
9797
await editor.click();
98-
await editor.getByRole('textbox').pressSequentially(value);
98+
const editorTextbox = editor.getByRole('textbox');
99+
// Use fill() instead of pressSequentially() for reliability
100+
await editorTextbox.fill(value);
99101
await editor.blur();
100102
await page.waitForTimeout(800);
101103
};

e2e/utils/ui/ssls.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function uiFillSSLRequiredFields(
2727
ssl: Partial<APISIXType['SSL']>
2828
) {
2929
// Generate TLS certificate if not provided
30-
const tls = ssl.cert && ssl.key ? ssl : genTLS();
30+
const tls = ssl.cert && ssl.key ? ssl : await genTLS();
3131

3232
await ctx.getByRole('textbox', { name: 'Certificate 1' }).fill(tls.cert);
3333
await ctx.getByRole('textbox', { name: 'Private Key 1' }).fill(tls.key);

e2e/utils/ui/upstreams.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ export async function uiFillUpstreamAllFields(
227227

228228
// 11. TLS client verification settings
229229
const tlsSection = ctx.getByRole('group', { name: 'TLS' });
230-
const tls = genTLS();
230+
const tls = await genTLS();
231231
await tlsSection
232232
.getByRole('textbox', { name: 'Client Cert', exact: true })
233233
.fill(tls.cert);

0 commit comments

Comments
 (0)