-
Notifications
You must be signed in to change notification settings - Fork 711
Azure/front door secure origin #1687
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
Open
alphadev4
wants to merge
10
commits into
aquasecurity:master
Choose a base branch
from
alphadev4:Azure/FrontDoor-SecureOrigin
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
2af37e6
Azure/FrontDoor-SecureOrigin
alphadev4 2098a14
Merge branch 'master' of https://github.com/alphadev4/cloudsploit int…
alphadev4 7077084
updated the domain for other plugin
alphadev4 2123035
indentation
alphadev4 02900e4
Apply suggestions from code review
alphadev4 b620609
Update plugins/azure/frontdoor/frontDoorSecureOrigins.js
AkhtarAmir 7b68673
Apply suggestions from code review
AkhtarAmir 0649a73
Update plugins/azure/frontdoor/frontDoorSecureOrigins.spec.js
alphadev4 cb2fe8a
Azure/FrontDoor-SecureOrigin
alphadev4 3e615e5
Merge branch 'master' into Azure/FrontDoor-SecureOrigin
alphadev4 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
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,90 @@ | ||||||
const async = require('async'); | ||||||
const helpers = require('../../../helpers/azure'); | ||||||
|
||||||
module.exports = { | ||||||
title: 'Front Door Secure Origin', | ||||||
category: 'Front Door', | ||||||
domain: 'Content Delivery', | ||||||
description: 'Ensures that Azure Front Door Standard and Premium profile origins use private link to send traffic to your origin.', | ||||||
more_info: 'Configure your origin to only accept traffic through private link making it secure origin. Origins without this security measure risk bypassing Front Door\'s crucial web application firewall, DDoS protection, and other vital security features.', | ||||||
recommended_action: 'Ensure that Azure Front Door Standard and Premium profile origins are using private link.', | ||||||
link: 'https://learn.microsoft.com/en-us/azure/frontdoor/origin-security?pivots=front-door-standard-premium&tabs=app-service-functions', | ||||||
apis: ['profiles:list', 'afdOriginGroups:listByProfile', 'afdOrigin:listByOriginGroups'], | ||||||
|
||||||
run: function(cache, settings, callback) { | ||||||
const results = []; | ||||||
const source = {}; | ||||||
const locations = helpers.locations(settings.govcloud); | ||||||
async.each(locations.profiles, (location, rcb) => { | ||||||
const profiles = helpers.addSource(cache, source, | ||||||
['profiles', 'list', location]); | ||||||
|
||||||
if (!profiles) return rcb(); | ||||||
|
||||||
if (profiles.err || !profiles.data) { | ||||||
helpers.addResult(results, 3, | ||||||
'Unable to query Azure Front Door profiles: ' + helpers.addError(profiles), location); | ||||||
return rcb(); | ||||||
} | ||||||
|
||||||
if (!profiles.data.length) { | ||||||
helpers.addResult(results, 0, 'No existing Azure Front Door profiles found', location); | ||||||
return rcb(); | ||||||
} | ||||||
|
||||||
var frontDoorProfile = false; | ||||||
profiles.data.forEach(function(profile) { | ||||||
if (!profile.id || profile.kind != 'frontdoor') return; | ||||||
|
||||||
frontDoorProfile = true; | ||||||
var insecureOriginGroupNames = {}; | ||||||
|
||||||
var originFound = false; | ||||||
|
||||||
const afdOriginGroups = helpers.addSource(cache, source, | ||||||
['afdOriginGroups', 'listByProfile', location, profile.id]); | ||||||
alphadev4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
if (!afdOriginGroups || afdOriginGroups.err || !afdOriginGroups.data) { | ||||||
helpers.addResult(results, 3, | ||||||
'Unable to query Azure Front Door origin groups: ' + helpers.addError(afdOriginGroups), location, profile.id); | ||||||
} else if (!afdOriginGroups.data.length) { | ||||||
helpers.addResult(results, 0, 'Front Door profile does not have any origin groups', location, profile.id); | ||||||
} else { | ||||||
afdOriginGroups.data.forEach(function(originGroup) { | ||||||
const afdOrigin = helpers.addSource(cache, source, | ||||||
['afdOrigin', 'listByOriginGroups', location, originGroup.id]); | ||||||
alphadev4 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
if (!afdOrigin || afdOrigin.err || !afdOrigin.data) { | ||||||
helpers.addResult(results, 3, | ||||||
'Unable to query Azure Front Door origins: ' + helpers.addError(afdOrigin), location, profile.id); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
} else { | ||||||
originFound = true; | ||||||
AkhtarAmir marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
insecureOriginGroupNames = afdOrigin.data.filter(origin => { | ||||||
return (origin && (!origin.sharedPrivateLinkResource || !origin.sharedPrivateLinkResource.privateLink)); | ||||||
}).map(function(afdOrigin) { | ||||||
return afdOrigin.name; | ||||||
}); | ||||||
} | ||||||
}); | ||||||
if (originFound) { | ||||||
if (insecureOriginGroupNames.length) { | ||||||
helpers.addResult(results, 2, | ||||||
`Front Door Profile origins are using insecure origins in following origin groups: ${insecureOriginGroupNames.join(', ')}`, location, profile.id); | ||||||
} else { | ||||||
helpers.addResult(results, 0, | ||||||
'Front Door Profile origins are using secure origins', location, profile.id); | ||||||
} | ||||||
} | ||||||
} | ||||||
}); | ||||||
|
||||||
if (!frontDoorProfile) { | ||||||
helpers.addResult(results, 0, 'No existing Azure Front Door profiles found', location); | ||||||
} | ||||||
|
||||||
rcb(); | ||||||
}, function() { | ||||||
callback(null, results, source); | ||||||
}); | ||||||
} | ||||||
}; |
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.