Skip to content

Commit 01fa65a

Browse files
committed
Merge branch 'master' into leaf-verifier-caddyfile
2 parents 5a9471f + 137711a commit 01fa65a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+3378
-607
lines changed

.github/workflows/ci.yml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,28 +12,28 @@ on:
1212
- master
1313
- 2.*
1414

15+
env:
16+
# https://github.com/actions/setup-go/issues/491
17+
GOTOOLCHAIN: local
18+
1519
jobs:
1620
test:
1721
strategy:
1822
# Default is true, cancels jobs for other platforms in the matrix if one fails
1923
fail-fast: false
2024
matrix:
21-
os:
25+
os:
2226
- linux
2327
- mac
2428
- windows
25-
go:
26-
- '1.22'
27-
- '1.23'
29+
go:
30+
- '1.24'
2831

2932
include:
3033
# Set the minimum Go patch version for the given Go minor
3134
# Usable via ${{ matrix.GO_SEMVER }}
32-
- go: '1.22'
33-
GO_SEMVER: '~1.22.3'
34-
35-
- go: '1.23'
36-
GO_SEMVER: '~1.23.0'
35+
- go: '1.24'
36+
GO_SEMVER: '~1.24.1'
3737

3838
# Set some variables per OS, usable via ${{ matrix.VAR }}
3939
# OS_LABEL: the VM label from GitHub Actions (see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories)
@@ -99,7 +99,7 @@ jobs:
9999
env:
100100
CGO_ENABLED: 0
101101
run: |
102-
go build -tags nobadger -trimpath -ldflags="-w -s" -v
102+
go build -tags nobadger,nomysql,nopgx -trimpath -ldflags="-w -s" -v
103103
104104
- name: Smoke test Caddy
105105
working-directory: ./cmd/caddy
@@ -122,7 +122,7 @@ jobs:
122122
# continue-on-error: true
123123
run: |
124124
# (go test -v -coverprofile=cover-profile.out -race ./... 2>&1) > test-results/test-result.out
125-
go test -tags nobadger -v -coverprofile="cover-profile.out" -short -race ./...
125+
go test -tags nobadger,nomysql,nopgx -v -coverprofile="cover-profile.out" -short -race ./...
126126
# echo "status=$?" >> $GITHUB_OUTPUT
127127
128128
# Relevant step if we reinvestigate publishing test/coverage reports
@@ -170,7 +170,7 @@ jobs:
170170
retries=3
171171
exit_code=0
172172
while ((retries > 0)); do
173-
CGO_ENABLED=0 go test -p 1 -tags nobadger -v ./...
173+
CGO_ENABLED=0 go test -p 1 -tags nobadger,nomysql,nopgx -v ./...
174174
exit_code=$?
175175
if ((exit_code == 0)); then
176176
break
@@ -206,7 +206,7 @@ jobs:
206206
- name: Install Go
207207
uses: actions/setup-go@v5
208208
with:
209-
go-version: "~1.23"
209+
go-version: "~1.24"
210210
check-latest: true
211211
- name: Install xcaddy
212212
run: |

.github/workflows/cross-build.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ on:
1010
- master
1111
- 2.*
1212

13+
env:
14+
# https://github.com/actions/setup-go/issues/491
15+
GOTOOLCHAIN: local
16+
1317
jobs:
1418
build:
1519
strategy:
1620
fail-fast: false
1721
matrix:
18-
goos:
22+
goos:
1923
- 'aix'
2024
- 'linux'
2125
- 'solaris'
@@ -26,18 +30,14 @@ jobs:
2630
- 'windows'
2731
- 'darwin'
2832
- 'netbsd'
29-
go:
30-
- '1.22'
31-
- '1.23'
33+
go:
34+
- '1.24'
3235

3336
include:
3437
# Set the minimum Go patch version for the given Go minor
3538
# Usable via ${{ matrix.GO_SEMVER }}
36-
- go: '1.22'
37-
GO_SEMVER: '~1.22.3'
38-
39-
- go: '1.23'
40-
GO_SEMVER: '~1.23.0'
39+
- go: '1.24'
40+
GO_SEMVER: '~1.24.1'
4141

