-
Notifications
You must be signed in to change notification settings - Fork 752
SLK-133892/azure-plugins-draft-1 #2205
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
fatimaaqua
merged 7 commits into
aquasecurity:master
from
Hamza-Aziz61:SLK-133892/azure-plugins-draft-1
Sep 7, 2026
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
17c510c
SLK-133892/azure-plugins-draft-1
Hamza-Aziz61 239af58
Update plugins/azure/databricks/workspacePublicAccess.js
Hamza-Aziz61 1c6b35a
Update plugins/azure/entraid/subscriptionOwnerCount.js
Hamza-Aziz61 adfebd1
SLK-133892/azure-plugins-draft-1
Hamza-Aziz61 fadd06d
SLK-133892/azure-plugins-draft-1
Hamza-Aziz61 3bf34ee
Merge branch 'aquasecurity:master' into SLK-133892/azure-plugins-draft-1
Hamza-Aziz61 27fd740
SLK-133892/azure-plugins-draft-1
Hamza-Aziz61 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| var async = require('async'); | ||
| var helpers = require('../../../helpers/azure'); | ||
|
|
||
| module.exports = { | ||
| title: 'Databricks Workspace Private Endpoints', | ||
| category: 'AI & ML', | ||
| domain: 'Machine Learning', | ||
| severity: 'Medium', | ||
| description: 'Ensures that Azure Databricks Workspace has an approved private endpoint connection.', | ||
| more_info: 'Private endpoints allow clients and services to access the Databricks workspace over an encrypted Private Link using a private IP address from the virtual network. This keeps traffic off the public internet and reduces the attack surface. A private endpoint connection only carries traffic once its connection state is approved.', | ||
| recommended_action: 'Create a private endpoint for the Databricks workspace and approve the private endpoint connection.', | ||
| link: 'https://learn.microsoft.com/en-us/azure/databricks/security/network/classic/private-link', | ||
| apis: ['databricks:listWorkspaces'], | ||
| realtime_triggers: ['microsoftdatabricks:workspaces:write','microsoftdatabricks:workspaces:delete'], | ||
|
|
||
| run: function(cache, settings, callback) { | ||
| const results = []; | ||
| const source = {}; | ||
| const locations = helpers.locations(settings.govcloud); | ||
|
|
||
| async.each(locations.databricks, function(location, rcb) { | ||
| const databricks = helpers.addSource(cache, source, | ||
| ['databricks', 'listWorkspaces', location]); | ||
|
|
||
| if (!databricks) return rcb(); | ||
|
|
||
| if (databricks.err || !databricks.data) { | ||
| helpers.addResult(results, 3, 'Unable to query for Databricks Workspaces: ' + helpers.addError(databricks), location); | ||
| return rcb(); | ||
| } | ||
|
|
||
| if (!databricks.data.length) { | ||
| helpers.addResult(results, 0, 'No existing Databricks Workspaces found', location); | ||
| return rcb(); | ||
| } | ||
|
|
||
| for (let workspace of databricks.data) { | ||
| if (!workspace.id) continue; | ||
|
|
||
| var approved = workspace.privateEndpointConnections && workspace.privateEndpointConnections.length ? | ||
| workspace.privateEndpointConnections.some(connection => connection.properties && | ||
| connection.properties.privateLinkServiceConnectionState && | ||
| connection.properties.privateLinkServiceConnectionState.status && | ||
| connection.properties.privateLinkServiceConnectionState.status.toLowerCase() === 'approved') : false; | ||
|
|
||
| if (approved) { | ||
| helpers.addResult(results, 0, 'Databricks workspace has an approved private endpoint connection', location, workspace.id); | ||
| } else { | ||
| helpers.addResult(results, 2, 'Databricks workspace does not have an approved private endpoint connection', location, workspace.id); | ||
| } | ||
| } | ||
|
|
||
| rcb(); | ||
| }, function() { | ||
| // Global checking goes here | ||
| callback(null, results, source); | ||
| }); | ||
| } | ||
| }; |
140 changes: 140 additions & 0 deletions
140
plugins/azure/databricks/workspacePrivateEndpoints.spec.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,140 @@ | ||
| var expect = require('chai').expect; | ||
| var workspacePrivateEndpoints = require('./workspacePrivateEndpoints.js'); | ||
|
|
||
| const workspaces = [ | ||
| { | ||
| "managedResourceGroupId": "/subscriptions/1234/resourceGroups/test", | ||
| "privateEndpointConnections": [], | ||
| "id": "/subscriptions/1234/resourceGroups/test/providers/Microsoft.Databricks/workspaces/test-workspace", | ||
| "name": "test-workspace", | ||
| "type": "Microsoft.Databricks/workspaces", | ||
| "sku": { | ||
| "name": "premium" | ||
| }, | ||
| "location": "eastus", | ||
| "tags": {} | ||
| }, | ||
| { | ||
| "managedResourceGroupId": "/subscriptions/1234/resourceGroups/test", | ||
| "privateEndpointConnections": [ | ||
| { | ||
| "id": "/subscriptions/1234/resourceGroups/test/providers/Microsoft.Databricks/workspaces/test-workspace/privateEndpointConnections/test-connection", | ||
| "name": "test-connection", | ||
| "type": "Microsoft.Databricks/workspaces/privateEndpointConnections", | ||
| "properties": { | ||
| "privateLinkServiceConnectionState": { | ||
| "status": "Pending", | ||
| "actionsRequired": "None" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "id": "/subscriptions/1234/resourceGroups/test/providers/Microsoft.Databricks/workspaces/test-workspace", | ||
| "name": "test-workspace", | ||
| "type": "Microsoft.Databricks/workspaces", | ||
| "sku": { | ||
| "name": "premium" | ||
| }, | ||
| "location": "eastus", | ||
| "tags": {} | ||
| }, | ||
| { | ||
| "managedResourceGroupId": "/subscriptions/1234/resourceGroups/test", | ||
| "privateEndpointConnections": [ | ||
| { | ||
| "id": "/subscriptions/1234/resourceGroups/test/providers/Microsoft.Databricks/workspaces/test-workspace/privateEndpointConnections/test-connection", | ||
| "name": "test-connection", | ||
| "type": "Microsoft.Databricks/workspaces/privateEndpointConnections", | ||
| "properties": { | ||
| "privateLinkServiceConnectionState": { | ||
| "status": "Approved", | ||
| "actionsRequired": "None" | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "id": "/subscriptions/1234/resourceGroups/test/providers/Microsoft.Databricks/workspaces/test-workspace", | ||
| "name": "test-workspace", | ||
| "type": "Microsoft.Databricks/workspaces", | ||
| "sku": { | ||
| "name": "premium" | ||
| }, | ||
| "location": "eastus", | ||
| "tags": {} | ||
| }, | ||
| ]; | ||
|
|
||
|
|
||
| const createCache = (workspaces, err) => { | ||
|
|
||
| return { | ||
| databricks: { | ||
| listWorkspaces: { | ||
| 'eastus': { | ||
| data: workspaces, | ||
| err: err | ||
| } | ||
| } | ||
| } | ||
| }; | ||
| }; | ||
|
|
||
| describe('workspacePrivateEndpoints', function () { | ||
| describe('run', function () { | ||
|
|
||
| it('should give a passing result if no Databricks workspaces are found', function (done) { | ||
| const cache = createCache([], null); | ||
| workspacePrivateEndpoints.run(cache, {}, (err, results) => { | ||
| expect(results.length).to.equal(1); | ||
| expect(results[0].status).to.equal(0); | ||
| expect(results[0].message).to.include('No existing Databricks Workspaces found'); | ||
| expect(results[0].region).to.equal('eastus'); | ||
| done(); | ||
| }); | ||
| }); | ||
|
|
||
| it('should give unknown result if unable to query for Databricks workspaces', function (done) { | ||
| const cache = createCache(null, ['error']); | ||
| workspacePrivateEndpoints.run(cache, {}, (err, results) => { | ||
| expect(results.length).to.equal(1); | ||
| expect(results[0].status).to.equal(3); | ||
| expect(results[0].message).to.include('Unable to query for Databricks Workspaces'); | ||
| expect(results[0].region).to.equal('eastus'); | ||
| done(); | ||
| }); | ||
| }); | ||
|
|
||
| it('should give passing result if Databricks workspace has an approved private endpoint connection', function (done) { | ||
| const cache = createCache([workspaces[2]], null); | ||
| workspacePrivateEndpoints.run(cache, {}, (err, results) => { | ||
| expect(results.length).to.equal(1); | ||
| expect(results[0].status).to.equal(0); | ||
| expect(results[0].message).to.include('Databricks workspace has an approved private endpoint connection'); | ||
| expect(results[0].region).to.equal('eastus'); | ||
| done(); | ||
| }); | ||
| }); | ||
|
|
||
| it('should give failing result if Databricks workspace does not have private endpoint connections', function (done) { | ||
| const cache = createCache([workspaces[0]], null); | ||
| workspacePrivateEndpoints.run(cache, {}, (err, results) => { | ||
| expect(results.length).to.equal(1); | ||
| expect(results[0].status).to.equal(2); | ||
| expect(results[0].message).to.include('Databricks workspace does not have an approved private endpoint connection'); | ||
| expect(results[0].region).to.equal('eastus'); | ||
| done(); | ||
| }); | ||
| }); | ||
|
|
||
| it('should give failing result if Databricks workspace private endpoint connection is not approved', function (done) { | ||
| const cache = createCache([workspaces[1]], null); | ||
| workspacePrivateEndpoints.run(cache, {}, (err, results) => { | ||
| expect(results.length).to.equal(1); | ||
| expect(results[0].status).to.equal(2); | ||
| expect(results[0].message).to.include('Databricks workspace does not have an approved private endpoint connection'); | ||
| expect(results[0].region).to.equal('eastus'); | ||
| done(); | ||
| }); | ||
| }); | ||
| }); | ||
| }); |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.