github-vet / github-vet/rangeloop-pointer-findings

nicholasjackson/pipe: server/server.go; 20 LoC

Open
#15,703 0 comments 0 reactions 0 assignees View on GitHub
fresh small
Dominant language
No language data
Stars
0
Forks
0
PR merge metrics
PR metrics pending

Description

Found a possible issue in [nicholasjackson/pipe](https://www.github.com/nicholasjackson/pipe) at [server/server.go](https://github.com/nicholasjackson/pipe/blob/e654f5e9941ba40dba7b1060616341c7b84a5908/server/server.go#L175-L194)

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.

> function call at line 189 passes reference to a to third-party code

[Click here to see the code in its original context.](https://github.com/nicholasjackson/pipe/blob/e654f5e9941ba40dba7b1060616341c7b84a5908/server/server.go#L175-L194)

Click here to show the 20 line(s) of Go which triggered the analyzer.

```go
for _, a := range pi.OnFail {
p.logger.ServerFailPublish(pi, &a, m)

// transform data if necessary
data, err := p.processOutputTemplate(a, m.Data)
if err != nil {
continue
}
msg := providers.NewMessage()
msg.ParentID = m.ID
msg.Data = data

a.OutputProvider.Publish(msg)
if err != nil {
p.logger.ServerFailPublishFailed(pi, &a, msg, err)
continue
}

p.logger.ServerFailPublishSuccess(pi, &a, msg)
}

```

Click here to show extra information the analyzer produced.

```
No path was found through the callgraph that could lead to a function which writes a pointer argument.

The following graphviz dot graph describes paths through the callgraph that could lead to a function which passes a pointer to third-party code:
digraph G {
"(ServerFailPublishFailed, 4)" -> {}
}

```

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: e654f5e9941ba40dba7b1060616341c7b84a5908

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading server/server.go lines 175-194 and tracing the range-loop variable a through ServerFailPublish, processOutputTemplate, and OutputProvider.Publish. Determine whether the analyzer finding is a bug, mitigated, or desirable behavior; done means recording that classification and any justified follow-up.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.