4242
runs-on: ubuntu-latest
4343
continue-on-error: true

.github/workflows/lint.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ on:
1313
permissions:
1414
contents: read
1515

16+
env:
17+
# https://github.com/actions/setup-go/issues/491
18+
GOTOOLCHAIN: local
19+
1620
jobs:
1721
# From https://github.com/golangci/golangci-lint-action
1822
golangci:
@@ -43,7 +47,7 @@ jobs:
4347
- uses: actions/checkout@v4
4448
- uses: actions/setup-go@v5
4549
with:
46-
go-version: '~1.23'
50+
go-version: '~1.24'
4751
check-latest: true
4852

4953
- name: golangci-lint
@@ -63,5 +67,5 @@ jobs:
6367
- name: govulncheck
6468
uses: golang/govulncheck-action@v1
6569
with:
66-
go-version-input: '~1.23.0'
70+
go-version-input: '~1.24.1'
6771
check-latest: true

.github/workflows/release.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- 'v*.*.*'
77

8+
env:
9+
# https://github.com/actions/setup-go/issues/491
10+
GOTOOLCHAIN: local
11+
812
jobs:
913
release:
1014
name: Release
@@ -13,13 +17,13 @@ jobs:
1317
os:
1418
- ubuntu-latest
1519
go:
16-
- '1.23'
20+
- '1.24'
1721

1822
include:
1923
# Set the minimum Go patch version for the given Go minor
2024
# Usable via ${{ matrix.GO_SEMVER }}
21-
- go: '1.23'
22-
GO_SEMVER: '~1.23.0'
25+
- go: '1.24'
26+
GO_SEMVER: '~1.24.1'
2327

2428
runs-on: ${{ matrix.os }}
2529
# https://github.com/sigstore/cosign/issues/1258#issuecomment-1002251233

