make sure to close connections after testing (#2343)
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user