crossplane-contrib / provider-upjet-aws

Official AWS Provider for Crossplane by Upbound.
https://marketplace.upbound.io/providers/upbound/provider-aws
Apache License 2.0
137 stars 112 forks source link

Conditional Nil Pointer Exception Possible #870

Open humoflife opened 9 months ago

humoflife commented 9 months ago

What happened?

The code at https://github.com/upbound/provider-aws/blob/f6c9172be641b50fee8e5c24612069465b33673e/internal/controller/eks/clusterauth/eks.go#L59 makes the assumption that all users of ClusterAuth MR resource would be using a Selector/Ref and not directly the ClusterName, and the code generated extractor is the one filling the ClusterName field only after its ref.Cluster is Active. When the assumption is false, the provider will experience a nil pointer exception.

Please check for nil ahead of using cluster.CertificateAuthority.Data.

How can we reproduce it?

Do not use a Selector/Ref for the ClusterAuth MR resource. Create a scenario where cluster.CertificateAuthority would be nil when reaching line 59 at https://github.com/upbound/provider-aws/blob/f6c9172be641b50fee8e5c24612069465b33673e/internal/controller/eks/clusterauth/eks.go#L59.

What environment did it happen in?

github-actions[bot] commented 3 months ago

This provider repo does not have enough maintainers to address every issue. Since there has been no activity in the last 90 days it is now marked as stale. It will be closed in 14 days if no further activity occurs. Leaving a comment starting with /fresh will mark this issue as not stale.