Skip to content

Commit

Permalink
Fix a queue rate limiting bug allowing to save invalid Redis keys
Browse files Browse the repository at this point in the history
When providing the queue name as string the QueueManager API for queue rate limiting didn't validate the queue name parameter which causes saving invalid Redis keys. This commit fixes the issue and allows queue name parameter to be correctly processed.
  • Loading branch information
weyoss committed Feb 21, 2022
1 parent e192db0 commit 1dc91aa
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions src/system/app/queue-manager/queue-manager-frontend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,31 @@ export class QueueManagerFrontend {
this.logger = getNamespacedLogger('QueueManager');
}

clearQueueRateLimit(queue: TQueueParams, cb: ICallback<void>): void {
queueManager.clearQueueRateLimit(this.redisClient, queue, cb);
clearQueueRateLimit(queue: string | TQueueParams, cb: ICallback<void>): void {
const queueParams = queueManager.getQueueParams(queue);
queueManager.clearQueueRateLimit(this.redisClient, queueParams, cb);
}

setQueueRateLimit(
queue: TQueueParams,
queue: string | TQueueParams,
rateLimit: TQueueRateLimit,
cb: ICallback<void>,
): void {
queueManager.setQueueRateLimit(this.redisClient, queue, rateLimit, cb);
const queueParams = queueManager.getQueueParams(queue);
queueManager.setQueueRateLimit(
this.redisClient,
queueParams,
rateLimit,
cb,
);
}

getQueueRateLimit(queue: TQueueParams, cb: ICallback<TQueueRateLimit>): void {
queueManager.getQueueRateLimit(this.redisClient, queue, cb);
getQueueRateLimit(
queue: string | TQueueParams,
cb: ICallback<TQueueRateLimit>,
): void {
const queueParams = queueManager.getQueueParams(queue);
queueManager.getQueueRateLimit(this.redisClient, queueParams, cb);
}

deleteQueue(queue: string | TQueueParams, cb: ICallback<void>): void {
Expand Down

0 comments on commit 1dc91aa

Please sign in to comment.