Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
!process.env.TASKCLUSTER_CLIENT_ID ||
!process.env.TASKCLUSTER_ACCESS_TOKEN
) {
console.log([
'Must provide TASKCLUSTER_ROOT_URL, TASKCLUSTER_CLIENT_ID, and TASKCLUSTER_ACCESS_TOKEN as',
'environment variables. We recommend using signin from:',
'',
'https://github.com/taskcluster/taskcluster/tree/master/clients/client-shell#taskcluster-shell-client',
].join('\n'));
process.exit(1);
}
const auth = new taskcluster.Auth(taskcluster.fromEnvVars());
const res = await auth.currentScopes();
if (!libScopes.satisfiesExpression(res.scopes, scopeExpression)) {
const required = libScopes.removeGivenScopes(res.scopes, scopeExpression);
const message = [
'The provided Taskcluster credentials are missing the following scopes:',
'',
JSON.stringify(required, null, 2),
'',
'The credentials must satisfy the following expression:',
'',
JSON.stringify(scopeExpression, null, 2),
].join('\n');
console.log(message);
process.exit(1);
}
const target = options.target ? [`target-${options.target}`] : undefined;
const taskgraph = new TaskGraph(checks, {target});
await taskgraph.run();
'You have the scopes:',
'',
'```',
'{{scopes}}',
'```',
'',
'This request requires you to satisfy this scope expression:',
'',
'```',
'{{required}}',
'```',
].join('\n'),
details: {
scopes: result.scopes,
required: scopeExpression,
unsatisfied: scopes.removeGivenScopes(result.scopes, scopeExpression),
},
});
}
req.satisfyingScopes = satisfyingScopes;
};