Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
customServerInitRepo: Joi.string().optional(),
servicePrincipal: Joi.object({ appId: Joi.string(), secret: Joi.string() }).optional(),
});
const schema = Joi.object({
// Accepts config as an object for single-site deploy or array of objects for multi-site
'meteor-azure': Joi.alternatives([
siteConfig,
Joi.array()
.items(siteConfig)
// Reject duplicated site
.unique((a, b) => (a.siteName === b.siteName) && (a.slotName === b.slotName)),
]),
}).unknown(true); // allow unknown keys (at the top level) for Meteor settings
// Ensure settings data follows schema
winston.debug('check data follows schema');
const customDuplicateSiteError = { array: { unique: '!!found duplicated site' } };
Joi.validate(settingsFile, schema, { presence: 'required', language: customDuplicateSiteError }, (error) => {
if (error) {
// Pull error from bottom of stack to get most specific/useful details
const lastError = nth(error.details, -1);
// Locate parent of noncompliant field, or otherwise mark as top level
let pathToParent = 'top level';
if (lastError.path.length > 1) {
pathToParent = `"${dropRight(lastError.path).join('.')}"`;
}
// Report user-friendly error with relevant complaint/context to errors
throw new Error(`Settings file (${filePath}): ${lastError.message} in ${pathToParent}`);
}
});
output.on('close', () => {
logger.debug('Downloaded %s (%d bytes)', filename, output.bytesWritten);
if (sha256) {
logger.debug('Verifying signature for', filename);
const downloaded = Checksum.signatureFromFile(filename);
if (sha256 != downloaded) {
// Our messages are displayed in reverse order in the UI :)
UI.publish('Jenkins may fail to start properly! Please check your network connection');
UI.publish(`Signature verification failed for ${filename}! (${downloaded} != ${sha256})`, { log: 'error' });
return reject(new Error(`Signature verification failed for ${filename}`));
} else {
logger.debug(`Correct checksum (${sha256}) for`, filename);
}
}
return resolve(output);
});
output.write(response.body);
async function generateParams (tableName, data) {
const pairs = R.toPairs(data)
const params = []
for (const p of pairs) {
const [column, value] = p
const cacheData = await sqlService.getCacheEntryForColumn(tableName, column)
if (!cacheData) {
throw new Error(`Column '${column}' not found in table '${tableName}'`)
}
const options: any = {}
// Construct the options array for params generated used `create()` or `update()`
if (cacheData.dataType === 'Decimal' || cacheData.dataType === 'Numeric') {
options.precision = cacheData.precision
options.scale = cacheData.scale
}
winston.debug(`sql.service: generateParams: options set for [${column}]`, options)
params.push({
name: column,
value,
type: R.prop(findTediousDataType(cacheData.dataType), TYPES),
options
})
}
return params
}
try {
settingsFile = jsonfile.readFileSync(filePath);
} catch (error) {
throw new Error(`Could not read settings file at '${filePath}'`);
}
// Define schema
const meteorGoogleCloudConfig = Joi.object({
project: Joi.string(),
}).unknown(true);
const schema = Joi.object({
'meteor-google-cloud': meteorGoogleCloudConfig,
}).unknown(true);
// Ensure settings data follows schema
winston.debug('check data follows schema');
Joi.validate(settingsFile, schema, { presence: 'required' }, (error) => {
if (error) {
// Pull error from bottom of stack to get most specific/useful details
const lastError = nth(error.details, -1);
// Locate parent of non-compliant field, or otherwise mark as top level
let pathToParent = 'top level';
if (lastError.path.length > 1) {
pathToParent = `"${dropRight(lastError.path).join('.')}"`;
}
// Report user-friendly error with relevant complaint/context to errors
throw new Error(`Settings file (${filePath}): ${lastError.message} in ${pathToParent}`);
}
});
updateLocalClaimRecordFromResolve (claim) {
logger.debug('db.Claim >> creating claim entry from lbry resolve results');
// parse the resolved data
let claimData = {};
claimData['address'] = claim.address;
claimData['amount'] = claim.amount;
claimData['claimId'] = claim.claim_id;
claimData['claimSequence'] = claim.claim_sequence;
claimData['decodedClaim'] = claim.decoded_claim;
claimData['depth'] = claim.depth;
claimData['effectiveAmount'] = claim.effective_amount;
claimData['hasSignature'] = claim.has_signature;
claimData['height'] = claim.height;
claimData['hex'] = claim.hex;
claimData['name'] = claim.name;
claimData['nout'] = claim.nout;
claimData['txid'] = claim.txid;
claimData['validAtHeight'] = claim.valid_at_height;
if (isLeft(errorOrSenderService)) {
return left(
TransientError(
`Cannot save sender service id: ${errorOrSenderService.value.body}`
)
);
}
const noChannelsConfigured = [
maybeAllowedEmailNotification,
maybeAllowedWebhookNotification
].every(_ => _.isNone());
if (noChannelsConfigured) {
winston.debug(
`handleMessage|No channels configured for the user ${
newMessageWithoutContent.fiscalCode
} and no default address provided`
);
// return no notifications
return right({});
}
// create and save notification object
const newNotification: NewNotification = {
...createNewNotification(
ulidGenerator,
newMessageWithoutContent.fiscalCode,
newMessageWithoutContent.id
),
channels: withoutUndefinedValues({
function uploadTarballToS3(program, deployStage, tarballFile) {
const spinner = startSpinner(program, 'Uploading archive to Aerobatic');
log.debug(
'Invoke API to get temporary AWS credentials for uploading tarball to S3'
);
return Promise.resolve()
.then(() => {
return api
.get({
url: urlJoin(
program.apiUrl,
`/customers/${program.website.customerId}/deploy-creds`
),
authToken: program.authToken
})
.catch(err => {
throw Error.create(
'Error getting deploy creds: ' + err.message,
ServerRequest.prototype.start = function () {
var next, aclname, acl, address, i, ip, found;
this.question.name = utils.ensure_absolute(this.question.name);
this.zone = this.zones.have(this.question.name);
if (!this.zone) {
winston.debug('Not our zone', [this.question.name]);
address = this.req._socket._remote.address;
for (aclname in this.cfg.acl) {
acl = this.cfg.acl[aclname];
if (!(acl.ip instanceof Array))
acl.ip = [acl.ip];
for (i in acl.ip) {
ip = acl.ip[i];
if (ip == address || check.in_range(address, ip)) {
found = true;
break;
}
}
writeStream.on('finish', function() {
logger.debug('[processor|image|pass1] Saved resized image to "%s".', dest);
resolve();
});
writeStream.on('error', reject);
_retry() {
winston.debug(`Attempting connection to ${this.hostname}:${this.port}`);
this.conn = net.createConnection({port: this.port, host: this.hostname});
this.conn.on("error", ::this._onError);
this.conn.on("connect", ::this._onConnect);
this.conn.on("end", ::this._onEnd);
this.conn.on("close", ::this._onClose);
this.conn.on("timeout", ::this._onTimeout);
this.connected = false;
}