Skip to content

Commit

Permalink
Fix panic from wrong type conversion in ng rules
Browse files Browse the repository at this point in the history
  • Loading branch information
lewinski authored Oct 30, 2024
1 parent 52b1372 commit 07419af
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions internal/scanners/ng/rules.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ func (a *NatGatewayScanner) GetRecommendations() map[string]azqr.AzqrRecommendat
Recommendation: "NAT Gateway should have diagnostic settings enabled",
Impact: azqr.ImpactLow,
Eval: func(target interface{}, scanContext *azqr.ScanContext) (bool, string) {
service := target.(*armnetwork.SecurityGroup)
service := target.(*armnetwork.NatGateway)
_, ok := scanContext.DiagnosticsSettings[strings.ToLower(*service.ID)]
return !ok, ""
},
Expand All @@ -45,7 +45,7 @@ func (a *NatGatewayScanner) GetRecommendations() map[string]azqr.AzqrRecommendat
Recommendation: "NAT Gateway Name should comply with naming conventions",
Impact: azqr.ImpactLow,
Eval: func(target interface{}, scanContext *azqr.ScanContext) (bool, string) {
c := target.(*armnetwork.SecurityGroup)
c := target.(*armnetwork.NatGateway)
caf := strings.HasPrefix(*c.Name, "ng")
return !caf, ""
},
Expand All @@ -58,7 +58,7 @@ func (a *NatGatewayScanner) GetRecommendations() map[string]azqr.AzqrRecommendat
Recommendation: "NAT Gateway should have tags",
Impact: azqr.ImpactLow,
Eval: func(target interface{}, scanContext *azqr.ScanContext) (bool, string) {
c := target.(*armnetwork.SecurityGroup)
c := target.(*armnetwork.NatGateway)
return len(c.Tags) == 0, ""
},
LearnMoreUrl: "https://learn.microsoft.com/en-us/azure/azure-resource-manager/management/tag-resources?tabs=json",
Expand Down

0 comments on commit 07419af

Please sign in to comment.