Skip to content

Commit

Permalink
Fixing #180
Browse files Browse the repository at this point in the history
  • Loading branch information
cmendible committed Dec 21, 2023
1 parent f8079d9 commit 5fb3ab3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
4 changes: 2 additions & 2 deletions internal/scanners/aks/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func (a *AKSScanner) GetRules() map[string]scanners.AzureRule {
Severity: scanners.SeverityHigh,
Eval: func(target interface{}, scanContext *scanners.ScanContext) (bool, string) {
c := target.(*armcontainerservice.ManagedCluster)
out := *c.Properties.NetworkProfile.OutboundType == armcontainerservice.OutboundTypeUserDefinedRouting
return !out, ""
broken := c.Properties.NetworkProfile.OutboundType == nil || *c.Properties.NetworkProfile.OutboundType != armcontainerservice.OutboundTypeUserDefinedRouting
return broken, ""
},
Url: "https://learn.microsoft.com/azure/aks/limit-egress-traffic",
},
Expand Down
16 changes: 16 additions & 0 deletions internal/scanners/aks/rules_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,6 +434,22 @@ func TestAKSScanner_Rules(t *testing.T) {
result: "",
},
},
{
name: "AKSScanner OutboundType nil",
fields: fields{
rule: "aks-012",
target: &armcontainerservice.ManagedCluster{
Properties: &armcontainerservice.ManagedClusterProperties{
NetworkProfile: &armcontainerservice.NetworkProfile{},
},
},
scanContext: &scanners.ScanContext{},
},
want: want{
broken: true,
result: "",
},
},
{
name: "AKSScanner kubenet",
fields: fields{
Expand Down

0 comments on commit 5fb3ab3

Please sign in to comment.