Skip to content

Commit

Permalink
GolangCI-Lint Fixes (#439)
Browse files Browse the repository at this point in the history
This PR addresses #438 by
fixing all of the reported issues in Pebble code.

fixes include:
- A fix for a WFE panic: [Use built-in UTC for TZ to eliminate
panics](2ee3d6b)
- Fixes for Appveyor and Travis related to Python
- Update golanci-lint to current in Travis
  • Loading branch information
sheurich authored Feb 27, 2024
1 parent 5b7dc87 commit ac381e9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 11 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ before_install:
# `-mod=vendor` to use the vendored dependencies
install:
# Install `golangci-lint` using their installer script
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.45.2
- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.56.2
# Install tools without `GO111MODULE` enabled so that we
# don't download Pebble's deps and just put the tools in our
# gobin.
Expand All @@ -56,6 +56,7 @@ script:
# Upload collected coverage profile to goveralls
- goveralls -coverprofile=coverage.out -service=travis-ci
# Perform a test issuance with chisel2.py
- pip install -r test/requirements.txt
- REQUESTS_CA_BUNDLE=./test/certs/pebble.minica.pem python ./test/chisel2.py example.letsencrypt.org elpmaxe.letsencrypt.org
# Run the load-generator briefly - note, because Pebble isn't using the
# load-generator's mock DNS server none of the issuances will succeed. This
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
image: Visual Studio 2019
image: Visual Studio 2022

hosts:
example.letsencrypt.org: 127.0.0.1
elpmaxe.letsencrypt.org: 127.0.0.1

environment:
PATH: C:\Python38;C:\msys64\mingw64\bin;%USERPROFILE%\go\bin;%PATH%
PATH: C:\Python39-x64;C:\msys64\mingw64\bin;%USERPROFILE%\go\bin;%PATH%
PEBBLE_WFE_NONCEREJECT: 0

# Declare artifacts that can become release assets on GitHub
Expand Down
1 change: 0 additions & 1 deletion cmd/pebble/main_test.go

This file was deleted.

9 changes: 2 additions & 7 deletions wfe/wfe.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,10 +177,6 @@ func New(
ca *ca.CAImpl,
strict, requireEAB bool, retryAfterAuthz int, retryAfterOrder int,
) WebFrontEndImpl {
// Seed rand from the current time so test environments don't always have
// the same nonce rejection and sleep time patterns.
rand.New(rand.NewSource(time.Now().UnixNano()))

// Read the % of good nonces that should be rejected as bad nonces from the
// environment
nonceErrPercentVal := os.Getenv(badNonceEnvVar)
Expand Down Expand Up @@ -611,7 +607,7 @@ func (wfe *WebFrontEndImpl) relativeEndpoint(request *http.Request, endpoint str
proto = "https"
}

// Allow upstream proxies to specify the forwarded protocol. Allow this value
// Allow upstream proxies to specify the forwarded protocol. Allow this value
// to override our own guess.
if specifiedProto := request.Header.Get("X-Forwarded-Proto"); specifiedProto != "" {
proto = specifiedProto
Expand Down Expand Up @@ -2529,8 +2525,7 @@ func addRetryAfterHeader(response http.ResponseWriter, second int) {
} else {
// IMF-fixdate
// see https://datatracker.ietf.org/doc/html/rfc7231#section-7.1.1.1
gmt, _ := time.LoadLocation("GMT")
currentTime := time.Now().In(gmt)
currentTime := time.Now().In(time.UTC)
retryAfter := currentTime.Add(time.Second * time.Duration(second))
response.Header().Add("Retry-After", retryAfter.Format(http.TimeFormat))
}
Expand Down

0 comments on commit ac381e9

Please sign in to comment.