Skip to content

Commit 7832545

Browse files
fix: resolve qs security vulnerability by updating dependencies
- Updated @remix-run/dev and @remix-run/serve from 2.17.1 to 2.17.2 - This resolves the qs security vulnerability by upgrading Express from 4.21.2 to 4.22.1 - All dependencies now use qs version 6.14.1, which fixes the security issue - Dependabot can now successfully update security patches
1 parent 70d5ee0 commit 7832545

File tree

4 files changed

+249
-143
lines changed

4 files changed

+249
-143
lines changed

electron/main/index.ts

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,18 @@ import log from 'electron-log';
55
import path from 'node:path';
66
import fs from 'node:fs/promises';
77
import { exec } from 'node:child_process';
8-
import { promisify } from 'node:util';
98

10-
const execAsync = promisify(exec);
9+
const execAsync = (command: string, options?: any) => {
10+
return new Promise<string>((resolve, reject) => {
11+
exec(command, options, (error, stdout, _stderr) => {
12+
if (error) {
13+
reject(error);
14+
} else {
15+
resolve(stdout?.toString() || '');
16+
}
17+
});
18+
});
19+
};
1120
import * as pkg from '../../package.json';
1221
import { setupAutoUpdater } from './utils/auto-update';
1322
import { isDev, DEFAULT_PORT } from './utils/constants';
@@ -163,18 +172,18 @@ declare global {
163172

164173
const rendererURL = await (isDev
165174
? (async () => {
166-
await initViteServer();
175+
await initViteServer();
167176

168-
if (!viteServer) {
169-
throw new Error('Vite server is not initialized');
170-
}
177+
if (!viteServer) {
178+
throw new Error('Vite server is not initialized');
179+
}
171180

172-
const listen = await viteServer.listen();
173-
global.__electron__ = electron;
174-
viteServer.printUrls();
181+
const listen = await viteServer.listen();
182+
global.__electron__ = electron;
183+
viteServer.printUrls();
175184

176-
return `http://localhost:${listen.config.server.port}`;
177-
})()
185+
return `http://localhost:${listen.config.server.port}`;
186+
})()
178187
: `http://localhost:${DEFAULT_PORT}`);
179188

180189
console.log('Using renderer URL:', rendererURL);
@@ -301,6 +310,7 @@ declare global {
301310
await execAsync('git commit -m "Init codinit app"', { cwd: projectDir });
302311
} catch (gitError) {
303312
console.warn(`Git initialization failed for ${projectName}:`, gitError);
313+
304314
// Don't fail the whole process if git fails
305315
}
306316

@@ -311,27 +321,30 @@ declare global {
311321
}
312322
});
313323

314-
ipcMain.handle('save-file-local', async (_, projectName: string, filePath: string, content: string | Uint8Array) => {
315-
try {
316-
const home = app.getPath('home');
317-
const appsDir = path.join(home, 'codinit-apps');
318-
const projectDir = path.join(appsDir, projectName);
319-
const fullPath = path.join(projectDir, filePath);
320-
321-
await fs.mkdir(path.dirname(fullPath), { recursive: true });
322-
323-
if (typeof content === 'string') {
324-
await fs.writeFile(fullPath, content, 'utf8');
325-
} else {
326-
await fs.writeFile(fullPath, Buffer.from(content));
324+
ipcMain.handle(
325+
'save-file-local',
326+
async (_, projectName: string, filePath: string, content: string | Uint8Array) => {
327+
try {
328+
const home = app.getPath('home');
329+
const appsDir = path.join(home, 'codinit-apps');
330+
const projectDir = path.join(appsDir, projectName);
331+
const fullPath = path.join(projectDir, filePath);
332+
333+
await fs.mkdir(path.dirname(fullPath), { recursive: true });
334+
335+
if (typeof content === 'string') {
336+
await fs.writeFile(fullPath, content, 'utf8');
337+
} else {
338+
await fs.writeFile(fullPath, Buffer.from(content));
339+
}
340+
341+
return true;
342+
} catch (error) {
343+
console.error('Failed to save file locally:', error);
344+
return false;
327345
}
328-
329-
return true;
330-
} catch (error) {
331-
console.error('Failed to save file locally:', error);
332-
return false;
333-
}
334-
});
346+
},
347+
);
335348

336349
return win;
337350
})

electron/main/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ export default defineConfig({
2020
],
2121

2222
// Add all Node.js built-in modules as external
23+
'node:child_process',
2324
'node:fs',
2425
'node:path',
2526
'node:url',

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@
181181
"@iconify-json/vscode-icons": "^1.2.2",
182182
"@iconify/types": "^2.0.0",
183183
"@playwright/test": "^1.56.1",
184-
"@remix-run/dev": "^2.17.1",
185-
"@remix-run/serve": "^2.17.1",
184+
"@remix-run/dev": "^2.17.2",
185+
"@remix-run/serve": "^2.17.2",
186186
"@testing-library/jest-dom": "^6.9.1",
187187
"@testing-library/react": "^16.3.0",
188188
"@types/diff": "^5.2.3",

0 commit comments

Comments
 (0)