Skip to content

Use Buffer.from().toString() instead of atob() to decode task payload #8843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 15, 2025
Merged
Changes from all 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
4 changes: 3 additions & 1 deletion src/emulator/tasksEmulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
oidcToken?: {
serviceAccountEmail: string;
};
body: any;

Check warning on line 27 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
headers: { [key: string]: string };
};
}
Expand Down Expand Up @@ -163,8 +163,8 @@
return this.running;
}

getStatistics() {

Check warning on line 166 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Missing return type on function
const stats: Record<string, any> = {};

Check warning on line 167 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unexpected any. Specify a different type
for (const [key, queue] of Object.entries(this.queues)) {
stats[key] = queue.getStatistics();
}
Expand Down Expand Up @@ -265,10 +265,12 @@
return;
}

req.body.task.name =

Check warning on line 268 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .task on an `any` value

Check warning on line 268 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
req.body.task.name ??

Check warning on line 269 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .task on an `any` value
`/projects/${projectId}/locations/${locationId}/queues/${queueName}/tasks/${Math.floor(Math.random() * Number.MAX_SAFE_INTEGER)}`;
req.body.task.httpRequest.body = JSON.parse(atob(req.body.task.httpRequest.body));
req.body.task.httpRequest.body = JSON.parse(

Check warning on line 271 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .task on an `any` value

Check warning on line 271 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe assignment of an `any` value
Buffer.from(req.body.task.httpRequest.body, "base64").toString("utf-8"),

Check warning on line 272 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe member access .task on an `any` value

Check warning on line 272 in src/emulator/tasksEmulator.ts

View workflow job for this annotation

GitHub Actions / lint (20)

Unsafe argument of type `any` assigned to a parameter of type `WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: "string"): string; }`
);

const task = req.body.task as Task;

Expand Down
Loading