-
-
Notifications
You must be signed in to change notification settings - Fork 964
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
feat: client-side PKCE take 3 #4078
Changes from all commits
51453e4
b8a5832
ee0fcd3
91b5cd3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,8 @@ $(call make-lint-dependency) | |
echo "deprecated usage, use docs/cli instead" | ||
go build -o .bin/clidoc ./cmd/clidoc/. | ||
|
||
.PHONY: .bin/yq | ||
.bin/yq: | ||
go build -o .bin/yq github.com/mikefarah/yq/v4 | ||
.bin/yq: Makefile | ||
GOBIN=$(PWD)/.bin go install github.com/mikefarah/yq/[email protected] | ||
|
||
.PHONY: docs/cli | ||
docs/cli: | ||
|
@@ -58,17 +57,31 @@ docs/swagger: | |
curl https://raw.githubusercontent.com/ory/meta/master/install.sh | bash -s -- -b .bin ory v0.2.2 | ||
touch -a -m .bin/ory | ||
|
||
.bin/buf: Makefile | ||
curl -sSL \ | ||
"https://github.com/bufbuild/buf/releases/download/v1.39.0/buf-$(shell uname -s)-$(shell uname -m).tar.gz" | \ | ||
tar -xvzf - -C ".bin/" --strip-components=2 buf/bin/buf buf/bin/protoc-gen-buf-breaking buf/bin/protoc-gen-buf-lint | ||
touch -a -m .bin/buf | ||
|
||
.PHONY: lint | ||
lint: .bin/golangci-lint | ||
golangci-lint run -v --timeout 10m ./... | ||
.bin/golangci-lint run -v --timeout 10m ./... | ||
.bin/buf lint | ||
|
||
.PHONY: mocks | ||
mocks: .bin/mockgen | ||
mockgen -mock_names Manager=MockLoginExecutorDependencies -package internal -destination internal/hook_login_executor_dependencies.go github.com/ory/kratos/selfservice loginExecutorDependencies | ||
|
||
.PHONY: proto | ||
proto: gen/oidc/v1/state.pb.go | ||
|
||
gen/oidc/v1/state.pb.go: proto/oidc/v1/state.proto buf.yaml buf.gen.yaml .bin/buf .bin/goimports | ||
.bin/buf generate | ||
.bin/goimports -w gen/ | ||
|
||
.PHONY: install | ||
install: | ||
GO111MODULE=on go install -tags sqlite . | ||
go install -tags sqlite . | ||
|
||
.PHONY: test-resetdb | ||
test-resetdb: | ||
|
@@ -163,11 +176,12 @@ authors: # updates the AUTHORS file | |
|
||
# Formats the code | ||
.PHONY: format | ||
format: .bin/goimports .bin/ory node_modules | ||
.bin/ory dev headers copyright --exclude=internal/httpclient --exclude=internal/client-go --exclude test/e2e/proxy/node_modules --exclude test/e2e/node_modules --exclude node_modules | ||
format: .bin/goimports .bin/ory node_modules .bin/buf | ||
.bin/ory dev headers copyright --exclude=gen --exclude=internal/httpclient --exclude=internal/client-go --exclude test/e2e/proxy/node_modules --exclude test/e2e/node_modules --exclude node_modules | ||
goimports -w -local github.com/ory . | ||
npm exec -- prettier --write 'test/e2e/**/*{.ts,.js}' | ||
npm exec -- prettier --write '.github' | ||
.bin/buf format --write | ||
|
||
# Build local docker image | ||
.PHONY: docker | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: v2 | ||
managed: | ||
enabled: true | ||
override: | ||
- file_option: go_package_prefix | ||
value: github.com/ory/kratos | ||
plugins: | ||
- remote: buf.build/protocolbuffers/go | ||
out: gen | ||
opt: paths=source_relative | ||
inputs: | ||
- directory: proto |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: v2 | ||
modules: | ||
- path: proto | ||
lint: | ||
use: | ||
- DEFAULT | ||
breaking: | ||
use: | ||
- FILE |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,6 @@ package identities_test | |
|
||
import ( | ||
"context" | ||
"encoding/hex" | ||
"encoding/json" | ||
"testing" | ||
|
||
|
@@ -63,10 +62,12 @@ func TestGetCmd(t *testing.T) { | |
return out | ||
} | ||
transform := func(token string) string { | ||
if !encrypt { | ||
return token | ||
if encrypt { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume this changed because we now, somewhere, properly check if the token can be decrypted and then this test failed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Exactly. I changed most tests across Kratos to actually use encryption, and this one was the only one to fail. Good sign :) |
||
s, err := reg.Cipher(context.Background()).Encrypt(context.Background(), []byte(token)) | ||
require.NoError(t, err) | ||
return s | ||
} | ||
return hex.EncodeToString([]byte(token)) | ||
return token | ||
} | ||
return identity.Credentials{ | ||
Type: identity.CredentialsTypeOIDC, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is taken from cryptopasta, if I recall correctly. Could you point me to the documentation / issue this addresses? This method is being used in several places, and I am worried this will introduce regressions. Granted, MaxInt is pretty large.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The AES-GCM code comes from cryptopasta. The XChaCha code was hand-written from the start.
In an earlier revision of this PR, I touched this code but reverted it later to the original version. GitHub's security scanner then started complaining, correctly, that the size calculation below could overflow. Even though the code was unchanged from master. So I added this assertion, which is the exact same as the one in Hydra.