Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bdns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ func (d *dohExchanger) ExchangeContext(ctx context.Context, query *dns.Msg, serv
return nil, d.clk.Since(start), fmt.Errorf("doh: http status %d", resp.StatusCode)
}

b, err := io.ReadAll(resp.Body)
b, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 300_000})
if err != nil {
return nil, d.clk.Since(start), fmt.Errorf("doh: reading response body: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/crl-checker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func downloadShard(url string) (*x509.RevocationList, error) {
return nil, fmt.Errorf("downloading crl: http status %d", resp.StatusCode)
}

crlBytes, err := io.ReadAll(resp.Body)
crlBytes, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 1_000_000_000})
if err != nil {
return nil, fmt.Errorf("reading CRL bytes: %w", err)
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ func ValidateYAMLConfig(cv *ConfigValidator, in io.Reader) error {
// Register custom types for use with existing validation tags.
validate.RegisterCustomTypeFunc(config.DurationCustomTypeFunc, config.Duration{})

inBytes, err := io.ReadAll(in)
inBytes, err := io.ReadAll(&io.LimitedReader{R: in, N: 300_000})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion crl/storer/storer.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (cs *crlStorer) UploadCRL(stream grpc.ClientStreamingServer[cspb.UploadCRLR
cs.log.Info(ctx, "Proceeding because no previous CRL found")
} else {
defer prevObj.Body.Close()
prevBytes, err := io.ReadAll(prevObj.Body)
prevBytes, err := io.ReadAll(&io.LimitedReader{R: prevObj.Body, N: 1_000_000_000})
if err != nil {
return fmt.Errorf("downloading previous CRL for %s: %w", crlId, err)
}
Expand Down
2 changes: 1 addition & 1 deletion linter/pkimetal/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ func (pkim *Client) Execute(endpoint string, der []byte) (*lint.LintResult, erro
return nil, fmt.Errorf("got status %d (%s) from pkimetal API", resp.StatusCode, resp.Status)
}

resJSON, err := io.ReadAll(resp.Body)
resJSON, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 300_000})
if err != nil {
return nil, fmt.Errorf("reading response from pkimetal API: %s", err)
}
Expand Down
2 changes: 1 addition & 1 deletion observer/probers/aia/aia.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func (p AIAProbe) Probe(ctx context.Context) error {
return fmt.Errorf("certificate Content-Type is %q but want application/pkix-cert", contentType)
}

body, err := io.ReadAll(resp.Body)
body, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 300_000})
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion observer/probers/ccadb/retryhttp.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func getBody(ctx context.Context, url string) ([]byte, error) {
}
defer resp.Body.Close()

body, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 100_000_000})
body, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 1_000_000_000})
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion observer/probers/crl/crl.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (p CRLProbe) Probe(ctx context.Context) error {
}
defer resp.Body.Close()

body, err := io.ReadAll(resp.Body)
body, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 1_000_000_000})
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions observer/probers/tls/tls.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func checkOCSP(ctx context.Context, cert, issuer *x509.Certificate, want int) (b
}
defer res.Body.Close()

output, err := io.ReadAll(res.Body)
output, err := io.ReadAll(&io.LimitedReader{R: res.Body, N: 300_000})
if err != nil {
return false, err
}
Expand Down Expand Up @@ -114,7 +114,7 @@ func checkCRL(ctx context.Context, cert, issuer *x509.Certificate, want int) (bo
}
defer resp.Body.Close()

der, err := io.ReadAll(resp.Body)
der, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 1_000_000_000})
if err != nil {
return false, fmt.Errorf("reading CRL: %w", err)
}
Expand Down
5 changes: 3 additions & 2 deletions salesforce/pardot.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"time"

"github.com/jmhodges/clock"

"github.com/letsencrypt/boulder/core"
)

Expand Down Expand Up @@ -117,7 +118,7 @@ func (pc *SalesforceClientImpl) updateToken() error {
defer resp.Body.Close()

if resp.StatusCode != http.StatusOK {
body, readErr := io.ReadAll(resp.Body)
body, readErr := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 300_000})
if readErr != nil {
return fmt.Errorf("token request failed with status %d; while reading body: %w", resp.StatusCode, readErr)
}
Expand Down Expand Up @@ -202,7 +203,7 @@ func (pc *SalesforceClientImpl) SendContact(email string) error {
return nil
}

body, err := io.ReadAll(resp.Body)
body, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 300_000})
resp.Body.Close()

if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion sfe/zendesk/zendesk.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ func (c *Client) doJSONRequest(method, reqURL string, body []byte) ([]byte, erro
}
defer resp.Body.Close()

respBody, err := io.ReadAll(resp.Body)
respBody, err := io.ReadAll(&io.LimitedReader{R: resp.Body, N: 300_000})
if err != nil {
return nil, fmt.Errorf("failed to read zendesk response body: %w", err)
}
Expand Down