.goreleaser.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ archives:
111111
- id: default
112112
format_overrides:
113113
- goos: windows
114-
format: zip
114+
formats: zip
115115
name_template: >-
116116
{{ .ProjectName }}_
117117
{{- .Version }}_

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<a href="https://github.com/caddyserver/caddy/actions/workflows/ci.yml"><img src="https://github.com/caddyserver/caddy/actions/workflows/ci.yml/badge.svg"></a>
1717
<a href="https://pkg.go.dev/github.com/caddyserver/caddy/v2"><img src="https://img.shields.io/badge/godoc-reference-%23007d9c.svg"></a>
1818
<br>
19-
<a href="https://twitter.com/caddyserver" title="@caddyserver on Twitter"><img src="https://img.shields.io/badge/twitter-@caddyserver-55acee.svg" alt="@caddyserver on Twitter"></a>
19+
<a href="https://x.com/caddyserver" title="@caddyserver on Twitter"><img src="https://img.shields.io/twitter/follow/caddyserver" alt="@caddyserver on Twitter"></a>
2020
<a href="https://caddy.community" title="Caddy Forum"><img src="https://img.shields.io/badge/community-forum-ff69b4.svg" alt="Caddy Forum"></a>
2121
<br>
2222
<a href="https://sourcegraph.com/github.com/caddyserver/caddy?badge" title="Caddy on Sourcegraph"><img src="https://sourcegraph.com/github.com/caddyserver/caddy/-/badge.svg" alt="Caddy on Sourcegraph"></a>
@@ -67,6 +67,7 @@
6767
- Fully-managed local CA for internal names & IPs
6868
- Can coordinate with other Caddy instances in a cluster
6969
- Multi-issuer fallback
70+
- Encrypted ClientHello (ECH) support
7071
- **Stays up when other servers go down** due to TLS/OCSP/certificate-related issues
7172
- **Production-ready** after serving trillions of requests and managing millions of TLS certificates
7273
- **Scales to hundreds of thousands of sites** as proven in production
@@ -87,7 +88,7 @@ See [our online documentation](https://caddyserver.com/docs/install) for other i
8788

8889
Requirements:
8990

90-
- [Go 1.22.3 or newer](https://golang.org/dl/)
91+
- [Go 1.24.0 or newer](https://golang.org/dl/)
9192

9293
### For development
9394

@@ -176,7 +177,7 @@ The docs are also open source. You can contribute to them here: https://github.c
176177

177178
## Getting help
178179

179-
- We advise companies using Caddy to secure a support contract through [Ardan Labs](https://www.ardanlabs.com/my/contact-us?dd=caddy) before help is needed.
180+
- We advise companies using Caddy to secure a support contract through [Ardan Labs](https://www.ardanlabs.com) before help is needed.
180181

181182
- A [sponsorship](https://github.com/sponsors/mholt) goes a long way! We can offer private help to sponsors. If Caddy is benefitting your company, please consider a sponsorship. This not only helps fund full-time work to ensure the longevity of the project, it provides your company the resources, support, and discounts you need; along with being a great look for your company to your customers and potential customers!
182183

@@ -192,8 +193,8 @@ Matthew Holt began developing Caddy in 2014 while studying computer science at B
192193

193194
**The name "Caddy" is trademarked.** The name of the software is "Caddy", not "Caddy Server" or "CaddyServer". Please call it "Caddy" or, if you wish to clarify, "the Caddy web server". Caddy is a registered trademark of Stack Holdings GmbH.
194195

195-
- _Project on Twitter: [@caddyserver](https://twitter.com/caddyserver)_
196-
- _Author on Twitter: [@mholt6](https://twitter.com/mholt6)_
196+
- _Project on X: [@caddyserver](https://x.com/caddyserver)_
197+
- _Author on X: [@mholt6](https://x.com/mholt6)_
197198

198199
Caddy is a project of [ZeroSSL](https://zerossl.com), a Stack Holdings company.
199200

admin.go

Lines changed: 39 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,8 @@ func (admin *AdminConfig) newAdminHandler(addr NetworkAddress, remote bool, _ Co
221221
if remote {
222222
muxWrap.remoteControl = admin.Remote
223223
} else {
224-
muxWrap.enforceHost = !addr.isWildcardInterface()
224+
// see comment in allowedOrigins() as to why we disable the host check for unix/fd networks
225+
muxWrap.enforceHost = !addr.isWildcardInterface() && !addr.IsUnixNetwork() && !addr.IsFdNetwork()
225226
muxWrap.allowedOrigins = admin.allowedOrigins(addr)
226227
muxWrap.enforceOrigin = admin.EnforceOrigin
227228
}
@@ -310,47 +311,43 @@ func (admin AdminConfig) allowedOrigins(addr NetworkAddress) []*url.URL {
310311
for _, o := range admin.Origins {
311312
uniqueOrigins[o] = struct{}{}
312313
}
313-
if admin.Origins == nil {
314+
// RFC 2616, Section 14.26:
315+
// "A client MUST include a Host header field in all HTTP/1.1 request
316+
// messages. If the requested URI does not include an Internet host
317+
// name for the service being requested, then the Host header field MUST
318+
// be given with an empty value."
319+
//
320+
// UPDATE July 2023: Go broke this by patching a minor security bug in 1.20.6.
321+
// Understandable, but frustrating. See:
322+
// https://github.com/golang/go/issues/60374
323+
// See also the discussion here:
324+
// https://github.com/golang/go/issues/61431
325+
//
326+
// We can no longer conform to RFC 2616 Section 14.26 from either Go or curl
327+
// in purity. (Curl allowed no host between 7.40 and 7.50, but now requires a
328+
// bogus host; see https://superuser.com/a/925610.) If we disable Host/Origin
329+
// security checks, the infosec community assures me that it is secure to do
330+
// so, because:
331+
//
332+
// 1) Browsers do not allow access to unix sockets
333+
// 2) DNS is irrelevant to unix sockets
334+
//
335+
// If either of those two statements ever fail to hold true, it is not the
336+
// fault of Caddy.
337+
//
338+
// Thus, we do not fill out allowed origins and do not enforce Host
339+
// requirements for unix sockets. Enforcing it leads to confusion and
340+
// frustration, when UDS have their own permissions from the OS.
341+
// Enforcing host requirements here is effectively security theater,
342+
// and a false sense of security.
343+
//
344+
// See also the discussion in #6832.
345+
if admin.Origins == nil && !addr.IsUnixNetwork() && !addr.IsFdNetwork() {
314346
if addr.isLoopback() {
315-
if addr.IsUnixNetwork() || addr.IsFdNetwork() {
316-
// RFC 2616, Section 14.26:
317-
// "A client MUST include a Host header field in all HTTP/1.1 request
318-
// messages. If the requested URI does not include an Internet host
319-
// name for the service being requested, then the Host header field MUST
320-
// be given with an empty value."
321-
//
322-
// UPDATE July 2023: Go broke this by patching a minor security bug in 1.20.6.
323-
// Understandable, but frustrating. See:
324-
// https://github.com/golang/go/issues/60374
325-
// See also the discussion here:
326-
// https://github.com/golang/go/issues/61431
327-
//
328-
// We can no longer conform to RFC 2616 Section 14.26 from either Go or curl
329-
// in purity. (Curl allowed no host between 7.40 and 7.50, but now requires a
330-
// bogus host; see https://superuser.com/a/925610.) If we disable Host/Origin
331-
// security checks, the infosec community assures me that it is secure to do
332-
// so, because:
333-
// 1) Browsers do not allow access to unix sockets
334-
// 2) DNS is irrelevant to unix sockets
335-
//
336-
// I am not quite ready to trust either of those external factors, so instead
337-
// of disabling Host/Origin checks, we now allow specific Host values when
338-
// accessing the admin endpoint over unix sockets. I definitely don't trust
339-
// DNS (e.g. I don't trust 'localhost' to always resolve to the local host),
340-
// and IP shouldn't even be used, but if it is for some reason, I think we can
341-
// at least be reasonably assured that 127.0.0.1 and ::1 route to the local
342-
// machine, meaning that a hypothetical browser origin would have to be on the
343-
// local machine as well.
344-
uniqueOrigins[""] = struct{}{}
345-
uniqueOrigins["127.0.0.1"] = struct{}{}
346-
uniqueOrigins["::1"] = struct{}{}
347-
} else {
348-
uniqueOrigins[net.JoinHostPort("localhost", addr.port())] = struct{}{}
349-
uniqueOrigins[net.JoinHostPort("::1", addr.port())] = struct{}{}
350-
uniqueOrigins[net.JoinHostPort("127.0.0.1", addr.port())] = struct{}{}
351-
}
352-
}
353-
if !addr.IsUnixNetwork() && !addr.IsFdNetwork() {
347+
uniqueOrigins[net.JoinHostPort("localhost", addr.port())] = struct{}{}
348+
uniqueOrigins[net.JoinHostPort("::1", addr.port())] = struct{}{}
349+
uniqueOrigins[net.JoinHostPort("127.0.0.1", addr.port())] = struct{}{}
350+
} else {
354351
uniqueOrigins[addr.JoinHostPort(0)] = struct{}{}
355352
}
356353
}
@@ -1139,7 +1136,7 @@ traverseLoop:
11391136
return fmt.Errorf("[%s] invalid array index '%s': %v",
11401137
path, idxStr, err)
11411138
}
1142-
if idx < 0 || idx >= len(arr) {
1139+
if idx < 0 || (method != http.MethodPut && idx >= len(arr)) || idx > len(arr) {
11431140
return fmt.Errorf("[%s] array index out of bounds: %s", path, idxStr)
11441141
}
11451142
}

0 commit comments

Comments
 (0)