github-vet / github-vet/rangeloop-pointer-findings
buildbuddy-io/buildbuddy: server/build_event_protocol/build_event_handler/build_event_handler.go; 9 LoC
- Dominant language
- No language data
- Stars
- 0
- Forks
- 0
- PR merge metrics
- PR metrics pending
Description
Found a possible issue in [buildbuddy-io/buildbuddy](https://www.github.com/buildbuddy-io/buildbuddy) at [server/build_event_protocol/build_event_handler/build_event_handler.go](https://github.com/buildbuddy-io/buildbuddy/blob/799b6f272f5ae5b05cf5fa1d76ae7426c84f0824/server/build_event_protocol/build_event_handler/build_event_handler.go#L219-L227)
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 hook used in defer or goroutine at line 223
[Click here to see the code in its original context.](https://github.com/buildbuddy-io/buildbuddy/blob/799b6f272f5ae5b05cf5fa1d76ae7426c84f0824/server/build_event_protocol/build_event_handler/build_event_handler.go#L219-L227)
Click here to show the 9 line(s) of Go which triggered the analyzer.
```go
for _, hook := range e.env.GetWebhooks() {
go func() {
// We use context background here because the request context will
// be closed soon and we don't want to block while calling webhooks.
if err := hook.NotifyComplete(context.Background(), invocation); err != nil {
log.Printf("Error calling webhook: %s", err)
}
}()
}
```
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: 799b6f272f5ae5b05cf5fa1d76ae7426c84f0824
Contributor guide
No contributing guide indexed for this repository
Research direction
Inspect server/build_event_protocol/build_event_handler/build_event_handler.go around lines 219-227, starting with the range over e.env.GetWebhooks() and its goroutine. Verify whether the deferred asynchronous call can use the wrong hook, then classify the finding as Bug, Mitigated, or Desirable Behavior based on the observed behavior.
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