Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# 2.2.4 (hotfix)

### Fixed

* Shell injection vulnerability

# 2.2.3 (2025-02-03 11:52)

### Fixed
Expand Down
4 changes: 2 additions & 2 deletions src/api/provider/sessions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Auth, ConfigService, ProviderSession } from '@config/env.config';
import { Logger } from '@config/logger.config';
import axios from 'axios';
import { execSync } from 'child_process';
import { execFileSync } from 'child_process';

type ResponseSuccess = { status: number; data?: any };
type ResponseProvider = Promise<[ResponseSuccess?, Error?]>;
Expand Down Expand Up @@ -36,7 +36,7 @@ export class ProviderFiles {
} catch (error) {
this.logger.error(['Failed to connect to the file server', error?.message, error?.stack]);
const pid = process.pid;
execSync(`kill -9 ${pid}`);
execFileSync('kill', ['-9', `${pid}`]);
}
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/api/services/monitor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { CacheConf, Chatwoot, ConfigService, Database, DelInstance, ProviderSess
import { Logger } from '@config/logger.config';
import { INSTANCE_DIR, STORE_DIR } from '@config/path.config';
import { NotFoundException } from '@exceptions';
import { execSync } from 'child_process';
import { execFileSync } from 'child_process';
import EventEmitter2 from 'eventemitter2';
import { rmSync } from 'fs';
import { join } from 'path';
Expand Down Expand Up @@ -168,7 +168,8 @@ export class WAMonitoringService {

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

const instance = await this.prismaRepository.instance.findFirst({
Expand Down