Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.handleRequest = function (done) {
var sig = SharedAccessSignature.parse(config.sharedAccessSignature);
if (config.host === 'bad') { // bad host
done(new Error('Invalid host address'));
}
else if (config.deviceId === 'bad') { // bad policy
done(makeError('Connection Refused'));
}
else if (config.gatewayHostName === 'bad') { // bad gateway url
done(makeError('Invalid gateway address'));
}
else {
var cmpSig = (SharedAccessSignature.create(config.host, config.deviceId, 'bad', sig.se)).toString();
if (config.sharedAccessSignature === cmpSig) { // bad key
done(makeError('Connection Refused'));
}
else {