-
Notifications
You must be signed in to change notification settings - Fork 741
Expand file tree
/
Copy pathworkspaceManagedIdentity.js
More file actions
55 lines (45 loc) · 2.28 KB
/
workspaceManagedIdentity.js
File metadata and controls
55 lines (45 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
var async = require('async');
var helpers = require('../../../helpers/azure');
module.exports = {
title: 'Synapse Workspace Managed Identity',
category: 'AI & ML',
owasp: ['LLM07'],
domain: 'Machine Learning',
severity: 'Medium',
description: 'Ensure that Azure Synapse workspace has managed identity enabled.',
more_info: 'Enabling managed identities eliminate the need for developers having to manage credentials by providing an identity for the Azure resource in Azure AD and using it to obtain Azure Active Directory (Azure AD) tokens.',
recommended_action: 'Modify Synapse workspace and enable managed identity.',
link: 'https://learn.microsoft.com/en-us/azure/synapse-analytics/synapse-service-identity',
apis: ['synapse:listWorkspaces'],
realtime_triggers: ['microsoftsynapse:workspaces:write','microsoftsynapse:workspaces:delete'],
run: function(cache, settings, callback) {
const results = [];
const source = {};
const locations = helpers.locations(settings.govcloud);
async.each(locations.synapse, function(location, rcb) {
const workspaces = helpers.addSource(cache, source,
['synapse', 'listWorkspaces', location]);
if (!workspaces) return rcb();
if (workspaces.err || !workspaces.data) {
helpers.addResult(results, 3, 'Unable to query Synapse workspaces: ' + helpers.addError(workspaces), location);
return rcb();
}
if (!workspaces.data.length) {
helpers.addResult(results, 0, 'No existing Synapse workspaces found', location);
return rcb();
}
for (let workspace of workspaces.data) {
if (!workspace.id) continue;
if (workspace.identity && workspace.identity.type) {
helpers.addResult(results, 0, 'Synapse workspace has managed identity enabled', location, workspace.id);
} else {
helpers.addResult(results, 2, 'Synapse workspace does not have managed identity enabled', location, workspace.id);
}
}
rcb();
}, function() {
// Global checking goes here
callback(null, results, source);
});
}
};