github-vet / github-vet/rangeloop-pointer-findings
app-sre/vault-manager: toplevel/role/role.go; 36 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [app-sre/vault-manager](https://www.github.com/app-sre/vault-manager) at [toplevel/role/role.go](https://github.com/app-sre/vault-manager/blob/bd9d33af19041e467f5df3f10c3c1511a7f1815c/toplevel/role/role.go#L84-L119)
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.
> range-loop variable authBackend used in defer or goroutine at line 102
[Click here to see the code in its original context.](https://github.com/app-sre/vault-manager/blob/bd9d33af19041e467f5df3f10c3c1511a7f1815c/toplevel/role/role.go#L84-L119)
Click here to show the 36 line(s) of Go which triggered the analyzer.
```go
for authBackend := range existingAuthBackends {
// Get the secret with the existing App Roles.
path := filepath.Join("auth", authBackend, "role")
secret := vault.ListSecrets(path)
if secret != nil {
roles := secret.Data["keys"].([]interface{})
var mutex = &sync.Mutex{}
bwg := utils.NewBoundedWaitGroup(threadPoolSize)
// fill existing policies array in parallel
for i := range roles {
bwg.Add(1)
go func(i int) {
path := filepath.Join("auth", authBackend, "role", roles[i].(string))
mutex.Lock()
existingRoles = append(existingRoles, entry{
Name: roles[i].(string),
Type: existingAuthBackends[authBackend].Type,
Mount: authBackend,
Options: vault.ReadSecret(path).Data,
})
defer bwg.Done()
defer mutex.Unlock()
}(i)
}
bwg.Wait()
}
}
```
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: bd9d33af19041e467f5df3f10c3c1511a7f1815c
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.