security: Enhance job status retrieval with project authorization

This commit is contained in:
Dries Augustyns
2026-02-19 19:51:22 +01:00
parent eec37ecb31
commit 573e2e8449
2 changed files with 22 additions and 4 deletions
+18 -2
View File
@@ -282,14 +282,22 @@ export class QueueService {
/**
* Get import job status and progress
* @param jobId - The job ID
* @param projectId - The project ID to verify authorization
* @returns Job status or null if not found or unauthorized
*/
public static async getImportJobStatus(jobId: string) {
public static async getImportJobStatus(jobId: string, projectId: string) {
const job = await importQueue.getJob(jobId);
if (!job) {
return null;
}
// Security: Verify that the job belongs to the requesting project
if (job.data.projectId !== projectId) {
return null;
}
const state = await job.getState();
const progress = job.progress;
const returnValue = job.returnvalue;
@@ -324,14 +332,22 @@ export class QueueService {
/**
* Get bulk action job status and progress
* @param jobId - The job ID
* @param projectId - The project ID to verify authorization
* @returns Job status or null if not found or unauthorized
*/
public static async getBulkActionJobStatus(jobId: string) {
public static async getBulkActionJobStatus(jobId: string, projectId: string) {
const job = await bulkContactQueue.getJob(jobId);
if (!job) {
return null;
}
// Security: Verify that the job belongs to the requesting project
if (job.data.projectId !== projectId) {
return null;
}
const state = await job.getState();
const progress = job.progress;
const returnValue = job.returnvalue;