-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5588 from dfe-analytical-services/EES-5802-add-se…
…cret-headers-between-fuapi-and-app-gateway Ees 5802 add secret headers between fuapi and app gateway
- Loading branch information
Showing
33 changed files
with
311 additions
and
139 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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
62 changes: 62 additions & 0 deletions
62
infrastructure/templates/public-api/application/public-api/publicApiWafPolicy.bicep
This file contains 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,62 @@ | ||
import { ResourceNames } from '../../types.bicep' | ||
|
||
@description('Specifies common resource naming variables.') | ||
param resourceNames ResourceNames | ||
|
||
@description('Specifies the location for all resources.') | ||
param location string | ||
|
||
@description('Secret header value from FUAPI.') | ||
@secure() | ||
param fuapiSecretValue string | ||
|
||
@description('Specifies a set of tags with which to tag the resource in Azure.') | ||
param tagValues object | ||
|
||
var policyName = '${resourceNames.sharedResources.appGateway}-public-api-afwp' | ||
|
||
module wafPolicyModule '../../components/appGatewayWafPolicy.bicep' = { | ||
name: 'wafPolicy' | ||
params: { | ||
name: policyName | ||
location: location | ||
// Do not define any managed rulesets for this WAF policy. The global WAF policy | ||
// will cover these cases. | ||
managedRuleSets: [] | ||
// Add a custom rule to only allow traffic that contains a correct secret | ||
// header value that is included from FUAPI. | ||
customRules: [ | ||
{ | ||
name: 'fuapisecretnotpresent' | ||
action: 'Block' | ||
matchConditions: [ | ||
{ | ||
type: 'RequestHeaders' | ||
selector: 'X-FUAPI-Secret' | ||
operator: 'Any' | ||
negateOperator: true | ||
} | ||
] | ||
} | ||
{ | ||
name: 'fuapisecretincorrect' | ||
action: 'Block' | ||
matchConditions: [ | ||
{ | ||
type: 'RequestHeaders' | ||
selector: 'X-FUAPI-Secret' | ||
operator: 'Equal' | ||
negateOperator: true | ||
matchValues: [ | ||
fuapiSecretValue | ||
] | ||
} | ||
] | ||
} | ||
] | ||
tagValues: tagValues | ||
} | ||
} | ||
|
||
output id string = wafPolicyModule.outputs.id | ||
output name string = policyName |
This file contains 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 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 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 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 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 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 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
Oops, something went wrong.