Skip to content

Find, verify, and analyze leaked credentials

Bump the Postman client timeout (#4183)

Martin Locklear1c51106e35c3
diff --git a/pkg/sources/postman/postman.go b/pkg/sources/postman/postman.go
index 3299e9296..6d96c0a0b 100644
--- a/pkg/sources/postman/postman.go
+++ b/pkg/sources/postman/postman.go
@@ -18,7 +18,6 @@ import (
"google.golang.org/protobuf/types/known/anypb"
"github.com/go-errors/errors"
- "github.com/trufflesecurity/trufflehog/v3/pkg/common"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/source_metadatapb"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/sourcespb"
"github.com/trufflesecurity/trufflehog/v3/pkg/sources"
@@ -121,7 +120,6 @@ func (s *Source) Init(ctx context.Context, name string, jobId sources.JobID, sou
return errors.New("Postman token is empty")
}
s.client = NewClient(conn.GetToken(), s.metrics)
- s.client.HTTPClient = common.RetryableHTTPClientTimeout(10)
log.RedactGlobally(conn.GetToken())
case *sourcespb.Postman_Unauthenticated:
s.client = nil
diff --git a/pkg/sources/postman/postman_client.go b/pkg/sources/postman/postman_client.go
index a821ecabe..e7bc25f71 100644
--- a/pkg/sources/postman/postman_client.go
+++ b/pkg/sources/postman/postman_client.go
@@ -8,9 +8,10 @@ import (
"strconv"
"time"
- "github.com/trufflesecurity/trufflehog/v3/pkg/context"
"golang.org/x/time/rate"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/common"
+ "github.com/trufflesecurity/trufflehog/v3/pkg/context"
"github.com/trufflesecurity/trufflehog/v3/pkg/pb/source_metadatapb"
)
@@ -214,7 +215,10 @@ func NewClient(postmanToken string, metrics *metrics) *Client {
}
c := &Client{
- HTTPClient: http.DefaultClient,
+ // Requests for large objects (usually collections) take a long time. While we don't think that _every_
+ // request will take this long, some might take 5 seconds or more. This seems reasonable, but we should
+ // be very cautious about bumping it further
+ HTTPClient: common.RetryableHTTPClientTimeout(30),
Headers: bh,
WorkspaceAndCollectionRateLimiter: rate.NewLimiter(rate.Every(time.Second), 1),
GeneralRateLimiter: rate.NewLimiter(rate.Every(time.Second/5), 1),