Skip to content

Commit 7c7dca9

Browse files
Merge pull request #1354 from jeffersonfelixdev/hotfix/issue-1348
Hotfix - shell injection vulnerability
2 parents 9889035 + 3f8d89e commit 7c7dca9

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 2.2.4 (hotfix)
2+
3+
### Fixed
4+
5+
* Shell injection vulnerability
6+
17
# 2.2.3 (2025-02-03 11:52)
28

39
### Fixed

src/api/provider/sessions.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Auth, ConfigService, ProviderSession } from '@config/env.config';
22
import { Logger } from '@config/logger.config';
33
import axios from 'axios';
4-
import { execSync } from 'child_process';
4+
import { execFileSync } from 'child_process';
55

66
type ResponseSuccess = { status: number; data?: any };
77
type ResponseProvider = Promise<[ResponseSuccess?, Error?]>;
@@ -36,7 +36,7 @@ export class ProviderFiles {
3636
} catch (error) {
3737
this.logger.error(['Failed to connect to the file server', error?.message, error?.stack]);
3838
const pid = process.pid;
39-
execSync(`kill -9 ${pid}`);
39+
execFileSync('kill', ['-9', `${pid}`]);
4040
}
4141
}
4242
}

src/api/services/monitor.service.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { CacheConf, Chatwoot, ConfigService, Database, DelInstance, ProviderSess
77
import { Logger } from '@config/logger.config';
88
import { INSTANCE_DIR, STORE_DIR } from '@config/path.config';
99
import { NotFoundException } from '@exceptions';
10-
import { execSync } from 'child_process';
10+
import { execFileSync } from 'child_process';
1111
import EventEmitter2 from 'eventemitter2';
1212
import { rmSync } from 'fs';
1313
import { join } from 'path';
@@ -169,7 +169,8 @@ export class WAMonitoringService {
169169

170170
public async cleaningStoreData(instanceName: string) {
171171
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED) {
172-
execSync(`rm -rf ${join(STORE_DIR, 'chatwoot', instanceName + '*')}`);
172+
const instancePath = join(STORE_DIR, 'chatwoot', instanceName);
173+
execFileSync('rm', ['-rf', instancePath]);
173174
}
174175

175176
const instance = await this.prismaRepository.instance.findFirst({

0 commit comments

Comments
 (0)