Skip to content

Commit e5321cd

Browse files
authored
Merge branch 'master' into etienne/prodsec-76
2 parents e1baf44 + 77f5918 commit e5321cd

64 files changed

Lines changed: 2467 additions & 617 deletions

Some content is hidden

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

.github/workflows/conventional-commits.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ permissions:
2121

2222
jobs:
2323
check-conventional-commits:
24-
runs-on: ubuntu-latest
24+
runs-on: blacksmith-2vcpu-ubuntu-2404
2525
if: github.actor != 'dependabot[bot]' # skip for dependabot PRs
2626
env:
2727
EVENT: ${{ toJSON(github.event) }}

.github/workflows/dogfooding.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ permissions:
1313

1414
jobs:
1515
check_dogfooding:
16-
runs-on: ubuntu-latest
16+
runs-on: blacksmith-2vcpu-ubuntu-2404
1717
steps:
1818
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
1919
if: github.event.pull_request.base.ref == 'master' && github.event.pull_request.head.ref == 'release-please--branches--master'

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
publish:
17-
runs-on: ubuntu-latest
17+
runs-on: blacksmith-4vcpu-ubuntu-2404
1818
permissions:
1919
contents: read
2020
packages: write

.github/workflows/release.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ permissions:
1414

1515
jobs:
1616
release_please:
17-
runs-on: ubuntu-latest
17+
runs-on: blacksmith-4vcpu-ubuntu-2404
1818
permissions:
1919
contents: write
2020
pull-requests: write
@@ -190,9 +190,15 @@ jobs:
190190
FULL_NOTES=$(printf "%s\n\n%s\n" "$EXISTING_NOTES" "$CHECKSUM_CONTENT")
191191
GH_TOKEN='${{ github.token }}' gh release edit $RELEASE_NAME -n "$FULL_NOTES"
192192
193-
GH_TOKEN='${{ github.token }}' gh release upload $RELEASE_NAME ./auth-v$RELEASE_VERSION-x86.tar.gz ./auth-v$RELEASE_VERSION-arm64.tar.gz ./auth-v$RELEASE_VERSION-arm64.tar.xz ./auth-v$RELEASE_VERSION-darwin-arm64.tar.gz
193+
GH_TOKEN='${{ github.token }}' gh release upload $RELEASE_NAME \
194+
./auth-v$RELEASE_VERSION-x86.tar.gz \
195+
./auth-v$RELEASE_VERSION-arm64.tar.gz \
196+
./auth-v$RELEASE_VERSION-darwin-arm64.tar.gz \
197+
./auth-v$RELEASE_VERSION-amd64.tar.xz \
198+
./auth-v$RELEASE_VERSION-arm64.tar.xz
194199
195200
# Upload to Supabase internal bucket
201+
aws s3 cp ./auth-v$RELEASE_VERSION-amd64.tar.xz s3://supabase-internal-artifacts/auth/$RELEASE_VERSION/
196202
aws s3 cp ./auth-v$RELEASE_VERSION-arm64.tar.xz s3://supabase-internal-artifacts/auth/$RELEASE_VERSION/
197203
198204
publish:

.github/workflows/test.yml

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ permissions:
1111
contents: read
1212

1313
jobs:
14-
test:
15-
runs-on: ubuntu-latest
14+
test_postgres:
15+
name: Test / Postgres
16+
runs-on: blacksmith-4vcpu-ubuntu-2404
1617
services:
1718
postgres:
1819
image: postgres:15
@@ -69,3 +70,35 @@ jobs:
6970
- uses: shogo82148/actions-goveralls@25f5320d970fb565100cf1993ada29be1bb196a1 # v1.10.0
7071
with:
7172
path-to-profile: coverage.out
73+
74+
test_oriole:
75+
name: Test / OrioleDB
76+
runs-on: blacksmith-4vcpu-ubuntu-2404
77+
services:
78+
postgres:
79+
image: orioledb/orioledb:latest-pg17
80+
env:
81+
POSTGRES_USER: postgres
82+
POSTGRES_PASSWORD: root
83+
POSTGRES_DB: postgres
84+
POSTGRES_INITDB_ARGS: "--locale=C"
85+
ports:
86+
- 5432:5432
87+
options: >-
88+
--health-cmd pg_isready
89+
--health-interval 10s
90+
--health-timeout 5s
91+
--health-retries 5
92+
steps:
93+
- name: Checkout code
94+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
95+
- name: Install Go
96+
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
97+
with:
98+
go-version-file: go.mod
99+
- name: Init Database
100+
run: psql -f hack/init_postgres.sql postgresql://postgres:root@localhost:5432/postgres
101+
- name: Run migrations
102+
run: make migrate_dev
103+
- name: Run tests
104+
run: go test ./... -p 1 -race -v -count=1

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.env*
22
vendor/
3+
tools/bin/
34
gotrue
45
gotrue-arm64
56
gotrue.exe

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# Changelog
22

