github-vet / github-vet/rangeloop-pointer-findings
estafette/estafette-letsencrypt-certificate: main.go; 20 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [estafette/estafette-letsencrypt-certificate](https://www.github.com/estafette/estafette-letsencrypt-certificate) at [main.go](https://github.com/estafette/estafette-letsencrypt-certificate/blob/38382341cb7d069b71af82b6a63d16c03eb5573e/main.go#L236-L255)
Below is the message reported by the analyzer for this snippet of code. Beware that the analyzer only reports the first issue it finds, so please do not limit your consideration to the contents of the below message.
> reference to secret was used in a composite literal at line 246
[Click here to see the code in its original context.](https://github.com/estafette/estafette-letsencrypt-certificate/blob/38382341cb7d069b71af82b6a63d16c03eb5573e/main.go#L236-L255)
Click here to show the 20 line(s) of Go which triggered the analyzer.
```go
for _, secret := range secrets.Items {
copyToAllNamespacesValue, ok := secret.Annotations[annotationLetsEncryptCertificateCopyToAllNamespaces]
if ok {
shouldCopyToAllNamespaces, err := strconv.ParseBool(copyToAllNamespacesValue)
if err != nil {
log.Error().Err(err)
continue
}
if shouldCopyToAllNamespaces {
waitGroup.Add(1)
err = copySecretToNamespace(kubeClientset, &secret, namespace, "ns-watcher:ADDED")
waitGroup.Done()
if err != nil {
log.Error().Err(err)
continue
}
}
}
}
```
Leave a reaction on this issue to contribute to the project by classifying this instance as a **Bug** :-1:, **Mitigated** :+1:, or **Desirable Behavior** :rocket:
See the descriptions of the classifications [here](https://github.com/github-vet/rangeclosure-findings#how-can-i-help) for more information.
commit ID: 38382341cb7d069b71af82b6a63d16c03eb5573e
Contributor guide
No contributing guide indexed for this repository
Research direction
Open main.go at lines 236-255 in the linked estafette-letsencrypt-certificate commit and read the range-loop analyzer guidance. Determine whether passing the referenced loop value to copySecretToNamespace can produce incorrect behavior, then leave the requested Bug, Mitigated, or Desirable Behavior reaction. Done means one classification is recorded.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100