Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}, function(req, res) {
// Get parameters
var account = req.params.account;
var table = req.params.table;
var ctx = this;
// Check that the client is authorized to access given account and table
if (!req.satisfies({account: account, table: table})) {
return;
}
// Check that the account exists
if (!ctx.azureAccounts[account]) {
// Try to fetch from auth, if not specified directly
var auth = new taskcluster.Auth({
credentials: ctx.credentials,
baseUrl: ctx.authBaseUrl
});
return auth.azureTableSAS(account, table).then(function(result) {
return res.reply(result);
}, function() {
return res.status(404).json({
message: "Account '" + account + "' not found, can't delegate access"
});
});
}
// Construct client
var client = azureTable.createClient({
accountName: account,
accountKey: ctx.azureAccounts[account],
import React from 'react';
import {Row, Col, ButtonToolbar, Button, Glyphicon, Table} from 'react-bootstrap';
import RoleEditor from './roleeditor';
import * as utils from '../../lib/utils';
import taskcluster from 'taskcluster-client';
import _ from 'lodash';
import './rolemanager.less';
/** Create role manager */
const RoleManager = React.createClass({
/** Initialize mixins */
mixins: [
utils.createTaskClusterMixin({
clients: {
auth: taskcluster.Auth,
},
}),
// Serialize state.selectedRoleId to location.hash as string
utils.createLocationHashMixin({
keys: ['selectedRoleId'],
type: 'string',
}),
],
/** Create an initial state */
getInitialState() {
return {
rolesLoaded: false,
rolesError: undefined,
roles: undefined,
selectedRoleId: '', // '' means "add new role"
import * as utils from '../../lib/utils';
import taskcluster from 'taskcluster-client';
import * as format from '../../lib/format';
import _ from 'lodash';
import RoleEditor from '../roles/roleeditor';
import ClientEditor from '../clients/clienteditor';
import './scopeinspector.less';
export default React.createClass({
displayName: 'ScopeInspector',
/** Initialize mixins */
mixins: [
utils.createTaskClusterMixin({
clients: {
auth: taskcluster.Auth,
},
}),
// Serialize selectedScope and selectedEntity to location.hash as string
utils.createLocationHashMixin({
keys: ['selectedScope', 'selectedEntity'],
type: 'string',
}),
],
/** Create an initial state */
getInitialState() {
return {
rolesLoaded: false,
rolesError: null,
roles: null,
clientsLoaded: false,
const taskcluster = require('taskcluster-client');
if (!module.parent) {
// use the root credentials from the environment (this is meant to be run from `heroku run`)
let auth = new taskcluster.Auth({
baseUrl: 'https://taskcluster-auth-staging.herokuapp.com/v1/',
credentials: {
clientId: 'root',
accessToken: process.env.ROOT_ACCESS_TOKEN,
},
});
// invent a client name
let clientId = 'project/taskcluster/tc-auth/staging-check/' + taskcluster.slugid();
auth.createClient(clientId, {
expires: new Date(3000, 1, 1),
description: 'test credentials for checkStaging',
scopes: [
'auth:create-client:garbage/*',
'auth:delete-client:garbage/*',
setup: async ({ cfg, strategies, monitor }, ownName) => {
const auth = new Auth({
credentials: cfg.taskcluster.credentials,
rootUrl: cfg.taskcluster.rootUrl,
});
return monitor.oneShot(ownName, () => scanner(auth, strategies));
},
},
setup: ({ cfg }) => new taskcluster.Auth(cfg.taskcluster),
},
setup: ({ cfg }) => new taskcluster.Auth(cfg.taskcluster),
},
module.exports = options => ({
auth: new Auth(options),
github: new Github(options),
hooks: new Hooks(options),
index: new Index(options),
purgeCache: new PurgeCache(options),
queue: new Queue(options),
secrets: new Secrets(options),
queueEvents: new QueueEvents(options),
notify: new Notify(options),
workerManager: new WorkerManager(options),
});