Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement/rebase supabase #6

Open
wants to merge 114 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
114 commits
Select commit Hold shift + click to select a range
07fdc5d
feat: initial workos implementation
HarryET Nov 13, 2021
7f93e2f
Fix trailing spaces in WorkOS name
HarryET Nov 15, 2021
79381df
fix: correct provider names
Jan 17, 2022
2e86364
chore: apply latest commits
Jan 25, 2022
dcd9b67
chore: run gofmt
Jan 25, 2022
405eebc
chore: strip https on workos link
Feb 4, 2022
d5fcc82
ExternalProviderRedirect: pass query parameters into `Provider` function
bnjmnt4n Feb 25, 2022
c15ea63
Tweak `example.env`
bnjmnt4n Feb 25, 2022
11ffa84
WorkOS provider: construct custom authorization URL from request quer…
bnjmnt4n Feb 25, 2022
81dabf5
Go modules: add `github.com/mitchellh/mapstructure`
bnjmnt4n Feb 25, 2022
760b246
WorkOS provider: obtain user data from response from authorization en…
bnjmnt4n Feb 27, 2022
35e5183
WorkOS provider: return error when returned profile has no email
bnjmnt4n Feb 27, 2022
114d878
WorkOS provider: rename `provider` query parameter
bnjmnt4n Feb 26, 2022
34068bc
WorkOS provider: add more comprehensive tests
bnjmnt4n Feb 26, 2022
20c18c3
Tests: tweak `assertAuthorizationSuccess` to accept empty strings for…
bnjmnt4n Feb 26, 2022
1cddd51
WorkOS provider: do not mark emails as verified
bnjmnt4n Feb 28, 2022
638b5d0
WorkOS provider: fix tests by enabling autoconfirm
bnjmnt4n Feb 28, 2022
bcb1d5a
Revert "WorkOS provider: fix tests by enabling autoconfirm"
bnjmnt4n Mar 2, 2022
6807ae5
Revert "WorkOS provider: do not mark emails as verified"
bnjmnt4n Mar 2, 2022
fa4b7e6
fix: azure api_url config (#407)
kangmingtay Mar 4, 2022
6fce185
WorkOS provider: add `connection_id` and `organization_id` custom claims
bnjmnt4n Mar 4, 2022
41ec9c2
Merge pull request #402 from bnjmnt4n/providers/workos
J0 Mar 5, 2022
3e92e8d
fix: allow max db pool size to be configurable (#409)
kangmingtay Mar 7, 2022
32b0802
fix: update user email should not fail when current email doesn't exi…
kangmingtay Mar 8, 2022
6de5ec1
fix: Keycloak OAuth Provider (#371)
fspijkerman Mar 8, 2022
9489d7e
fix: set idle_in_transaction_session_timeout to 5min (#418)
kangmingtay Mar 20, 2022
fefed99
fix: no longer hardcode username for migration (#419)
darora Mar 21, 2022
b611f1a
fix: allow user to update phone number (#421)
kangmingtay Mar 22, 2022
3356266
fix: add `UserSignedUpAction` to the audit log when the user is uncon…
bnjmnt4n Mar 23, 2022
460b31b
fix: re-use existing connection's transaction in `emailChangeVerify` …
bnjmnt4n Mar 23, 2022
18a8a5f
fix: default nil interface to empty byte slice (#422)
kangmingtay Mar 23, 2022
95fa5f6
fix: ensure confirmation & phone change sent at is saved (#425)
kangmingtay Mar 24, 2022
924a8a5
fix: SmsOtp should still send otp the first time when sms autoconfirm…
kangmingtay Mar 24, 2022
5b08af3
fix: allow enforcing of reauthentication when user updates password (…
kangmingtay Mar 25, 2022
17587e5
fix: remove migration that requires elevated privileges (#428)
darora Mar 27, 2022
1cde881
fix: wrap error returned by GetSmsProvider (#429)
kangmingtay Mar 27, 2022
b296849
fix: reauthenticate bugs (#431)
kangmingtay Mar 29, 2022
b4d9ca3
fix: user email & phone update (#432)
kangmingtay Mar 30, 2022
c83d01e
fix: use email change template for current and new (#433)
kangmingtay Mar 31, 2022
51313fc
fix bugs in verify
kangmingtay Mar 31, 2022
1548ccd
fix: add rate limit env vars
kangmingtay Apr 1, 2022
a47bfad
change expiredTokenError to return unauthorized
kangmingtay Apr 1, 2022
03d1708
refactor verify into verifyGet and verifyPost
kangmingtay Apr 1, 2022
5cd1dd8
fix verify tests
kangmingtay Apr 1, 2022
722abab
increase rate limit on verify endpoint for test env
kangmingtay Apr 1, 2022
ff4539b
Merge pull request #435 from supabase/km/refactor-verify
awalias Apr 1, 2022
0f5091f
fix: adds support for wildcards in redirect URIs (#334)
milanvanschaik Apr 15, 2022
a67a77d
fix: Only require nonce in id_token when also passed in body (#430)
DanMossa Apr 15, 2022
359c66d
Add dev containers with hot reload
nwneisen Apr 17, 2022
dd54189
fix: validate email & phone number in shouldCreateUser (#448)
kangmingtay Apr 18, 2022
ecc55ab
Add docs and cleanup
nwneisen Apr 19, 2022
bb7f120
Merge pull request #450 from nwneisen/dev-setup
J0 Apr 19, 2022
c64f331
fix: shorten email otp (#446)
kangmingtay Apr 23, 2022
ca839e4
fix: change Discord's discriminator type to string (#457)
bariqhibat Apr 26, 2022
60a7a6f
fix: unique index should not apply to phone otps (#460)
kangmingtay Apr 29, 2022
a4af211
fix: bump gotrue to v2.6.25 (#461)
kangmingtay Apr 29, 2022
b02f838
fix: discord discriminator (#462)
kangmingtay Apr 29, 2022
48d6554
fix: update migration for creating partial indices (#463)
kangmingtay Apr 29, 2022
94e2234
chore: update docker-compose to use ports instead of host networking
kangmingtay May 4, 2022
6a6e3be
fix: add reuse interval for token refresh (#466)
kangmingtay May 5, 2022
7df9004
chore: rename rate limit token endpoint env var (#470)
kangmingtay May 5, 2022
c9bce60
overwrite existing env if envfile provided
kangmingtay May 5, 2022
d91f8f9
revert docker-compose to use hot reload
kangmingtay May 5, 2022
07df71d
add example docker env file
kangmingtay May 5, 2022
362480d
cleanup unnecesary commands
kangmingtay May 5, 2022
478166c
update contributing guide
kangmingtay May 11, 2022
05627a2
simplify make dev cmd
kangmingtay May 11, 2022
960c70c
add quick start instructions for docker
kangmingtay May 11, 2022
3eec285
Merge pull request #468 from supabase/km/chore-docker-dev
J0 May 11, 2022
1685bf2
fix: add http timeout to add external provider requests (#471)
kangmingtay May 11, 2022
8689fd2
fix: do not exclude updated_at (#473)
kangmingtay May 11, 2022
e781ee9
chore: dependabot
kangmingtay May 26, 2022
f3cc0ce
Merge pull request #480 from supabase/km/update-dependabot
J0 May 26, 2022
e22cbc7
fix: add auth.jwt() function (#484)
kangmingtay May 31, 2022
ac93ce7
fix$docker-compose: add double quotes to command
Jun 1, 2022
e01be0d
fix: log auth actions (#479)
kangmingtay Jun 1, 2022
ea37dae
Merge pull request #486 from pieveee/fix/docker-compose-command-bug
J0 Jun 2, 2022
0d5d599
fix: update auth.jwt function (#488)
kangmingtay Jun 3, 2022
e012415
docs: update uri_allow_list description (#487)
kangmingtay Jun 3, 2022
8ef6798
fix: bubble up specific publicly accessible Postgres error messages (…
bnjmnt4n Jun 6, 2022
c353dbb
fix: add configurable hcaptcha timeout (#441)
J0 Jun 7, 2022
94b5e85
refactor: add phone param
Jun 10, 2022
30cdb36
chore: remove update comment
Jun 10, 2022
19abe10
Update user.go
J0 Jun 10, 2022
d54fe40
Merge pull request #495 from supabase/j0_refactor_new_user
J0 Jun 10, 2022
bfaa68e
chore: specify an application_name when running migrations
darora Jun 14, 2022
eafe66e
chore: add IP address field
Jun 14, 2022
5e10354
chore: switch db type to inet
Jun 14, 2022
b390146
Revert "chore: switch db type to inet"
Jun 14, 2022
702a515
chore:reduce number of chars permitted
Jun 14, 2022
df6bf87
fix: add IP Address to logs
Jun 14, 2022
7568953
fix: increase size of ip address field
Jun 14, 2022
c9f1ed5
Merge pull request #499 from supabase/j0_add_ip_address_field
J0 Jun 15, 2022
de08885
ci: add gofmt check
Jun 23, 2022
067d039
fix: handle all non-2xx errors (#515)
kangmingtay Jun 27, 2022
895644e
fix: bump gotrue version (#518)
kangmingtay Jun 27, 2022
56b938e
chore: switch to gofmt -s -w .
Jun 29, 2022
30607dc
Merge pull request #510 from supabase/j0_add_formatting_checks
J0 Jun 29, 2022
7d9635d
Update README.md
J0 Jun 29, 2022
13f9863
Merge pull request #519 from supabase/J0-docs-update
J0 Jun 29, 2022
32a6e1f
feat: add captcha to verify and token endpoints (#520)
kangmingtay Jun 29, 2022
0177301
fix: go fmt -> gofmt (#522)
J0 Jun 30, 2022
28aafd0
chore: Add CODEOWNERS (#525)
hf Jul 1, 2022
9bc1b66
Edit keycloak url
expandboard Jul 5, 2022
80e1de0
Merge pull request #1 from expandboard/expandboard-patch-keycloakUrl
expandboard Jul 5, 2022
bc44b28
Merge pull request #532 from expandboard/master
J0 Jul 5, 2022
397c949
fix: shorten email otp length (#513)
kangmingtay Jul 5, 2022
45756e3
Feature: Asymmetric key authentication & RS256 JWT signature
Oct 8, 2021
30d6ab8
Enhancement: Add Kaigara to the Dockerfile
dpatsora Mar 3, 2022
3e874a4
Fix: update tests
dpatsora Mar 3, 2022
b75749a
feat: First user as superadmin (#4)
eliot-blankenberg Mar 8, 2022
94da029
Feature: Upgrade Kaigara to support sql storage (#5)
xenirio Mar 28, 2022
451848a
feature(ci): add .drone.yml w/ Docker build
vshatravenko Mar 29, 2022
f943b0f
feature: update Kaigara version in the Dockerfile
philanton May 3, 2022
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
26 changes: 26 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
type: docker
kind: pipeline
name: "Main"

steps:
- name: Docker build Git SHA
image: plugins/docker:20
pull: if-not-exists
environment:
DOCKER_BUILDKIT: 1
settings:
username:
from_secret: quay_username
password:
from_secret: quay_password
repo: quay.io/openware/gotrue
registry: quay.io
tag: ${DRONE_COMMIT:0:7}
purge: false
when:
event:
- push
branch:
- stable/ow
- feature/asymmetric-auth
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v2
- name: Formatting checks
run: if [ ! -z $(gofmt -l .) ]; then echo 'Make sure to run "gofmt -s -w ." before commit!' && exit 1; fi
- name: Init Database
run: psql -f hack/init_postgres.sql postgresql://postgres:root@localhost:5432/postgres
- name: Run migrations
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @supabase/auth
42 changes: 42 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,48 @@ Docs aren't perfect and so we're here to help. If you're stuck on setup for more

Please help us keep all our projects open and inclusive. Kindly follow our [Code of Conduct](<(CODE_OF_CONDUCT.md)>) to keep the ecosystem healthy and friendly for all.

## Quick Start

GoTrue has a development container setup that makes it easy to get started contributing. This setup only requires that [Docker](https://www.docker.com/get-started) is setup on your system. The development container setup includes a PostgreSQL container with migrations already applied and a container running GoTrue that will perform a hot reload when changes to the source code are detected.

If you would like to run GoTrue locally or learn more about what these containers are doing for you, continue reading the [Setup and Tooling](#setup-and-tooling) section below. Otherwise, you can skip ahead to the [How To Verify that GoTrue is Available](#how-to-verify-that-gotrue-is-available) section to learn about working with and developing GoTrue.

Before using the containers, you will need to make sure an `.env.docker` file exists by making a copy of `example.docker.env` and configuring it for your needs. The set of env vars in `example.docker.env` only contain the necessary env vars for gotrue to start in a docker environment. For the full list of env vars, please refer to `example.env` and copy over the necessary ones into your `.env.docker` file.

The following are some basic commands. A full and up to date list of commands can be found in the project's `Makefile` or by running `make help`.

### Starting the containers

Start the containers as described above in an attached state with log output.

``` bash
make dev
```

### Running tests in the containers

Start the containers with a fresh database and run the project's tests.

``` bash
make docker-test
```

### Removing the containers

Remove both containers and their volumes. This removes any data associated with the containers.

``` bash
make docker-clean
```

### Rebuild the containers

Fully rebuild the containers without using any cached layers.

``` bash
make docker-build
```

## Setup and Tooling

GoTrue -- as the name implies -- is a user registration and authentication API developed in [Go](https://go.dev).
Expand Down
7 changes: 6 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux

RUN apk add --no-cache make git
RUN apk add --no-cache make git curl

WORKDIR /go/src/github.com/netlify/gotrue

Expand All @@ -15,11 +15,16 @@ RUN make deps
COPY . /go/src/github.com/netlify/gotrue
RUN make build

ARG KAIGARA_VERSION=v1.0.10
RUN curl -Lo ./kaigara https://github.com/openware/kaigara/releases/download/${KAIGARA_VERSION}/kaigara \
&& chmod +x ./kaigara

FROM alpine:3.15
RUN adduser -D -u 1000 netlify

RUN apk add --no-cache ca-certificates
COPY --from=build /go/src/github.com/netlify/gotrue/gotrue /usr/local/bin/gotrue
COPY --from=build /go/src/github.com/netlify/gotrue/kaigara /usr/local/bin/kaigara
COPY --from=build /go/src/github.com/netlify/gotrue/migrations /usr/local/etc/gotrue/migrations/

ENV GOTRUE_DB_MIGRATIONS_PATH /usr/local/etc/gotrue/migrations
Expand Down
18 changes: 18 additions & 0 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM golang:1.17-alpine
ENV GO111MODULE=on
ENV CGO_ENABLED=0
ENV GOOS=linux

RUN apk add --no-cache make git bash

WORKDIR /go/src/github.com/netlify/gotrue

# Pulling dependencies
COPY ./Makefile ./go.* ./

# Production dependencies
RUN make deps

# Development dependences
RUN go get github.com/githubnemo/CompileDaemon
RUN go install github.com/githubnemo/CompileDaemon
31 changes: 27 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.PHONY: all build deps image lint migrate test vet
CHECK_FILES?=$$(go list ./... | grep -v /vendor/)
FLAGS?=-ldflags "-X github.com/netlify/gotrue/cmd.Version=`git describe --tags`"
DEV_DOCKER_COMPOSE:=docker-compose-dev.yml

help: ## Show this help.
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {sub("\\\\n",sprintf("\n%22c"," "), $$2);printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
Expand All @@ -12,13 +13,10 @@ build: ## Build the binary.
GOOS=linux GOARCH=arm64 go build $(FLAGS) -o gotrue-arm64

deps: ## Install dependencies.
@go install github.com/gobuffalo/pop/soda@latest
@go install github.com/gobuffalo/pop/soda@latest
@go install golang.org/x/lint/golint@latest
@go mod download

image: ## Build the Docker image.
docker build .

lint: ## Lint the code.
golint $(CHECK_FILES)

Expand All @@ -33,3 +31,28 @@ test: ## Run tests.

vet: # Vet the code
go vet $(CHECK_FILES)

dev: ## Run the development containers
docker-compose -f $(DEV_DOCKER_COMPOSE) up

down: ## Shutdown the development containers
# Start postgres first and apply migrations
docker-compose -f $(DEV_DOCKER_COMPOSE) down

docker-test: ## Run the tests using the development containers
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make migrate_test"
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make test"
docker-compose -f $(DEV_DOCKER_COMPOSE) down -v

docker-build: ## Force a full rebuild of the development containers
docker-compose -f $(DEV_DOCKER_COMPOSE) build --no-cache
docker-compose -f $(DEV_DOCKER_COMPOSE) up -d postgres
docker-compose -f $(DEV_DOCKER_COMPOSE) run gotrue sh -c "make migrate_dev"
docker-compose -f $(DEV_DOCKER_COMPOSE) down

docker-clean: ## Remove the development containers and volumes
docker-compose -f $(DEV_DOCKER_COMPOSE) rm -fsv

format:
gofmt -s -w .
Loading