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

mozilla/tls-observatory: tlsobs-scanner/analyser.go; 14 LoC

Open
#15,411 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 [mozilla/tls-observatory](https://www.github.com/mozilla/tls-observatory) at [tlsobs-scanner/analyser.go](https://github.com/mozilla/tls-observatory/blob/0547674fceff5d5b7a617d4c2014ce6fded87cee/tlsobs-scanner/analyser.go#L257-L270)

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 which takes a reference to truststore at line 258 may start a goroutine

[Click here to see the code in its original context.](https://github.com/mozilla/tls-observatory/blob/0547674fceff5d5b7a617d4c2014ce6fded87cee/tlsobs-scanner/analyser.go#L257-L270)

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

```go
for _, truststore := range trustStores {
if endEntity != nil && isChainValid(endEntity, intermediates, &truststore, chain.Domain, chain.IP, certmap) {
// If we have an end entity cert and its chain of trust is valid, our work
// here is done, move to the next truststore
continue
}

// to end up here either there was no leaf certificate retrieved
// or it was retrieved but it was not valid so we must check the remainder of the chain
for i, cert := range intermediates {
inter := append(intermediates[:i], intermediates[i+1:]...)
isChainValid(cert, inter, &truststore, chain.Domain, chain.IP, certmap)
}
}

```

Click here to show extra information the analyzer produced.

```
The following graphviz dot graph describes paths through the callgraph that could lead to a function calling a goroutine:
digraph G {
"(add, 1)" -> {"(post, 1)";"(newWatchBroadcast, 3)";"(newWatchBroadcasts, 1)";}
"(Verify, 1)" -> {"(buildChains, 4)";"(CertificateToDANE, 3)";"(systemVerify, 1)";"(isValid, 3)";}
"(Equal, 1)" -> {"(Get, 1)";}
"(Get, 1)" -> {"(New, 1)";"(Read, 1)";}
"(Read, 1)" -> {"(add, 1)";}
"(RoundTripOpt, 2)" -> {"(roundTrip, 1)";}
"(isChainValid, 6)" -> {"(AddCert, 1)";"(Verify, 1)";}
"(post, 1)" -> {"(RoundTrip, 1)";}
"(Write, 1)" -> {"(Update, 3)";}
"(roundTrip, 1)" -> {"(awaitOpenSlotForRequest, 1)";}
"(CertificateToDANE, 3)" -> {"(New, 1)";"(Write, 1)";}
"(newWatchBroadcast, 3)" -> {}
"(Update, 3)" -> {"(add, 1)";}
"(AddCert, 1)" -> {"(Equal, 1)";}
"(systemVerify, 1)" -> {"(extractSimpleChain, 2)";}
"(extractSimpleChain, 2)" -> {"(New, 1)";}
"(newWatchBroadcasts, 1)" -> {}
"(isValid, 3)" -> {"(New, 1)";}
"(New, 1)" -> {"(newClient, 1)";}
"(newClient, 1)" -> {}
"(buildChains, 4)" -> {"(New, 1)";}
"(RoundTrip, 1)" -> {"(roundTrip, 1)";"(RoundTripOpt, 2)";}
"(awaitOpenSlotForRequest, 1)" -> {}
}

```

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: 0547674fceff5d5b7a617d4c2014ce6fded87cee

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.