github-vet / github-vet/rangeloop-pointer-findings
ochinchina/oauth5g: main.go; 34 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [ochinchina/oauth5g](https://www.github.com/ochinchina/oauth5g) at [main.go](https://github.com/ochinchina/oauth5g/blob/5932d78eeaff885325e3604f69df367fa2425a87/main.go#L160-L193)
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 item used in defer or goroutine at line 185
[Click here to see the code in its original context.](https://github.com/ochinchina/oauth5g/blob/5932d78eeaff885325e3604f69df367fa2425a87/main.go#L160-L193)
Click here to show the 34 line(s) of Go which triggered the analyzer.
```go
for _, item := range authProxyConfig.Proxies {
key, err := loadSignatureKeyFromFile(item.TokenVerifyKeyFile)
if err != nil {
log.Error("Fail to load key file ", item.TokenVerifyKeyFile, " with error:", err)
return err
}
tlsConfig, err := loadCertFile(item.AuthServer.CaCertFile, item.AuthServer.CertFile, item.AuthServer.KeyFile)
if err != nil {
log.Error("Fail to load the certificate file ", item.AuthServer.CaCertFile)
return err
}
serverFqdn := item.AuthServer.Fqdn
if len(serverFqdn) <= 0 {
u, err := url.Parse(item.AuthServer.URL)
if err == nil {
serverFqdn = u.Host
}
}
if len(serverFqdn) > 0 && tlsConfig != nil {
tlsConfig.ServerName = serverFqdn
log.Info("tlsConfig.ServerName is ", tlsConfig.ServerName)
}
tlsConfig.BuildNameToCertificate()
go func() {
NewProxy(item.TokenReqPath,
item.TokenVerifyPath,
item.AuthServer.URL,
tlsConfig,
item.AuthServer.HTTP2,
jwa.SignatureAlgorithm(item.TokenVerifyAlgorithm),
key).Start(item.ListenAddr)
}()
}
```
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: 5932d78eeaff885325e3604f69df367fa2425a87
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.