Skip to content

Commit

Permalink
feat: handle improper type validation sync vulnerability
Browse files Browse the repository at this point in the history
  • Loading branch information
sandeepdsvs committed Dec 18, 2023
1 parent 62a43db commit 4fd3b34
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/controllers/bulkUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const fileUpload = async (ctx) => {
return {};
};

const { destType } = ctx.request.body;
const { destType }: { destType: string } = ctx.request.body;

Check warning on line 48 in src/controllers/bulkUpload.ts

View check run for this annotation

Codecov / codecov/patch

src/controllers/bulkUpload.ts#L48

Added line #L48 was not covered by tests
const destFileUploadHandler = getDestFileUploadHandler('v0', destType.toLowerCase());

if (!destFileUploadHandler || !destFileUploadHandler.processFileData) {
Expand Down Expand Up @@ -82,7 +82,7 @@ export const pollStatus = async (ctx) => {
JSON.stringify(ctx.request.body),
);

const { destType } = ctx.request.body;
const { destType }: { destType: string } = ctx.request.body;

Check warning on line 85 in src/controllers/bulkUpload.ts

View check run for this annotation

Codecov / codecov/patch

src/controllers/bulkUpload.ts#L85

Added line #L85 was not covered by tests
const destFileUploadHandler = getPollStatusHandler('v0', destType.toLowerCase());
let response;
if (!destFileUploadHandler || !destFileUploadHandler.processPolling) {
Expand Down Expand Up @@ -117,7 +117,7 @@ export const getWarnJobStatus = async (ctx) => {
JSON.stringify(ctx.request.body),
);

const { destType } = ctx.request.body;
const { destType }: { destType: string } = ctx.request.body;

Check warning on line 120 in src/controllers/bulkUpload.ts

View check run for this annotation

Codecov / codecov/patch

src/controllers/bulkUpload.ts#L120

Added line #L120 was not covered by tests
const destFileUploadHandler = getJobStatusHandler('v0', destType.toLowerCase());

if (!destFileUploadHandler || !destFileUploadHandler.processJobStatus) {
Expand Down Expand Up @@ -153,7 +153,7 @@ export const getFailedJobStatus = async (ctx) => {
JSON.stringify(ctx.request.body),
);

const { destType } = ctx.request.body;
const { destType }: { destType: string } = ctx.request.body;

Check warning on line 156 in src/controllers/bulkUpload.ts

View check run for this annotation

Codecov / codecov/patch

src/controllers/bulkUpload.ts#L156

Added line #L156 was not covered by tests
const destFileUploadHandler = getJobStatusHandler('v0', destType.toLowerCase());

if (!destFileUploadHandler || !destFileUploadHandler.processJobStatus) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,11 @@ const ProxyRequest = async (request) => {
const addPayload = body.JSON.addConversionPayload;
// Mapping Conversion Action
const conversionId = await getConversionActionId(headers, params);
addPayload.operations.forEach((operation) => {
set(operation, 'create.transaction_attribute.conversion_action', conversionId);
});
if (Array.isArray(addPayload.operations)) {
addPayload.operations.forEach((operation) => {
set(operation, 'create.transaction_attribute.conversion_action', conversionId);
});
}
await addConversionToJob(endpoint, headers, firstResponse, addPayload);
const thirdResponse = await runTheJob(
endpoint,
Expand Down

0 comments on commit 4fd3b34

Please sign in to comment.