Skip to content

Commit

Permalink
fix #22: check for nil ptr in destination rule auditor (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
amlweems authored Oct 18, 2021
1 parent 205341a commit f3e5ac9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _fixtures/destinationrule-empty-tls.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: empty-tls-policy
namespace: default
spec:
host: example.com
trafficPolicy: {}
7 changes: 7 additions & 0 deletions _fixtures/destinationrule-empty-traffic-policy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: networking.istio.io/v1alpha3
kind: DestinationRule
metadata:
name: empty-traffic-policy
namespace: default
spec:
host: example.com
3 changes: 3 additions & 0 deletions auditors/destinationrule/cacerts.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ func (a *auditor) Audit(_ types.Discovery, resources types.Resources) ([]types.A
var results []types.AuditResult

for _, rule := range resources.DestinationRules {
if rule.Spec.TrafficPolicy == nil {
continue
}
if !isClientTLSSettingSafe(rule.Spec.TrafficPolicy.Tls) {
results = append(results, types.AuditResult{
Name: a.Name(),
Expand Down

0 comments on commit f3e5ac9

Please sign in to comment.