mirror of
https://github.com/trufflesecurity/trufflehog.git
synced 2024-11-10 07:04:24 +00:00
make sure to close connections after testing (#2343)
This commit is contained in:
parent
f078df43eb
commit
41cfec4e1c
1 changed files with 6 additions and 2 deletions
|
@ -2,10 +2,11 @@ package rabbitmq
|
|||
|
||||
import (
|
||||
"context"
|
||||
regexp "github.com/wasilibs/go-re2"
|
||||
"net/url"
|
||||
"strings"
|
||||
|
||||
regexp "github.com/wasilibs/go-re2"
|
||||
|
||||
amqp "github.com/rabbitmq/amqp091-go"
|
||||
|
||||
"github.com/trufflesecurity/trufflehog/v3/pkg/detectors"
|
||||
|
@ -59,10 +60,13 @@ func (s Scanner) FromData(ctx context.Context, verify bool, data []byte) (result
|
|||
}
|
||||
|
||||
if verify {
|
||||
_, err := amqp.Dial(urlMatch)
|
||||
conn, err := amqp.Dial(urlMatch)
|
||||
if err == nil {
|
||||
s.Verified = true
|
||||
}
|
||||
if conn != nil {
|
||||
conn.Close()
|
||||
}
|
||||
}
|
||||
|
||||
if !s.Verified {
|
||||
|
|
Loading…
Reference in a new issue