Skip to content

Commit 6985df5

Browse files
yoavmalyoavmalichi_microsoft
andauthored
Support Default Disabled Rules in AppGW WAF Manifest with ComputedDisabledRules Property (#28327)
Co-authored-by: yoavmalichi_microsoft <[email protected]>
1 parent e2be6a7 commit 6985df5

File tree

7 files changed

+3288
-2
lines changed

7 files changed

+3288
-2
lines changed

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public void TestApplicationGatewayGlobalConfig()
115115
{
116116
TestRunner.RunTestScript(string.Format("Test-ApplicationGatewayGlobalConfig -baseDir '{0}'", AppDomain.CurrentDomain.BaseDirectory));
117117
}
118-
118+
119119
[Fact]
120120
[Trait(Category.AcceptanceType, Category.CheckIn)]
121121
[Trait(Category.Owner, NrpTeamAlias.nvadev)]
@@ -380,5 +380,13 @@ public void TestApplicationGatewayFirewallPolicyWithCustomBlockResponse()
380380
{
381381
TestRunner.RunTestScript("Test-ApplicationGatewayFirewallPolicyWithCustomBlockResponse");
382382
}
383+
384+
[Fact]
385+
[Trait(Category.AcceptanceType, Category.CheckIn)]
386+
[Trait(Category.Owner, NrpTeamAlias.nvadev_subset1)]
387+
public void TestApplicationGatewayFirewallPolicyComputedDisabledRules()
388+
{
389+
TestRunner.RunTestScript("Test-ApplicationGatewayFirewallPolicyComputedDisabledRules");
390+
}
383391
}
384392
}

src/Network/Network.Test/ScenarioTests/ApplicationGatewayTests.ps1

Lines changed: 311 additions & 1 deletion
Large diffs are not rendered by default.

src/Network/Network.Test/SessionRecords/Commands.Network.Test.ScenarioTests.ApplicationGatewayTests/TestApplicationGatewayFirewallPolicyComputedDisabledRules.json

Lines changed: 2926 additions & 0 deletions
Large diffs are not rendered by default.

src/Network/Network/ChangeLog.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@
1919
--->
2020

2121
## Upcoming Release
22+
* Added a read-only property `ComputedDisabledRules` to `ApplicationGatewayFirewallPolicyManagedRuleSet`. This property shows which rules are effectively disabled, based on both user-defined WAF policy overrides and the default state of the rules in the managed ruleset.
23+
* Primary affected Cmdlet (returns the modified object directly):
24+
- `New-AzApplicationGatewayFirewallPolicyManagedRuleSet`
25+
* Secondary affected Cmdlets (object is nested within their returned result):
26+
- `New-AzApplicationGatewayFirewallPolicyManagedRules`
27+
- `Get-AzApplicationGatewayFirewallPolicy`
28+
- `Set-AzApplicationGatewayFirewallPolicy`
29+
- `New-AzApplicationGatewayFirewallPolicy`
30+
2231

2332
## Version 7.19.0
2433
* Returned appgw and agc in waf policy

src/Network/Network/Common/NetworkResourceManagerProfile.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1469,6 +1469,7 @@ private static void Initialize()
14691469
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyLogScrubbingRule, MNM.WebApplicationFirewallScrubbingRules>();
14701470
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyManagedRules, MNM.ManagedRulesDefinition>();
14711471
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyManagedRuleSet, MNM.ManagedRuleSet>();
1472+
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyManagedRuleSetRuleGroup, MNM.ManagedRuleSetRuleGroup>();
14721473
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyManagedRuleGroupOverride, MNM.ManagedRuleGroupOverride>();
14731474
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyManagedRuleOverride, MNM.ManagedRuleOverride>();
14741475
cfg.CreateMap<CNM.PSApplicationGatewayFirewallPolicyExclusion, MNM.ApplicationGatewayFirewallExclusion>();
@@ -1573,6 +1574,7 @@ private static void Initialize()
15731574
cfg.CreateMap<MNM.WebApplicationFirewallScrubbingRules, CNM.PSApplicationGatewayFirewallPolicyLogScrubbingRule>();
15741575
cfg.CreateMap<MNM.ManagedRulesDefinition, CNM.PSApplicationGatewayFirewallPolicyManagedRules>();
15751576
cfg.CreateMap<MNM.ManagedRuleSet, CNM.PSApplicationGatewayFirewallPolicyManagedRuleSet>();
1577+
cfg.CreateMap<MNM.ManagedRuleSetRuleGroup, CNM.PSApplicationGatewayFirewallPolicyManagedRuleSetRuleGroup>();
15761578
cfg.CreateMap<MNM.ManagedRuleGroupOverride, CNM.PSApplicationGatewayFirewallPolicyManagedRuleGroupOverride>();
15771579
cfg.CreateMap<MNM.ManagedRuleOverride, CNM.PSApplicationGatewayFirewallPolicyManagedRuleOverride>();
15781580
cfg.CreateMap<MNM.ApplicationGatewayFirewallExclusion, CNM.PSApplicationGatewayFirewallPolicyExclusion>();

src/Network/Network/Models/PSApplicationGatewayFirewallPolicyManagedRuleSet.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,7 @@ public partial class PSApplicationGatewayFirewallPolicyManagedRuleSet
2828
public string RuleSetVersion { get; set; }
2929
[Ps1Xml(Target = ViewControl.Table)]
3030
public List<PSApplicationGatewayFirewallPolicyManagedRuleGroupOverride> RuleGroupOverrides { get; set; }
31+
[Ps1Xml(Target = ViewControl.Table)]
32+
public List<PSApplicationGatewayFirewallPolicyManagedRuleSetRuleGroup> ComputedDisabledRules { get; private set; }
3133
}
3234
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
//
2+
// Copyright (c) Microsoft. All rights reserved.
3+
//
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
//
15+
16+
using Microsoft.WindowsAzure.Commands.Common.Attributes;
17+
using System.Collections.Generic;
18+
19+
namespace Microsoft.Azure.Commands.Network.Models
20+
{
21+
public class PSApplicationGatewayFirewallPolicyManagedRuleSetRuleGroup
22+
{
23+
[Ps1Xml(Target = ViewControl.Table)]
24+
public string RuleGroupName { get; set; }
25+
26+
[Ps1Xml(Target = ViewControl.Table)]
27+
public List<string> Rules { get; set; }
28+
}
29+
}

0 commit comments

Comments
 (0)