Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
try {
continuation = JSON.parse(continuation);
// Make sure nothing malicious can be done by splicing the continuation data
// into the API parameters.
const allowedKeys = ['continue', 'rlcontinue', 'rlecontinue'];
for (const key of allowedKeys) {
if (typeof continuation[key] !== 'object') {
sanitizedContinuation[key] = continuation[key];
}
}
} catch (e) {
this.options.logger.log('error/unflatten', {
msg: e.message,
json: continuation
});
throw new HyperSwitch.HTTPError({
status: 400,
body: {
type: 'server_error#invalid_paging_parameter',
title: 'Invalid paging parameter',
parameter: continuation
}
});
}
}
return sanitizedContinuation;
}