3+
## [2.189.0](https://github.com/supabase/auth/compare/v2.188.1...v2.189.0) (2026-04-23)
4+
5+
6+
### Features
7+
8+
* add PKCE support for `/resend` ([#2401](https://github.com/supabase/auth/issues/2401)) ([2af904a](https://github.com/supabase/auth/commit/2af904a2bcd78ee3b64b9e29424dfa78e9616233))
9+
* improve parallelization in github workflows and Makefile ([#2436](https://github.com/supabase/auth/issues/2436)) ([9d0c4b3](https://github.com/supabase/auth/commit/9d0c4b3f8859a4d1b5a48ce5962a5fa9accdae61))
10+
* **passkeys:** add CAPTCHA to options endpoint for authentication ([#2416](https://github.com/supabase/auth/issues/2416)) ([c7b58be](https://github.com/supabase/auth/commit/c7b58be5cc520dcc0963ec3346807561c176624b))
11+
* support live reloading of individual rate limits ([#2469](https://github.com/supabase/auth/issues/2469)) ([d03d796](https://github.com/supabase/auth/commit/d03d796162779d51ce58bf1b56b0991ec86700bc))
12+
13+
14+
### Bug Fixes
15+
16+
* ensure identities are returned in a consistent order across DB engines ([#2465](https://github.com/supabase/auth/issues/2465)) ([e49a3e5](https://github.com/supabase/auth/commit/e49a3e5e5dd5a75abdaa0a52a62f644470737e3a))
17+
* ensure SSO providers tests are order-independent ([#2466](https://github.com/supabase/auth/issues/2466)) ([983ade6](https://github.com/supabase/auth/commit/983ade65789fce94cb632d154905d594181389a2))
18+
* exempt PKCE recovery sessions from require-current-password check ([#2502](https://github.com/supabase/auth/issues/2502)) ([7f88985](https://github.com/supabase/auth/commit/7f889859787c72f59ea8b820d9d0f388965252ff))
19+
* **indexworker:** skip index creation on OrioleDB ([#2481](https://github.com/supabase/auth/issues/2481)) ([dd56ae9](https://github.com/supabase/auth/commit/dd56ae91eb5bf64519ff650b58066338fd1a9b20))
20+
* **passkeys:** modify the passkeys request and response shapes ([#2475](https://github.com/supabase/auth/issues/2475)) ([2d8f2b6](https://github.com/supabase/auth/commit/2d8f2b6168cfc753f55c7bd157bfda6ef05af007))
21+
* prevent reuse of flow state ([#2483](https://github.com/supabase/auth/issues/2483)) ([88dcb2d](https://github.com/supabase/auth/commit/88dcb2d290a7c06cfff707ddf918b08f25ec141c))
22+
* return JSON response for unmatched routes instead of plain text ([#2457](https://github.com/supabase/auth/issues/2457)) ([7337e21](https://github.com/supabase/auth/commit/7337e21c288c93951cfef3b60c1988ead296c4b7))
23+
324
## [2.188.1](https://github.com/supabase/auth/compare/v2.188.0...v2.188.1) (2026-03-19)
425

526

Makefile

Lines changed: 47 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,48 @@ BUILD_CMD = go build \
2323
-buildvcs=false \
2424
-ldflags "$(BUILD_LD_FLAGS)$(2)"
2525

26-
RELEASE_TARGETS = x86 arm64 darwin-arm64 arm64-strip
26+
RELEASE_TARGETS = x86 arm64 darwin-arm64 amd64-strip arm64-strip
2727
RELEASE_ARCHIVES = \
2828
auth-$(VERSION)-x86.tar.gz \
2929
auth-$(VERSION)-arm64.tar.gz \
3030
auth-$(VERSION)-darwin-arm64.tar.gz \
31+
auth-$(VERSION)-amd64.tar.xz \
3132
auth-$(VERSION)-arm64.tar.xz
3233

34+
TOOL_BIN_DIR = tools/bin
35+
TOOL_TARGETS = \
36+
$(TOOL_BIN_DIR)/gosec \
37+
$(TOOL_BIN_DIR)/staticcheck \
38+
$(TOOL_BIN_DIR)/govulncheck
39+
3340

3441
help: ## Show this help.
3542
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
3643

3744
all: vet sec static build ## Run the tests and build the binary.
3845

39-
build: auth auth-arm64 auth-darwin-arm64 ## Build the binaries.
46+
build: auth auth-amd64 auth-arm64 auth-darwin-arm64 ## Build the binaries.
4047

41-
build-strip: auth-arm64-strip ## Build a stripped binary, for which the version file needs to be rewritten.
48+
build-strip: auth-amd64-strip auth-arm64-strip ## Build a stripped binary, for which the version file needs to be rewritten.
4249

4350
auth: deps
4451
CGO_ENABLED=0 $(call BUILD_CMD,$(@),)
4552

4653
auth-x86: deps
4754
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(call BUILD_CMD,$(@),)
4855

56+
auth-amd64: deps
57+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(call BUILD_CMD,$(@),)
58+
4959
auth-arm64: deps
5060
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(call BUILD_CMD,$(@),)
5161

5262
auth-darwin-arm64: deps
5363
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(call BUILD_CMD,$(@),)
5464

65+
auth-amd64-strip: deps
66+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(call BUILD_CMD,$(@), -s)
67+
5568
auth-arm64-strip: deps
5669
CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(call BUILD_CMD,$(@), -s)
5770

@@ -73,6 +86,12 @@ auth-$(VERSION)-%.tar.gz: \
7386
release-%/gotrue | migrations
7487
tar -C $(<D) -czvf $(@) auth gotrue -C ../ migrations/
7588

89+
auth-$(VERSION)-amd64.tar.xz: \
90+
release-amd64-strip/auth \
91+
release-amd64-strip/gotrue | migrations
92+
tar -C $(<D) -cf - auth gotrue -C ../ migrations/ \
93+
| xz -T0 -9e -C crc64 > $(@)
94+
7695
auth-$(VERSION)-arm64.tar.xz: \
7796
release-arm64-strip/auth \
7897
release-arm64-strip/gotrue | migrations
@@ -99,34 +118,35 @@ test: auth ## Run tests.
99118
vet: # Vet the code
100119
go vet $(CHECK_FILES)
101120

102-
sec: check-gosec # Check for security vulnerabilities
103-
gosec -quiet -exclude-generated -exclude=G117,G120,G704 $(CHECK_FILES)
104-
gosec -quiet -tests -exclude-generated -exclude=G101,G104,G117,G120,G704 $(CHECK_FILES)
105-
106-
check-gosec:
107-
@command -v gosec >/dev/null 2>&1 \
108-
|| go install github.com/securego/gosec/v2/cmd/gosec@latest
109-
110-
vulncheck: check-govulncheck # Check for known vulnerabilities
111-
govulncheck -format json $(CHECK_FILES) | go run ./hack/vulncheck-filter
112-
113-
check-govulncheck:
114-
@command -v govulncheck >/dev/null 2>&1 \
115-
|| go install golang.org/x/vuln/cmd/govulncheck@latest
116-
117-
unused: | check-staticcheck # Look for unused code
121+
.NOTPARALLEL: $(TOOL_TARGETS)
122+
$(TOOL_TARGETS):
123+
$(MAKE) -C tools
124+
125+
sec: | $(TOOL_BIN_DIR)/gosec # Check for security vulnerabilities
126+
$(TOOL_BIN_DIR)/gosec \
127+
-quiet \
128+
-exclude-generated \
129+
-exclude=G117,G120,G704 \
130+
$(CHECK_FILES)
131+
$(TOOL_BIN_DIR)/gosec \
132+
-quiet \
133+
-tests \
134+
-exclude-generated \
135+
-exclude=G101,G104,G117,G120,G704 \
136+
$(CHECK_FILES)
137+
138+
vulncheck: $(TOOL_BIN_DIR)/govulncheck # Check for known vulnerabilities
139+
$(TOOL_BIN_DIR)/govulncheck -format json $(CHECK_FILES) | go run ./hack/vulncheck-filter
140+
141+
unused: | $(TOOL_BIN_DIR)/staticcheck # Look for unused code
118142
@echo "Unused code:"
119-
staticcheck -checks U1000 $(CHECK_FILES)
143+
$(TOOL_BIN_DIR)/staticcheck -checks U1000 $(CHECK_FILES)
120144
@echo
121145
@echo "Code used only in _test.go (do move it in those files):"
122-
staticcheck -checks U1000 -tests=false $(CHECK_FILES)
123-
124-
static: | check-staticcheck
125-
staticcheck ./...
146+
$(TOOL_BIN_DIR)/staticcheck -checks U1000 -tests=false $(CHECK_FILES)
126147

127-
check-staticcheck:
128-
@command -v staticcheck >/dev/null 2>&1 \
129-
|| go install honnef.co/go/tools/cmd/staticcheck@latest
148+
static: | $(TOOL_BIN_DIR)/staticcheck
149+
$(TOOL_BIN_DIR)/staticcheck ./...
130150

131151
generate: | check-oapi-codegen
132152
go generate ./...

cmd/serve_cmd.go

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/sirupsen/logrus"
1515
"github.com/spf13/cobra"
1616
"github.com/supabase/auth/internal/api"
17+
"github.com/supabase/auth/internal/api/apilimiter"
1718
"github.com/supabase/auth/internal/api/apiworker"
1819
"github.com/supabase/auth/internal/conf"
1920
"github.com/supabase/auth/internal/mailer/templatemailer"
@@ -63,10 +64,10 @@ func serve(ctx context.Context) {
6364
defer wg.Wait() // Do not return to caller until this goroutine is done.
6465

6566
mrCache := templatemailer.NewCache()
66-
limiterOpts := api.NewLimiterOptions(config)
67+
initialLim := apilimiter.New(config)
6768
initialAPI := api.NewAPIWithVersion(
6869
config, db, utilities.Version,
69-
limiterOpts,
70+
api.WithLimiter(initialLim),
7071
api.WithMailer(templatemailer.FromConfig(config, mrCache)),
7172
)
7273

@@ -92,11 +93,11 @@ func serve(ctx context.Context) {
9293

9394
var err error
9495
defer func() {
95-
logFn := wrkLog.Info
96-
if err != nil {
97-
logFn = wrkLog.WithError(err).Error
96+
exitFn := wrkLog.Info
97+
if err != nil && !errors.Is(err, context.Canceled) {
98+
exitFn = wrkLog.WithError(err).Error
9899
}
99-
logFn("background apiworker is exiting")
100+
exitFn("background apiworker is exiting")
100101
}()
101102

102103
// Work exits when ctx is done as in-flight requests do not depend
@@ -124,17 +125,18 @@ func serve(ctx context.Context) {
124125
var err error
125126
defer func() {
126127
exitFn := le.Info
127-
if err != nil {
128+
if err != nil && !errors.Is(err, context.Canceled) {
128129
exitFn = le.WithError(err).Error
129130
}
130131
exitFn("config reloader is exiting")
131132
}()
132133

134+
previousLim := initialLim
133135
fn := func(latestCfg *conf.GlobalConfiguration) {
134136
le.Info("reloading api with new configuration")
135137

136-
// When config is updated we notify the apiworker.
137-
wrk.ReloadConfig(latestCfg)
138+
// Update the previous limiter with the latest config
139+
latestLim := previousLim.Update(le, latestCfg)
138140

139141
// Create a new API version with the updated config.
140142
latestAPI := api.NewAPIWithVersion(
@@ -146,19 +148,21 @@ func serve(ctx context.Context) {
146148
),
147149

148150
// Persist existing rate limiters.
149-
//
150-
// TODO(cstockton): we should consider updating these, if we
151-
// rely on hot config reloads 100% then rate limiter changes
152-
// won't be picked up.
153-
limiterOpts,
151+
api.WithLimiter(latestLim),
154152
)
153+
154+
// Assign this config as the latest configuration
155155
ah.Store(latestAPI)
156+
157+
// When config is updated we notify the apiworker.
158+
wrk.ReloadConfig(latestCfg)
159+
160+
// Update previous limiter
161+
previousLim = latestLim
156162
}
157163

158164
rl := reloader.NewReloader(rc, watchDir)
159-
if err = rl.Watch(ctx, fn); err != nil {
160-
log.WithError(err).Error("config reloader is exiting")
161-
}
165+
err = rl.Watch(ctx, fn)
162166
}()
163167
}
164168

0 commit comments

Comments
 (0)