From ea5e959dd6d7e5a5cf9f0d01db2d004ed440741f Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 30 Nov 2021 00:01:34 +0000 Subject: [PATCH 01/37] autogen(docs): update milestone document --- docs/docs/milestones.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/milestones.md b/docs/docs/milestones.md index e21050b3ba6c..0892ac48e0b7 100644 --- a/docs/docs/milestones.md +++ b/docs/docs/milestones.md @@ -294,7 +294,7 @@ New feature or request. [@hackerman](https://github.com/aeneasr) - [ ] Admin/Selfservice session management ([kratos#655](https://github.com/ory/kratos/issues/655)) - - [@Alano Terblanche](https://github.com/Benehiko) + [@Patrik](https://github.com/zepatrik) - [ ] Write new recovery and verification strategy that does not rely on links ([kratos#1451](https://github.com/ory/kratos/issues/1451)) - [ ] Delete self-service flows after completion From 8515e17938570770ca4cbf93028782925e28f431 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 30 Nov 2021 08:13:26 +0100 Subject: [PATCH 02/37] fix: docs links (#2008) --- docs/docs/quickstart.mdx | 10 +++++----- docs/versioned_docs/version-v0.8/quickstart.mdx | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs/docs/quickstart.mdx b/docs/docs/quickstart.mdx index 407dea6a1f15..0e0ce0d04e56 100644 --- a/docs/docs/quickstart.mdx +++ b/docs/docs/quickstart.mdx @@ -599,14 +599,14 @@ Here is some information should you want to modify the quickstart: **Social Login** -[Step-by-step guides](./guides/sign-in-with-github-google-facebook-linkedin) to +[Step-by-step guides](guides/sign-in-with-github-google-facebook-linkedin/) to add sign up and login with popular OIDC providers to the Ory Kratos Quickstart, for example: -- [GitHub](./guides/sign-in-with-github-google-facebook-linkedin#github) -- [Google](./guides/sign-in-with-github-google-facebook-linkedin#google) -- [Facebook](./guides/sign-in-with-github-google-facebook-linkedin#facebook) and - [many more](./guides/sign-in-with-github-google-facebook-linkedin). +- [GitHub](guides/sign-in-with-github-google-facebook-linkedin/#github) +- [Google](guides/sign-in-with-github-google-facebook-linkedin/#google) +- [Facebook](guides/sign-in-with-github-google-facebook-linkedin/#facebook) and + [many more](guides/sign-in-with-github-google-facebook-linkedin/). **Use a different database** diff --git a/docs/versioned_docs/version-v0.8/quickstart.mdx b/docs/versioned_docs/version-v0.8/quickstart.mdx index dd7857e761d5..1d8c9a0a6ccd 100644 --- a/docs/versioned_docs/version-v0.8/quickstart.mdx +++ b/docs/versioned_docs/version-v0.8/quickstart.mdx @@ -599,14 +599,14 @@ Here is some information should you want to modify the quickstart: **Social Login** -[Step-by-step guides](./guides/sign-in-with-github-google-facebook-linkedin) to +[Step-by-step guides](guides/sign-in-with-github-google-facebook-linkedin/) to add sign up and login with popular OIDC providers to the Ory Kratos Quickstart, for example: -- [GitHub](./guides/sign-in-with-github-google-facebook-linkedin#github) -- [Google](./guides/sign-in-with-github-google-facebook-linkedin#google) -- [Facebook](./guides/sign-in-with-github-google-facebook-linkedin#facebook) and - [many more](./guides/sign-in-with-github-google-facebook-linkedin). +- [GitHub](guides/sign-in-with-github-google-facebook-linkedin/#github) +- [Google](guides/sign-in-with-github-google-facebook-linkedin/#google) +- [Facebook](guides/sign-in-with-github-google-facebook-linkedin/#facebook) and + [many more](guides/sign-in-with-github-google-facebook-linkedin/). **Use a different database** From 8f96bf4ef0a68bab9ce57034434a5d778888a81a Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 30 Nov 2021 07:23:43 +0000 Subject: [PATCH 03/37] autogen(docs): generate and format documentation From 12918dbf4b0edb2857e06736aee9cccf1a5f76ff Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 30 Nov 2021 16:53:19 +0100 Subject: [PATCH 04/37] docs: minor fixes (#2010) --- docs/docs/concepts/security.mdx | 7 +++---- .../sign-in-with-github-google-facebook-linkedin.mdx | 4 ++-- docs/versioned_docs/version-v0.8/concepts/security.mdx | 10 +++------- .../sign-in-with-github-google-facebook-linkedin.mdx | 2 +- 4 files changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/docs/concepts/security.mdx b/docs/docs/concepts/security.mdx index b57d59967368..1b275a22f2bf 100644 --- a/docs/docs/concepts/security.mdx +++ b/docs/docs/concepts/security.mdx @@ -385,7 +385,7 @@ Allow the user to show the secret in the UI: :::warning This feature is a work in progress and is tracked as -[kratos#133](https://github.com/ory/kratos/issues/138). +[kratos#138](https://github.com/ory/kratos/issues/138). ::: @@ -395,9 +395,8 @@ systems. The goal of such an attack is to send out so many emails or SMS, that your reputation worsens (spam filters) or you're faced with massive costs (carrier fees). -CAPTCHA renders these attacks either very difficult or impossible. Ory Kratos -has CAPTCHA support built-in. Ory Kratos will prompt the user to complete a -CAPTCHA in the following scenarios: +CAPTCHA renders these attacks either very difficult or impossible. +CAPTCHA will be required in the following scenarios: - The user tries to register more than one account within 72 hours. - The user failed provide valid credentials for the third time within 12 hours. diff --git a/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx b/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx index c36ecd4d7d40..38856294f9be 100644 --- a/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx +++ b/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx @@ -3,8 +3,8 @@ id: sign-in-with-github-google-facebook-linkedin title: Sign in with GitHub, GitLab, Google, Facebook, LinkedIn, Microsoft ... --- -In this document we will take a look at setting up "Sign in with GitHub" using -Ory Kratos. +In this document we will take a look at setting up "Social Sign In" with +different providers using Ory Kratos. Run the [Quickstart](../quickstart.mdx) with Docker Compose: diff --git a/docs/versioned_docs/version-v0.8/concepts/security.mdx b/docs/versioned_docs/version-v0.8/concepts/security.mdx index b57d59967368..6aaa55ad374a 100644 --- a/docs/versioned_docs/version-v0.8/concepts/security.mdx +++ b/docs/versioned_docs/version-v0.8/concepts/security.mdx @@ -385,7 +385,7 @@ Allow the user to show the secret in the UI: :::warning This feature is a work in progress and is tracked as -[kratos#133](https://github.com/ory/kratos/issues/138). +[kratos#138](https://github.com/ory/kratos/issues/138). ::: @@ -395,17 +395,13 @@ systems. The goal of such an attack is to send out so many emails or SMS, that your reputation worsens (spam filters) or you're faced with massive costs (carrier fees). -CAPTCHA renders these attacks either very difficult or impossible. Ory Kratos -has CAPTCHA support built-in. Ory Kratos will prompt the user to complete a -CAPTCHA in the following scenarios: +CAPTCHA renders these attacks either very difficult or impossible. +CAPTCHA will be required in the following scenarios: - The user tries to register more than one account within 72 hours. - The user failed provide valid credentials for the third time within 12 hours. - The user tries to recover their account for the second time within 72 hours. -For integration guidelines, please check the individual flow's (registration, -login, account recovery) integration documentation. - ## Bruteforce Attacks Will be addressed in a future release. diff --git a/docs/versioned_docs/version-v0.8/guides/sign-in-with-github-google-facebook-linkedin.mdx b/docs/versioned_docs/version-v0.8/guides/sign-in-with-github-google-facebook-linkedin.mdx index c36ecd4d7d40..de611084fca1 100644 --- a/docs/versioned_docs/version-v0.8/guides/sign-in-with-github-google-facebook-linkedin.mdx +++ b/docs/versioned_docs/version-v0.8/guides/sign-in-with-github-google-facebook-linkedin.mdx @@ -3,7 +3,7 @@ id: sign-in-with-github-google-facebook-linkedin title: Sign in with GitHub, GitLab, Google, Facebook, LinkedIn, Microsoft ... --- -In this document we will take a look at setting up "Sign in with GitHub" using +In this document we will take a look at setting up "Social Sign In" with different providers using Ory Kratos. Run the [Quickstart](../quickstart.mdx) with Docker Compose: From ee217e9c918980689c4386b42e5e830f34a18ae2 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 30 Nov 2021 15:54:51 +0000 Subject: [PATCH 05/37] autogen(docs): generate cli docs --- docs/docs/concepts/security.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/concepts/security.mdx b/docs/docs/concepts/security.mdx index 1b275a22f2bf..dc5433ae1d48 100644 --- a/docs/docs/concepts/security.mdx +++ b/docs/docs/concepts/security.mdx @@ -395,8 +395,8 @@ systems. The goal of such an attack is to send out so many emails or SMS, that your reputation worsens (spam filters) or you're faced with massive costs (carrier fees). -CAPTCHA renders these attacks either very difficult or impossible. -CAPTCHA will be required in the following scenarios: +CAPTCHA renders these attacks either very difficult or impossible. CAPTCHA will +be required in the following scenarios: - The user tries to register more than one account within 72 hours. - The user failed provide valid credentials for the third time within 12 hours. From 0bb66de582ebcb501c161655ae00e276a1d7d5d2 Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 1 Dec 2021 12:37:24 +0100 Subject: [PATCH 06/37] test: fix changed message ID (#2013) --- .../profiles/verification/registration/errors.spec.ts | 2 +- .../integration/profiles/verification/verify/errors.spec.ts | 4 ++-- .../integration/profiles/verification/verify/success.spec.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test/e2e/cypress/integration/profiles/verification/registration/errors.spec.ts b/test/e2e/cypress/integration/profiles/verification/registration/errors.spec.ts index a8288043a5af..b45193f83c56 100644 --- a/test/e2e/cypress/integration/profiles/verification/registration/errors.spec.ts +++ b/test/e2e/cypress/integration/profiles/verification/registration/errors.spec.ts @@ -54,7 +54,7 @@ context('Account Verification Registration Errors', () => { cy.get(appPrefix(app) + 'input[name="email"]').should('be.empty') cy.get('input[name="email"]').type(identity.email) cy.get('button[value="link"]').click() - cy.get('[data-testid="ui/message/1070001"]').should( + cy.get('[data-testid="ui/message/1080001"]').should( 'contain.text', 'An email containing a verification' ) diff --git a/test/e2e/cypress/integration/profiles/verification/verify/errors.spec.ts b/test/e2e/cypress/integration/profiles/verification/verify/errors.spec.ts index 43d1ccf509db..74c6c1ec40d6 100644 --- a/test/e2e/cypress/integration/profiles/verification/verify/errors.spec.ts +++ b/test/e2e/cypress/integration/profiles/verification/verify/errors.spec.ts @@ -54,7 +54,7 @@ context('Account Verification Error', () => { cy.get('input[name="email"]').type(identity.email) cy.get('button[value="link"]').click() - cy.get('[data-testid="ui/message/1070001"]').should( + cy.get('[data-testid="ui/message/1080001"]').should( 'contain.text', 'An email containing a verification' ) @@ -66,7 +66,7 @@ context('Account Verification Error', () => { cy.get('input[name="email"]').type(identity.email) cy.get('button[value="link"]').click() - cy.get('[data-testid="ui/message/1070001"]').should( + cy.get('[data-testid="ui/message/1080001"]').should( 'contain.text', 'An email containing a verification' ) diff --git a/test/e2e/cypress/integration/profiles/verification/verify/success.spec.ts b/test/e2e/cypress/integration/profiles/verification/verify/success.spec.ts index 5119768d3693..58d540ed9c63 100644 --- a/test/e2e/cypress/integration/profiles/verification/verify/success.spec.ts +++ b/test/e2e/cypress/integration/profiles/verification/verify/success.spec.ts @@ -37,7 +37,7 @@ context('Account Verification Settings Success', () => { cy.get('input[name="email"]').type(identity.email) cy.get('button[value="link"]').click() - cy.get('[data-testid="ui/message/1070001"]').should( + cy.get('[data-testid="ui/message/1080001"]').should( 'contain.text', 'An email containing a verification' ) @@ -52,7 +52,7 @@ context('Account Verification Settings Success', () => { cy.get('input[name="email"]').type(email) cy.get('button[value="link"]').click() - cy.get('[data-testid="ui/message/1070001"]').should( + cy.get('[data-testid="ui/message/1080001"]').should( 'contain.text', 'An email containing a verification' ) From 4cd63b975e651abbcf260a22bcd4ee6629417459 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Wed, 1 Dec 2021 11:46:00 +0000 Subject: [PATCH 07/37] autogen(docs): generate and format documentation From ea868b4cc8f73dda19b1a01851420ba8cd210923 Mon Sep 17 00:00:00 2001 From: Patrik Date: Wed, 1 Dec 2021 17:14:43 +0100 Subject: [PATCH 08/37] ci: bump goreleaser orb (#2014) --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 7225961ad0ec..5680bdad5a48 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,7 +2,7 @@ version: 2.1 orbs: changelog: ory/changelog@0.1.10 - goreleaser: ory/goreleaser@0.1.36 + goreleaser: ory/goreleaser@0.1.37 slack: circleci/slack@3.4.2 sdk: ory/sdk@0.1.52 docs: ory/docs@0.0.12 From 97fed155a8c9d5e33e1bf9c46bf0a823d72e16d1 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Wed, 1 Dec 2021 16:22:37 +0000 Subject: [PATCH 09/37] autogen(docs): generate and format documentation From 981f4e3299e0c5d1629480c9defa9cba8ffaa111 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Thu, 2 Dec 2021 00:01:32 +0000 Subject: [PATCH 10/37] autogen(docs): update milestone document --- docs/docs/milestones.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/docs/milestones.md b/docs/docs/milestones.md index 0892ac48e0b7..f58e8e6cc5ce 100644 --- a/docs/docs/milestones.md +++ b/docs/docs/milestones.md @@ -334,6 +334,9 @@ Something is not working. #### Issues +- [ ] Resumable session is not cleared up on error + ([kratos#2016](https://github.com/ory/kratos/issues/2016)) - + [@hackerman](https://github.com/aeneasr) - [x] Unmable to use Auth0 as a generic OIDC provider ([kratos#609](https://github.com/ory/kratos/issues/609)) - [x] Typescript ErrorContainer type is incorrect From dd890ab96727d7a2c8c2f52279dc3516096213f0 Mon Sep 17 00:00:00 2001 From: Denis Palnitsky Date: Thu, 2 Dec 2021 15:43:04 +0100 Subject: [PATCH 11/37] docs: add `Content-Type` to recommended CORS allowed headers (#2015) --- docs/docs/guides/setting-up-cors.mdx | 1 + docs/versioned_docs/version-v0.8/guides/setting-up-cors.mdx | 1 + 2 files changed, 2 insertions(+) diff --git a/docs/docs/guides/setting-up-cors.mdx b/docs/docs/guides/setting-up-cors.mdx index d6ccd0361416..3bc2da3d75ee 100644 --- a/docs/docs/guides/setting-up-cors.mdx +++ b/docs/docs/guides/setting-up-cors.mdx @@ -26,6 +26,7 @@ serve: allowed_headers: - Authorization - Cookie + - Content-Type exposed_headers: - Content-Type - Set-Cookie diff --git a/docs/versioned_docs/version-v0.8/guides/setting-up-cors.mdx b/docs/versioned_docs/version-v0.8/guides/setting-up-cors.mdx index d6ccd0361416..3bc2da3d75ee 100644 --- a/docs/versioned_docs/version-v0.8/guides/setting-up-cors.mdx +++ b/docs/versioned_docs/version-v0.8/guides/setting-up-cors.mdx @@ -26,6 +26,7 @@ serve: allowed_headers: - Authorization - Cookie + - Content-Type exposed_headers: - Content-Type - Set-Cookie From 947ad62429986a03a3b6debe69539e494af847ed Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Thu, 2 Dec 2021 14:51:06 +0000 Subject: [PATCH 12/37] autogen(docs): generate and format documentation From dd460db14aeca66324043ce46cb4eff674ec62f6 Mon Sep 17 00:00:00 2001 From: Patrik Date: Fri, 3 Dec 2021 12:09:55 +0100 Subject: [PATCH 13/37] chore: fix issues reported by the CI (#2018) --- cmd/clidoc/main.go | 4 ---- internal/driver.go | 2 +- persistence/reference.go | 1 - persistence/sql/persister.go | 15 ++++----------- selfservice/flow/settings/strategy_helper.go | 3 +-- .../profiles/email/login/success.spec.ts | 8 ++++++-- test/e2e/cypress/support/commands.ts | 6 ++---- test/e2e/proxy/package-lock.json | 1 - text/id_test.go | 3 ++- 9 files changed, 16 insertions(+), 27 deletions(-) diff --git a/cmd/clidoc/main.go b/cmd/clidoc/main.go index 6d0c57e8e0d0..a7cdbff8f3b9 100644 --- a/cmd/clidoc/main.go +++ b/cmd/clidoc/main.go @@ -269,7 +269,3 @@ func validateAllMessages(path string) error { return nil } - -type importerFunc func(path string) (*types.Package, error) - -func (f importerFunc) Import(path string) (*types.Package, error) { return f(path) } diff --git a/internal/driver.go b/internal/driver.go index 487096f7f8ae..d1b0b17598e8 100644 --- a/internal/driver.go +++ b/internal/driver.go @@ -80,7 +80,7 @@ func NewRegistryDefaultWithDSN(t *testing.T, dsn string) (*config.Config, *drive require.NoError(t, err) reg.Config(context.Background()).MustSet("dev", true) require.NoError(t, reg.Init(context.Background(), driver.SkipNetworkInit)) - require.NoError(t, reg.Persister().NetworkMigrateUp(context.Background())) + require.NoError(t, reg.Persister().MigrateUp(context.Background())) // always migrate up actual, err := reg.Persister().DetermineNetwork(context.Background()) require.NoError(t, err) diff --git a/persistence/reference.go b/persistence/reference.go index c5f168580aed..0fb89bde0d16 100644 --- a/persistence/reference.go +++ b/persistence/reference.go @@ -48,7 +48,6 @@ type Persister interface { MigrationStatus(c context.Context) (popx.MigrationStatuses, error) MigrateDown(c context.Context, steps int) error MigrateUp(c context.Context) error - NetworkMigrateUp(c context.Context) error Migrator() *popx.Migrator GetConnection(ctx context.Context) *pop.Connection Transaction(ctx context.Context, callback func(ctx context.Context, connection *pop.Connection) error) error diff --git a/persistence/sql/persister.go b/persistence/sql/persister.go index e06a768b653c..e54a0ae0e65c 100644 --- a/persistence/sql/persister.go +++ b/persistence/sql/persister.go @@ -5,6 +5,8 @@ import ( "embed" "fmt" + "github.com/ory/x/fsx" + "github.com/ory/kratos/corp" "github.com/gobuffalo/pop/v5" @@ -49,10 +51,11 @@ type ( ) func NewPersister(ctx context.Context, r persisterDependencies, c *pop.Connection) (*Persister, error) { - m, err := popx.NewMigrationBox(migrations, popx.NewMigrator(c, r.Logger(), r.Tracer(ctx), 0)) + m, err := popx.NewMigrationBox(fsx.Merge(migrations, networkx.Migrations), popx.NewMigrator(c, r.Logger(), r.Tracer(ctx), 0)) if err != nil { return nil, err } + m.DumpMigrations = false return &Persister{ c: c, mb: m, r: r, isSQLite: c.Dialect.Name() == "sqlite3", @@ -102,17 +105,7 @@ func (p *Persister) MigrateDown(ctx context.Context, steps int) error { return p.mb.Down(ctx, steps) } -func (p *Persister) NetworkMigrateUp(ctx context.Context) error { - // nolint - return p.p.MigrateUp(ctx) -} - func (p *Persister) MigrateUp(ctx context.Context) error { - // nolint - if err := p.p.MigrateUp(ctx); err != nil { - return err - } - return p.mb.Up(ctx) } diff --git a/selfservice/flow/settings/strategy_helper.go b/selfservice/flow/settings/strategy_helper.go index cdd76f9b2f0e..fa358e767218 100644 --- a/selfservice/flow/settings/strategy_helper.go +++ b/selfservice/flow/settings/strategy_helper.go @@ -1,7 +1,6 @@ package settings import ( - "fmt" "net/http" "runtime/debug" "time" @@ -70,7 +69,7 @@ func PrepareUpdate(d interface { } d.Logger(). WithField("package", pkgName). - WithField("stack_trace", fmt.Sprintf("%s", debug.Stack())). + WithField("stack_trace", string(debug.Stack())). WithField("expected_request_id", payload.GetFlowID()). WithField("actual_request_id", f.ID). Debug("Flow ID from continuity manager does not match Flow ID from request.") diff --git a/test/e2e/cypress/integration/profiles/email/login/success.spec.ts b/test/e2e/cypress/integration/profiles/email/login/success.spec.ts index bc8155636d1a..ce93d8bea8ae 100644 --- a/test/e2e/cypress/integration/profiles/email/login/success.spec.ts +++ b/test/e2e/cypress/integration/profiles/email/login/success.spec.ts @@ -82,17 +82,21 @@ describe('Basic email profile with succeeding login flows', () => { cy.proxy('express') cy.useConfigProfile('email') - cy.shortLoginLifespan() cy.browserReturnUrlOry() }) beforeEach(() => { cy.clearAllCookies() - cy.visit(express.login + '?return_to=https://www.ory.sh/') }) it('should redirect to return_to when retrying expired flow', () => { + cy.shortLoginLifespan() + cy.wait(500) + + cy.visit(express.login + '?return_to=https://www.ory.sh/') + cy.longLoginLifespan() + cy.get(appPrefix('express') + 'input[name="password_identifier"]').type( email.toUpperCase() ) diff --git a/test/e2e/cypress/support/commands.ts b/test/e2e/cypress/support/commands.ts index c3e9fcec2eef..bb1bf686bedc 100644 --- a/test/e2e/cypress/support/commands.ts +++ b/test/e2e/cypress/support/commands.ts @@ -30,11 +30,9 @@ const mergeFields = (form, fields) => { const updateConfigFile = (cb: (arg: any) => any) => { cy.readFile(configFile).then((contents) => { - let config = YAML.parse(contents) - config = cb(config) - cy.writeFile(configFile, YAML.stringify(config)) + cy.writeFile(configFile, YAML.stringify(cb(YAML.parse(contents)))) + cy.wait(200) }) - cy.wait(200) } Cypress.Commands.add('useConfigProfile', (profile: string) => { diff --git a/test/e2e/proxy/package-lock.json b/test/e2e/proxy/package-lock.json index 1a4852f395e8..d559e4ccca62 100644 --- a/test/e2e/proxy/package-lock.json +++ b/test/e2e/proxy/package-lock.json @@ -5,7 +5,6 @@ "requires": true, "packages": { "": { - "name": "proxy", "version": "1.0.0", "dependencies": { "express": "^4.17.1", diff --git a/text/id_test.go b/text/id_test.go index a778a703de0e..21038cd6c8e7 100644 --- a/text/id_test.go +++ b/text/id_test.go @@ -23,7 +23,8 @@ func TestIDs(t *testing.T) { assert.Equal(t, 1060001, int(InfoSelfServiceRecoverySuccessful)) assert.Equal(t, 1060002, int(InfoSelfServiceRecoveryEmailSent)) - assert.Equal(t, 1070000, int(InfoSelfServiceVerification)) + assert.Equal(t, 1070000, int(InfoNodeLabel)) + assert.Equal(t, 1080000, int(InfoSelfServiceVerification)) assert.Equal(t, 4000000, int(ErrorValidation)) assert.Equal(t, 4000001, int(ErrorValidationGeneric)) From 9fa79861130809e34add84ec43ec95964b17124e Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Fri, 3 Dec 2021 11:17:16 +0000 Subject: [PATCH 14/37] autogen(docs): generate and format documentation From 1762a730886707be3549bc6789f65c66d755e1d0 Mon Sep 17 00:00:00 2001 From: Alano Terblanche Date: Mon, 6 Dec 2021 10:27:04 +0100 Subject: [PATCH 15/37] feat: generalise courier (#2019) --- courier/courier.go | 48 ++++++++++++++++-------- courier/courier_test.go | 6 ++- courier/persistence.go | 1 - courier/template/recovery_invalid.go | 6 +-- courier/template/recovery_valid.go | 6 +-- courier/template/stub.go | 6 +-- courier/template/template.go | 7 ++++ courier/template/verification_invalid.go | 6 +-- courier/template/verification_valid.go | 6 +-- courier/templates.go | 36 +++++++++--------- driver/registry_default.go | 14 +++++-- text/id.go | 6 +-- 12 files changed, 86 insertions(+), 62 deletions(-) create mode 100644 courier/template/template.go diff --git a/courier/courier.go b/courier/courier.go index 9f549efa0706..3e800408e560 100644 --- a/courier/courier.go +++ b/courier/courier.go @@ -5,6 +5,7 @@ import ( "crypto/tls" "encoding/json" "fmt" + "net/url" "strconv" "time" @@ -16,27 +17,41 @@ import ( gomail "github.com/ory/mail/v3" - "github.com/ory/kratos/driver/config" "github.com/ory/kratos/x" ) type ( - smtpDependencies interface { + SMTPConfig interface { + CourierSMTPURL() *url.URL + CourierSMTPFrom() string + CourierSMTPFromName() string + CourierSMTPHeaders() map[string]string + CourierTemplatesRoot() string + } + SMTPDependencies interface { PersistenceProvider x.LoggingProvider - config.Provider + ConfigProvider } - Courier struct { - Dialer *gomail.Dialer - d smtpDependencies + TemplateTyper func(t EmailTemplate) (TemplateType, error) + EmailTemplateFromMessage func(c SMTPConfig, msg Message) (EmailTemplate, error) + Courier struct { + Dialer *gomail.Dialer + d SMTPDependencies + GetTemplateType TemplateTyper + NewEmailTemplateFromMessage EmailTemplateFromMessage } Provider interface { Courier(ctx context.Context) *Courier } + ConfigProvider interface { + CourierConfig(ctx context.Context) SMTPConfig + } ) -func NewSMTP(d smtpDependencies, c *config.Config) *Courier { - uri := c.CourierSMTPURL() +func NewSMTP(ctx context.Context, d SMTPDependencies) *Courier { + uri := d.CourierConfig(ctx).CourierSMTPURL() + password, _ := uri.User.Password() port, _ := strconv.ParseInt(uri.Port(), 10, 0) @@ -73,8 +88,10 @@ func NewSMTP(d smtpDependencies, c *config.Config) *Courier { } return &Courier{ - d: d, - Dialer: dialer, + d: d, + Dialer: dialer, + GetTemplateType: GetTemplateType, + NewEmailTemplateFromMessage: NewEmailTemplateFromMessage, } } @@ -94,7 +111,7 @@ func (m *Courier) QueueEmail(ctx context.Context, t EmailTemplate) (uuid.UUID, e return uuid.Nil, err } - templateType, err := GetTemplateType(t) + templateType, err := m.GetTemplateType(t) if err != nil { return uuid.Nil, err } @@ -113,6 +130,7 @@ func (m *Courier) QueueEmail(ctx context.Context, t EmailTemplate) (uuid.UUID, e TemplateType: templateType, TemplateData: templateData, } + if err := m.d.CourierPersister().AddMessage(ctx, message); err != nil { return uuid.Nil, err } @@ -151,8 +169,8 @@ func (m *Courier) watchMessages(ctx context.Context, errChan chan error) { func (m *Courier) DispatchMessage(ctx context.Context, msg Message) error { switch msg.Type { case MessageTypeEmail: - from := m.d.Config(ctx).CourierSMTPFrom() - fromName := m.d.Config(ctx).CourierSMTPFromName() + from := m.d.CourierConfig(ctx).CourierSMTPFrom() + fromName := m.d.CourierConfig(ctx).CourierSMTPFromName() gm := gomail.NewMessage() if fromName == "" { gm.SetHeader("From", from) @@ -163,14 +181,14 @@ func (m *Courier) DispatchMessage(ctx context.Context, msg Message) error { gm.SetHeader("To", msg.Recipient) gm.SetHeader("Subject", msg.Subject) - headers := m.d.Config(ctx).CourierSMTPHeaders() + headers := m.d.CourierConfig(ctx).CourierSMTPHeaders() for k, v := range headers { gm.SetHeader(k, v) } gm.SetBody("text/plain", msg.Body) - tmpl, err := NewEmailTemplateFromMessage(m.d.Config(ctx), msg) + tmpl, err := m.NewEmailTemplateFromMessage(m.d.CourierConfig(ctx), msg) if err != nil { m.d.Logger(). WithError(err). diff --git a/courier/courier_test.go b/courier/courier_test.go index 86499acfcd0b..866a975f30cb 100644 --- a/courier/courier_test.go +++ b/courier/courier_test.go @@ -35,11 +35,13 @@ func TestMain(m *testing.M) { } func TestNewSMTP(t *testing.T) { + ctx := context.Background() + setupConfig := func(stringURL string) *courier.Courier { - conf, _ := internal.NewFastRegistryWithMocks(t) + conf, reg := internal.NewFastRegistryWithMocks(t) conf.MustSet(config.ViperKeyCourierSMTPURL, stringURL) t.Logf("SMTP URL: %s", conf.CourierSMTPURL().String()) - return courier.NewSMTP(nil, conf) + return courier.NewSMTP(ctx, reg) } if testing.Short() { diff --git a/courier/persistence.go b/courier/persistence.go index c3202599397f..54811daefe4b 100644 --- a/courier/persistence.go +++ b/courier/persistence.go @@ -19,7 +19,6 @@ type ( LatestQueuedMessage(ctx context.Context) (*Message, error) } - PersistenceProvider interface { CourierPersister() Persister } diff --git a/courier/template/recovery_invalid.go b/courier/template/recovery_invalid.go index d5a768689dc6..75ea09ed3122 100644 --- a/courier/template/recovery_invalid.go +++ b/courier/template/recovery_invalid.go @@ -2,13 +2,11 @@ package template import ( "encoding/json" - - "github.com/ory/kratos/driver/config" ) type ( RecoveryInvalid struct { - c *config.Config + c TemplateConfig m *RecoveryInvalidModel } RecoveryInvalidModel struct { @@ -16,7 +14,7 @@ type ( } ) -func NewRecoveryInvalid(c *config.Config, m *RecoveryInvalidModel) *RecoveryInvalid { +func NewRecoveryInvalid(c TemplateConfig, m *RecoveryInvalidModel) *RecoveryInvalid { return &RecoveryInvalid{c: c, m: m} } diff --git a/courier/template/recovery_valid.go b/courier/template/recovery_valid.go index 51e58ac4771c..5a84a62bf873 100644 --- a/courier/template/recovery_valid.go +++ b/courier/template/recovery_valid.go @@ -2,13 +2,11 @@ package template import ( "encoding/json" - - "github.com/ory/kratos/driver/config" ) type ( RecoveryValid struct { - c *config.Config + c TemplateConfig m *RecoveryValidModel } RecoveryValidModel struct { @@ -18,7 +16,7 @@ type ( } ) -func NewRecoveryValid(c *config.Config, m *RecoveryValidModel) *RecoveryValid { +func NewRecoveryValid(c TemplateConfig, m *RecoveryValidModel) *RecoveryValid { return &RecoveryValid{c: c, m: m} } diff --git a/courier/template/stub.go b/courier/template/stub.go index 455a60de36f4..87f28a6415d7 100644 --- a/courier/template/stub.go +++ b/courier/template/stub.go @@ -2,12 +2,10 @@ package template import ( "encoding/json" - - "github.com/ory/kratos/driver/config" ) type TestStub struct { - c *config.Config + c TemplateConfig m *TestStubModel } @@ -17,7 +15,7 @@ type TestStubModel struct { Body string } -func NewTestStub(c *config.Config, m *TestStubModel) *TestStub { +func NewTestStub(c TemplateConfig, m *TestStubModel) *TestStub { return &TestStub{c: c, m: m} } diff --git a/courier/template/template.go b/courier/template/template.go new file mode 100644 index 000000000000..0486356fb0e8 --- /dev/null +++ b/courier/template/template.go @@ -0,0 +1,7 @@ +package template + +type ( + TemplateConfig interface { + CourierTemplatesRoot() string + } +) diff --git a/courier/template/verification_invalid.go b/courier/template/verification_invalid.go index 9b6736e56d65..aafc23d242d8 100644 --- a/courier/template/verification_invalid.go +++ b/courier/template/verification_invalid.go @@ -2,13 +2,11 @@ package template import ( "encoding/json" - - "github.com/ory/kratos/driver/config" ) type ( VerificationInvalid struct { - c *config.Config + c TemplateConfig m *VerificationInvalidModel } VerificationInvalidModel struct { @@ -16,7 +14,7 @@ type ( } ) -func NewVerificationInvalid(c *config.Config, m *VerificationInvalidModel) *VerificationInvalid { +func NewVerificationInvalid(c TemplateConfig, m *VerificationInvalidModel) *VerificationInvalid { return &VerificationInvalid{c: c, m: m} } diff --git a/courier/template/verification_valid.go b/courier/template/verification_valid.go index c3814b41d809..5d673646b4b4 100644 --- a/courier/template/verification_valid.go +++ b/courier/template/verification_valid.go @@ -2,13 +2,11 @@ package template import ( "encoding/json" - - "github.com/ory/kratos/driver/config" ) type ( VerificationValid struct { - c *config.Config + c TemplateConfig m *VerificationValidModel } VerificationValidModel struct { @@ -18,7 +16,7 @@ type ( } ) -func NewVerificationValid(c *config.Config, m *VerificationValidModel) *VerificationValid { +func NewVerificationValid(c TemplateConfig, m *VerificationValidModel) *VerificationValid { return &VerificationValid{c: c, m: m} } diff --git a/courier/templates.go b/courier/templates.go index f12cee294459..e04da43e4cb3 100644 --- a/courier/templates.go +++ b/courier/templates.go @@ -6,10 +6,18 @@ import ( "github.com/pkg/errors" "github.com/ory/kratos/courier/template" - "github.com/ory/kratos/driver/config" ) -type TemplateType string +type ( + TemplateType string + EmailTemplate interface { + json.Marshaler + EmailSubject() (string, error) + EmailBody() (string, error) + EmailBodyPlaintext() (string, error) + EmailRecipient() (string, error) + } +) const ( TypeRecoveryInvalid TemplateType = "recovery_invalid" @@ -19,14 +27,6 @@ const ( TypeTestStub TemplateType = "stub" ) -type EmailTemplate interface { - json.Marshaler - EmailSubject() (string, error) - EmailBody() (string, error) - EmailBodyPlaintext() (string, error) - EmailRecipient() (string, error) -} - func GetTemplateType(t EmailTemplate) (TemplateType, error) { switch t.(type) { case *template.RecoveryInvalid: @@ -44,39 +44,39 @@ func GetTemplateType(t EmailTemplate) (TemplateType, error) { } } -func NewEmailTemplateFromMessage(c *config.Config, m Message) (EmailTemplate, error) { - switch m.TemplateType { +func NewEmailTemplateFromMessage(c SMTPConfig, msg Message) (EmailTemplate, error) { + switch msg.TemplateType { case TypeRecoveryInvalid: var t template.RecoveryInvalidModel - if err := json.Unmarshal(m.TemplateData, &t); err != nil { + if err := json.Unmarshal(msg.TemplateData, &t); err != nil { return nil, err } return template.NewRecoveryInvalid(c, &t), nil case TypeRecoveryValid: var t template.RecoveryValidModel - if err := json.Unmarshal(m.TemplateData, &t); err != nil { + if err := json.Unmarshal(msg.TemplateData, &t); err != nil { return nil, err } return template.NewRecoveryValid(c, &t), nil case TypeVerificationInvalid: var t template.VerificationInvalidModel - if err := json.Unmarshal(m.TemplateData, &t); err != nil { + if err := json.Unmarshal(msg.TemplateData, &t); err != nil { return nil, err } return template.NewVerificationInvalid(c, &t), nil case TypeVerificationValid: var t template.VerificationValidModel - if err := json.Unmarshal(m.TemplateData, &t); err != nil { + if err := json.Unmarshal(msg.TemplateData, &t); err != nil { return nil, err } return template.NewVerificationValid(c, &t), nil case TypeTestStub: var t template.TestStubModel - if err := json.Unmarshal(m.TemplateData, &t); err != nil { + if err := json.Unmarshal(msg.TemplateData, &t); err != nil { return nil, err } return template.NewTestStub(c, &t), nil default: - return nil, errors.Errorf("received unexpected message template type: %s", m.TemplateType) + return nil, errors.Errorf("received unexpected message template type: %s", msg.TemplateType) } } diff --git a/driver/registry_default.go b/driver/registry_default.go index c6fe37a9eeba..56b00a024964 100644 --- a/driver/registry_default.go +++ b/driver/registry_default.go @@ -7,6 +7,8 @@ import ( "sync" "time" + "github.com/gobuffalo/pop/v5" + "github.com/ory/nosurf" "github.com/ory/kratos/selfservice/strategy/webauthn" @@ -22,8 +24,6 @@ import ( prometheus "github.com/ory/x/prometheusx" - "github.com/gobuffalo/pop/v5" - "github.com/ory/kratos/cipher" "github.com/ory/kratos/continuity" "github.com/ory/kratos/hash" @@ -259,6 +259,14 @@ func (m *RegistryDefault) Config(ctx context.Context) *config.Config { return corp.ContextualizeConfig(ctx, m.c) } +func (m *RegistryDefault) CourierConfig(ctx context.Context) courier.SMTPConfig { + return m.Config(ctx) +} + +func (m *RegistryDefault) SMTPConfig(ctx context.Context) courier.SMTPConfig { + return m.Config(ctx) +} + func (m *RegistryDefault) selfServiceStrategies() []interface{} { if len(m.selfserviceStrategies) == 0 { m.selfserviceStrategies = []interface{}{ @@ -579,7 +587,7 @@ func (m *RegistryDefault) SetPersister(p persistence.Persister) { } func (m *RegistryDefault) Courier(ctx context.Context) *courier.Courier { - return courier.NewSMTP(m, m.Config(ctx)) + return courier.NewSMTP(ctx, m) } func (m *RegistryDefault) ContinuityManager() continuity.Manager { diff --git a/text/id.go b/text/id.go index c58a64f662d0..3347b4749fef 100644 --- a/text/id.go +++ b/text/id.go @@ -73,9 +73,9 @@ const ( ) const ( - InfoSelfServiceVerification ID = 1080000 + iota // 1070000 - InfoSelfServiceVerificationEmailSent // 1070001 - InfoSelfServiceVerificationSuccessful // 1070002 + InfoSelfServiceVerification ID = 1080000 + iota // 1080000 + InfoSelfServiceVerificationEmailSent // 1080001 + InfoSelfServiceVerificationSuccessful // 1080002 ) const ( From e2377bc9906cf240f7086036b154431787d5b071 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 6 Dec 2021 09:38:10 +0000 Subject: [PATCH 16/37] autogen(docs): generate and format documentation From 148284485db8a86aa10c5aefb34373f9a8c7d95a Mon Sep 17 00:00:00 2001 From: Alexandre Burgoni Date: Mon, 6 Dec 2021 12:47:55 +0100 Subject: [PATCH 17/37] feat(cmd): add OIDC credential include (#2017) With this change, the `kratos identities get` CLI can additionally fetch OIDC credentials. Co-authored-by: Patrik --- cmd/identities/get.go | 31 ++++++++++++++++++++-- cmd/identities/get_test.go | 53 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) diff --git a/cmd/identities/get.go b/cmd/identities/get.go index 148bbdcb49ac..d4f8c8faf406 100644 --- a/cmd/identities/get.go +++ b/cmd/identities/get.go @@ -6,6 +6,7 @@ import ( kratos "github.com/ory/kratos-client-go" "github.com/ory/kratos/x" "github.com/ory/x/cmdx" + "github.com/ory/x/stringsx" "github.com/ory/kratos/internal/clihelpers" @@ -14,8 +15,16 @@ import ( "github.com/ory/kratos/cmd/cliclient" ) +const ( + FlagIncludeCreds = "include-credentials" +) + func NewGetCmd() *cobra.Command { - return &cobra.Command{ + var ( + includeCreds []string + ) + + cmd := &cobra.Command{ Use: "get ", Short: "Get one or more identities by ID", Long: fmt.Sprintf(`This command gets all the details about an identity. To get an identity by some selector, e.g. the recovery email address, use the list command in combination with jq. @@ -29,10 +38,23 @@ func NewGetCmd() *cobra.Command { RunE: func(cmd *cobra.Command, args []string) error { c := cliclient.NewClient(cmd) + // we check includeCreds argument is valid + for _, opt := range includeCreds { + e := stringsx.SwitchExact(opt) + if !e.AddCase("oidc") { + cmd.PrintErrln(`You have to put a valid value of credentials type to be included, try --help for details.`) + return cmdx.FailSilently(cmd) + } + } + identities := make([]kratos.Identity, 0, len(args)) failed := make(map[string]error) for _, id := range args { - identity, _, err := c.V0alpha2Api.AdminGetIdentity(cmd.Context(), id).Execute() + identity, _, err := c.V0alpha2Api. + AdminGetIdentity(cmd.Context(), id). + IncludeCredential(includeCreds). + Execute() + if x.SDKError(err) != nil { failed[id] = err continue @@ -54,4 +76,9 @@ func NewGetCmd() *cobra.Command { return nil }, } + + flags := cmd.Flags() + // include credential flag to add third party tokens in returned data + flags.StringArrayVarP(&includeCreds, FlagIncludeCreds, "i", []string{}, `Include third party tokens (only "oidc" supported) `) + return cmd } diff --git a/cmd/identities/get_test.go b/cmd/identities/get_test.go index 6369517153d8..911da181e28f 100644 --- a/cmd/identities/get_test.go +++ b/cmd/identities/get_test.go @@ -2,10 +2,12 @@ package identities_test import ( "context" + "encoding/hex" "encoding/json" "testing" "github.com/ory/kratos/cmd/identities" + "github.com/ory/kratos/selfservice/strategy/oidc" "github.com/ory/x/assertx" @@ -50,4 +52,55 @@ func TestGetCmd(t *testing.T) { assert.Contains(t, stdErr, "404 Not Found", stdErr) }) + + t.Run("case=gets a single identity with oidc credentials", func(t *testing.T) { + applyCredentials := func(identifier, accessToken, refreshToken, idToken string, encrypt bool) identity.Credentials { + toJson := func(c oidc.CredentialsConfig) []byte { + out, err := json.Marshal(&c) + require.NoError(t, err) + return out + } + transform := func(token string) string { + if !encrypt { + return token + } + return hex.EncodeToString([]byte(token)) + } + return identity.Credentials{ + Type: identity.CredentialsTypeOIDC, + Identifiers: []string{"bar:" + identifier}, + Config: toJson(oidc.CredentialsConfig{Providers: []oidc.ProviderCredentialsConfig{ + { + Subject: "foo", + Provider: "bar", + InitialAccessToken: transform(accessToken + "0"), + InitialRefreshToken: transform(refreshToken + "0"), + InitialIDToken: transform(idToken + "0"), + }, + { + Subject: "baz", + Provider: "zab", + InitialAccessToken: transform(accessToken + "1"), + InitialRefreshToken: transform(refreshToken + "1"), + InitialIDToken: transform(idToken + "1"), + }, + }}), + } + } + i := identity.NewIdentity(config.DefaultIdentityTraitsSchemaID) + i.SetCredentials(identity.CredentialsTypeOIDC, applyCredentials("uniqueIdentifier", "accessBar", "refreshBar", "idBar", true)) + // duplicate identity with decrypted tokens + di := i.CopyWithoutCredentials() + di.SetCredentials(identity.CredentialsTypeOIDC, applyCredentials("uniqueIdentifier", "accessBar", "refreshBar", "idBar", false)) + + require.NoError(t, c.Flags().Set(identities.FlagIncludeCreds, "oidc")) + require.NoError(t, reg.Persister().CreateIdentity(context.Background(), i)) + + stdOut := execNoErr(t, c, i.ID.String()) + ij, err := json.Marshal(identity.WithCredentialsInJSON(*di)) + require.NoError(t, err) + + ii := []string{"schema_url", "state_changed_at", "created_at", "updated_at", "credentials.oidc.created_at", "credentials.oidc.updated_at"} + assertx.EqualAsJSONExcept(t, json.RawMessage(ij), json.RawMessage(stdOut), ii) + }) } From b7ef125d37b98e2ac6e81fd4011e8d9df28b6b49 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 6 Dec 2021 11:49:59 +0000 Subject: [PATCH 18/37] autogen(docs): generate cli docs --- docs/docs/cli/kratos-identities-get.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/docs/cli/kratos-identities-get.md b/docs/docs/cli/kratos-identities-get.md index 16c74066490c..5ca6a98965bb 100644 --- a/docs/docs/cli/kratos-identities-get.md +++ b/docs/docs/cli/kratos-identities-get.md @@ -39,7 +39,8 @@ To get the identities with the recovery email address at the domain "ory.sh& ### Options ``` - -h, --help help for get + -h, --help help for get + -i, --include-credentials stringArray Include third party tokens (only "oidc" supported) ``` ### Options inherited from parent commands From bb5846ecb446b9e58b2a4949c678fddac4bbac4f Mon Sep 17 00:00:00 2001 From: sawadashota Date: Mon, 6 Dec 2021 22:58:11 +0900 Subject: [PATCH 19/37] fix: Require minimum length of 8 characters password (#2009) Kratos follows [NIST Digital Identity Guidelines - 5.1.1.2 Memorized Secret Verifiers](https://pages.nist.gov/800-63-3/sp800-63b.html) and [password policy](https://www.ory.sh/kratos/docs/concepts/security#password-policy) says > Passwords must have a minimum length of 8 characters and all characters (unicode, ASCII) must be allowed. Signed-off-by: sawadashota Co-authored-by: Patrik --- selfservice/strategy/password/validator.go | 17 +++++++---------- selfservice/strategy/password/validator_test.go | 17 ++++++++++------- .../profiles/email/registration/errors.spec.ts | 8 ++++---- .../profiles/email/settings/errors.spec.ts | 4 ++-- .../integration/profiles/mfa/totp.spec.ts | 2 +- .../profiles/mobile/registration/errors.spec.ts | 2 +- 6 files changed, 25 insertions(+), 25 deletions(-) diff --git a/selfservice/strategy/password/validator.go b/selfservice/strategy/password/validator.go index 570cec7e485f..f853cc967357 100644 --- a/selfservice/strategy/password/validator.go +++ b/selfservice/strategy/password/validator.go @@ -3,11 +3,6 @@ package password import ( "bufio" "context" - "time" - - "github.com/hashicorp/go-retryablehttp" - - "github.com/ory/kratos/driver/config" /* #nosec G505 sha1 is used for k-anonymity */ "crypto/sha1" @@ -16,15 +11,17 @@ import ( "strconv" "strings" "sync" + "time" "github.com/arbovm/levenshtein" - - "github.com/ory/x/httpx" - + "github.com/hashicorp/go-retryablehttp" "github.com/pkg/errors" "github.com/ory/herodot" + "github.com/ory/x/httpx" "github.com/ory/x/stringsx" + + "github.com/ory/kratos/driver/config" ) // Validator implements a validation strategy for passwords. One example is that the password @@ -145,8 +142,8 @@ func (s *DefaultPasswordValidator) fetch(hpw []byte, apiDNSName string) error { } func (s *DefaultPasswordValidator) Validate(ctx context.Context, identifier, password string) error { - if len(password) < 6 { - return errors.Errorf("password length must be at least 6 characters but only got %d", len(password)) + if len(password) < 8 { + return errors.Errorf("password length must be at least 8 characters but only got %d", len(password)) } compIdentifier, compPassword := strings.ToLower(identifier), strings.ToLower(password) diff --git a/selfservice/strategy/password/validator_test.go b/selfservice/strategy/password/validator_test.go index 0bd984681b6c..ef0921d67b25 100644 --- a/selfservice/strategy/password/validator_test.go +++ b/selfservice/strategy/password/validator_test.go @@ -12,10 +12,10 @@ import ( "testing" "time" - "github.com/ory/x/httpx" - "github.com/stretchr/testify/require" + "github.com/ory/x/httpx" + "github.com/ory/kratos/driver/config" "github.com/ory/kratos/internal" "github.com/ory/kratos/selfservice/strategy/password" @@ -42,6 +42,7 @@ func TestDefaultPasswordValidationStrategy(t *testing.T) { {pw: "password", pass: false}, {pw: "1234567890", pass: false}, {pw: "qwertyui", pass: false}, + {pw: "l3f9to", pass: false}, {pw: "l3f9toh1uaf81n21", pass: true}, {pw: "l3f9toh1uaf81n21", id: "l3f9toh1uaf81n21", pass: false}, {pw: "l3f9toh1", pass: true}, @@ -56,19 +57,21 @@ func TestDefaultPasswordValidationStrategy(t *testing.T) { {id: "hello@example.com", pw: "h3ll0@example", pass: false}, {pw: "hello@example.com", id: "hello@exam", pass: false}, {id: "abcd", pw: "9d3c8a1b", pass: true}, - {id: "a", pw: "kjOkla", pass: true}, + {id: "a", pw: "kjOklafe", pass: true}, {id: "ab", pw: "0000ab0000", pass: true}, // longest common substring with long password {id: "d4f6090b-5a84", pw: "d4f6090b-5a84-2184-4404-8d1b-8da3eb00ebbe", pass: true}, {id: "asdflasdflasdf", pw: "asdflasdflpiuhefnciluaksdzuföfhg", pass: true}, } { t.Run(fmt.Sprintf("case=%d", k), func(t *testing.T) { + c := tc t.Parallel() - err := s.Validate(context.Background(), tc.id, tc.pw) - if tc.pass { - require.NoError(t, err, "err: %+v, id: %s, pw: %s", err, tc.id, tc.pw) + + err := s.Validate(context.Background(), c.id, c.pw) + if c.pass { + require.NoError(t, err, "err: %+v, id: %s, pw: %s", err, c.id, c.pw) } else { - require.Error(t, err, "id: %s, pw: %s", tc.id, tc.pw) + require.Error(t, err, "id: %s, pw: %s", c.id, c.pw) } }) } diff --git a/test/e2e/cypress/integration/profiles/email/registration/errors.spec.ts b/test/e2e/cypress/integration/profiles/email/registration/errors.spec.ts index 6a6b24252c10..5be1bac5aafb 100644 --- a/test/e2e/cypress/integration/profiles/email/registration/errors.spec.ts +++ b/test/e2e/cypress/integration/profiles/email/registration/errors.spec.ts @@ -36,8 +36,8 @@ describe('Registration failures with email profile', () => { .type(identity) .should('have.value', identity) cy.get('input[name="password"]') - .type('123456') - .should('have.value', '123456') + .type('12345678') + .should('have.value', '12345678') cy.shouldHaveCsrfError({ app }) }) @@ -56,8 +56,8 @@ describe('Registration failures with email profile', () => { .type(identity) .should('have.value', identity) cy.get('input[name="password"]') - .type('123456') - .should('have.value', '123456') + .type('12345678') + .should('have.value', '12345678') cy.submitPasswordForm() cy.get('*[data-testid^="ui/message"]').should( diff --git a/test/e2e/cypress/integration/profiles/email/settings/errors.spec.ts b/test/e2e/cypress/integration/profiles/email/settings/errors.spec.ts index ea1e7d0ef528..612a5d139606 100644 --- a/test/e2e/cypress/integration/profiles/email/settings/errors.spec.ts +++ b/test/e2e/cypress/integration/profiles/email/settings/errors.spec.ts @@ -149,7 +149,7 @@ context('Settings failures with email profile', () => { }) it('fails if password policy is violated', () => { - cy.get('input[name="password"]').clear().type('123456') + cy.get('input[name="password"]').clear().type('12345678') cy.get('button[value="password"]').click() cy.get('*[data-testid^="ui/message"]').should( 'contain.text', @@ -282,7 +282,7 @@ context('Settings failures with email profile', () => { describe('global errors', () => { it('fails when CSRF is incorrect', () => { - cy.get(appPrefix(app) + 'input[name="password"]').type('123456') + cy.get(appPrefix(app) + 'input[name="password"]').type('12345678') cy.shouldHaveCsrfError({ app }) }) diff --git a/test/e2e/cypress/integration/profiles/mfa/totp.spec.ts b/test/e2e/cypress/integration/profiles/mfa/totp.spec.ts index 9f0144223dd3..0066cf23411e 100644 --- a/test/e2e/cypress/integration/profiles/mfa/totp.spec.ts +++ b/test/e2e/cypress/integration/profiles/mfa/totp.spec.ts @@ -222,7 +222,7 @@ context('2FA lookup secrets', () => { it('should fail to set up totp if verify code is wrong', () => { cy.visit(settings) - cy.get('input[name="totp_code"]').type('123456') + cy.get('input[name="totp_code"]').type('12345678') cy.get('*[name="method"][value="totp"]').click() cy.get('[data-testid="ui/message/4000008"]').should( 'contain.text', diff --git a/test/e2e/cypress/integration/profiles/mobile/registration/errors.spec.ts b/test/e2e/cypress/integration/profiles/mobile/registration/errors.spec.ts index 5080cc8a6570..c5e3d04cd93d 100644 --- a/test/e2e/cypress/integration/profiles/mobile/registration/errors.spec.ts +++ b/test/e2e/cypress/integration/profiles/mobile/registration/errors.spec.ts @@ -16,7 +16,7 @@ context('Mobile Profile', () => { describe('show errors when invalid signup data is used', () => { it('should show an error when the password has leaked before', () => { cy.get('input[data-testid="traits.email"]').type(email) - cy.get('input[data-testid="password"]').type('123456') + cy.get('input[data-testid="password"]').type('12345678') cy.get('input[data-testid="traits.website"]').type(website) cy.get('div[data-testid="submit-form"]').click() From 2c6dabe05704ac10f5046f938088f33eebc592cd Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 6 Dec 2021 14:08:27 +0000 Subject: [PATCH 20/37] autogen(docs): generate and format documentation From f6efc923d73bffd25333be366fc27bab46845d41 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:48:16 +0000 Subject: [PATCH 21/37] chore: update repository templates [skip ci] - updated repository templates to https://github.com/ory/meta/commit/efda325028105e27ba647fff6f6e987e1a660e35 --- README.md | 16 +- .../flows/code/registration/index.js | 3 +- .../flows/code/verification/index.js | 12 +- docs/scripts/config.js | 156 +++++++++--------- docs/src/theme/CodeFromRemote.js | 26 ++- docs/src/theme/ketoRelationTuplesPrism.js | 3 +- 6 files changed, 114 insertions(+), 102 deletions(-) diff --git a/README.md b/README.md index be89b6775e80..f8913cbf2792 100644 --- a/README.md +++ b/README.md @@ -198,14 +198,26 @@ that your company deserves a spot here, reach out to Adopter * Cloudbear - Cloudbear + Cloudbear cloudbear.eu Adopter * Security Onion Solutions - Security Onion Solutions + Security Onion Solutions securityonionsolutions.com + + + Adopter * + Factly + Factly + factlylabs.com + + + Adopter * + Nortal + Nortal + nortal.com Sponsor diff --git a/docs/docs/self-service/flows/code/registration/index.js b/docs/docs/self-service/flows/code/registration/index.js index 41589ae5479b..9c227491c9bd 100644 --- a/docs/docs/self-service/flows/code/registration/index.js +++ b/docs/docs/self-service/flows/code/registration/index.js @@ -20,7 +20,8 @@ export const getFlowMethodOidcWithCompletion = { browser: { label: 'Browser UI', image: require('./images/browser-oidc-invalid.png').default, - alt: 'User Registration HTML Form with missing or invalid fields when performing an OpenID Connect flow' + alt: + 'User Registration HTML Form with missing or invalid fields when performing an OpenID Connect flow' }, missing: { label: 'Missing Website', diff --git a/docs/docs/self-service/flows/code/verification/index.js b/docs/docs/self-service/flows/code/verification/index.js index 5e6194bdeffd..ac065261e151 100644 --- a/docs/docs/self-service/flows/code/verification/index.js +++ b/docs/docs/self-service/flows/code/verification/index.js @@ -2,7 +2,8 @@ export const getFlowMethodLinkWithErrors = { browser: { label: 'Browser UI', image: require('./images/browser-missing.png').default, - alt: 'Email Verification and Account Activation HTML Form with validation errors' + alt: + 'Email Verification and Account Activation HTML Form with validation errors' }, missing: { label: 'Missing Email', @@ -15,7 +16,8 @@ export const getFlowMethodLinkSuccess = { browser: { label: 'Browser UI', image: require('./images/browser-success.png').default, - alt: 'Email Verification and Account Activation HTML Form with success message' + alt: + 'Email Verification and Account Activation HTML Form with success message' }, missing: { label: 'Email Sent', @@ -28,7 +30,8 @@ export const getFlowMethodLinkInvalidChallenge = { browser: { label: 'Browser UI', image: require('./images/browser-invalid-challenge.png').default, - alt: 'Email Verification and Account Activation HTML Form with an invalid challenge' + alt: + 'Email Verification and Account Activation HTML Form with an invalid challenge' }, missing: { label: 'Invalid Challenge', @@ -41,7 +44,8 @@ export const getFlowMethodLinkChallengeDone = { browser: { label: 'Browser UI', image: require('./images/browser-challenge-completed.png').default, - alt: 'Email Verification and Account Activation HTML Form with an invalid challenge' + alt: + 'Email Verification and Account Activation HTML Form with an invalid challenge' }, missing: { label: 'Success State', diff --git a/docs/scripts/config.js b/docs/scripts/config.js index ce2bc434d818..058a030e0567 100644 --- a/docs/scripts/config.js +++ b/docs/scripts/config.js @@ -45,101 +45,99 @@ if (process.argv.length !== 3 || process.argv[1] === 'help') { const config = require(path.resolve(process.argv[2])) -const enhance = - (schema, parents = []) => - (item) => { - const key = item.key.value - - const path = [ - ...parents.map((parent) => ['properties', parent]), - ['properties', key] - ].flat() - - if (['title', 'description'].find((f) => path[path.length - 1] === f)) { - return - } +const enhance = (schema, parents = []) => (item) => { + const key = item.key.value - const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, ''] + const path = [ + ...parents.map((parent) => ['properties', parent]), + ['properties', key] + ].flat() - const description = pathOr('', [...path, 'description'], schema) - if (description) { - comments.push(' ' + description.split('\n').join('\n '), '') - } + if (['title', 'description'].find((f) => path[path.length - 1] === f)) { + return + } - const defaultValue = pathOr('', [...path, 'default'], schema) - if (defaultValue || defaultValue === false) { - comments.push(' Default value: ' + defaultValue, '') - } + const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, ''] - const enums = pathOr('', [...path, 'enum'], schema) - if (enums && Array.isArray(enums)) { - comments.push( - ' One of:', - ...YAML.stringify(enums) - .split('\n') - .map((i) => ` ${i}`) - ) // split always returns one empty object so no need for newline - } + const description = pathOr('', [...path, 'description'], schema) + if (description) { + comments.push(' ' + description.split('\n').join('\n '), '') + } - const min = pathOr('', [...path, 'minimum'], schema) - if (min || min === 0) { - comments.push(` Minimum value: ${min}`, '') - } + const defaultValue = pathOr('', [...path, 'default'], schema) + if (defaultValue || defaultValue === false) { + comments.push(' Default value: ' + defaultValue, '') + } - const max = pathOr('', [...path, 'maximum'], schema) - if (max || max === 0) { - comments.push(` Maximum value: ${max}`, '') - } + const enums = pathOr('', [...path, 'enum'], schema) + if (enums && Array.isArray(enums)) { + comments.push( + ' One of:', + ...YAML.stringify(enums) + .split('\n') + .map((i) => ` ${i}`) + ) // split always returns one empty object so no need for newline + } - const examples = pathOr('', [...path, 'examples'], schema) - if (examples) { - comments.push( - ' Examples:', - ...YAML.stringify(examples) - .split('\n') - .map((i) => ` ${i}`) - ) // split always returns one empty object so no need for newline - } + const min = pathOr('', [...path, 'minimum'], schema) + if (min || min === 0) { + comments.push(` Minimum value: ${min}`, '') + } - let hasChildren - if (item.value.items) { - item.value.items.forEach((item) => { - if (item.key) { - enhance(schema, [...parents, key])(item) - hasChildren = true - } - }) - } + const max = pathOr('', [...path, 'maximum'], schema) + if (max || max === 0) { + comments.push(` Maximum value: ${max}`, '') + } + + const examples = pathOr('', [...path, 'examples'], schema) + if (examples) { + comments.push( + ' Examples:', + ...YAML.stringify(examples) + .split('\n') + .map((i) => ` ${i}`) + ) // split always returns one empty object so no need for newline + } + + let hasChildren + if (item.value.items) { + item.value.items.forEach((item) => { + if (item.key) { + enhance(schema, [...parents, key])(item) + hasChildren = true + } + }) + } - const showEnvVarBlockForObject = pathOr( - '', - [...path, 'showEnvVarBlockForObject'], - schema + const showEnvVarBlockForObject = pathOr( + '', + [...path, 'showEnvVarBlockForObject'], + schema + ) + if (!hasChildren || showEnvVarBlockForObject) { + const env = [...parents, key].map((i) => i.toUpperCase()).join('_') + comments.push( + ' Set this value using environment variables on', + ' - Linux/macOS:', + ` $ export ${env}=`, + ' - Windows Command Line (CMD):', + ` > set ${env}=`, + '' ) - if (!hasChildren || showEnvVarBlockForObject) { - const env = [...parents, key].map((i) => i.toUpperCase()).join('_') + + // Show this if the config property is an object, to call out how to specify the env var + if (hasChildren) { comments.push( - ' Set this value using environment variables on', - ' - Linux/macOS:', - ` $ export ${env}=`, - ' - Windows Command Line (CMD):', - ` > set ${env}=`, + ' This can be set as an environment variable by supplying it as a JSON object.', '' ) - - // Show this if the config property is an object, to call out how to specify the env var - if (hasChildren) { - comments.push( - ' This can be set as an environment variable by supplying it as a JSON object.', - '' - ) - } } - - item.commentBefore = comments.join('\n') - item.spaceBefore = true } + item.commentBefore = comments.join('\n') + item.spaceBefore = true +} + new Promise((resolve, reject) => { parser.dereference( require(path.resolve(config.updateConfig.src)), diff --git a/docs/src/theme/CodeFromRemote.js b/docs/src/theme/CodeFromRemote.js index 189028c2091d..a3609647f381 100644 --- a/docs/src/theme/CodeFromRemote.js +++ b/docs/src/theme/CodeFromRemote.js @@ -53,24 +53,22 @@ const findLine = (needle, haystack) => { return index } -const transform = - ({ startAt, endAt }) => - (content) => { - let lines = content.split('\n') +const transform = ({ startAt, endAt }) => (content) => { + let lines = content.split('\n') - const startIndex = findLine(startAt, lines) - if (startIndex > 0) { - lines = ['// ...', ...lines.slice(startIndex, -1)] - } - - const endIndex = findLine(endAt, lines) - if (endIndex > 0) { - lines = [...lines.slice(0, endIndex + 1), '// ...'] - } + const startIndex = findLine(startAt, lines) + if (startIndex > 0) { + lines = ['// ...', ...lines.slice(startIndex, -1)] + } - return lines.join('\n') + const endIndex = findLine(endAt, lines) + if (endIndex > 0) { + lines = [...lines.slice(0, endIndex + 1), '// ...'] } + return lines.join('\n') +} + const CodeFromRemote = (props) => { const { src, title } = props const [content, setContent] = useState('') diff --git a/docs/src/theme/ketoRelationTuplesPrism.js b/docs/src/theme/ketoRelationTuplesPrism.js index 9a00e5bbf706..513d653dfddb 100644 --- a/docs/src/theme/ketoRelationTuplesPrism.js +++ b/docs/src/theme/ketoRelationTuplesPrism.js @@ -44,8 +44,7 @@ export default (prism) => (prism.languages['keto-relation-tuples'] = { comment: /\/\/.*(\n|$)/, 'relation-tuple': { - pattern: - /([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/, + pattern: /([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/, inside: { namespace, object, From 57ab7f784674c2cef2b1cef4b6922e9834213e3d Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Mon, 6 Dec 2021 19:41:21 +0100 Subject: [PATCH 22/37] feat: buildkit with multi stage build (#2025) Co-authored-by: abador --- .docker/Dockerfile | 2 +- .docker/Dockerfile-build | 9 +- .docker/Dockerfile-debug | 2 +- .docker/Dockerfile-sqlite | 2 +- Makefile | 2 +- .../flows/code/registration/index.js | 3 +- .../flows/code/verification/index.js | 12 +- docs/scripts/config.js | 156 +++++++++--------- docs/src/theme/CodeFromRemote.js | 26 +-- docs/src/theme/ketoRelationTuplesPrism.js | 3 +- 10 files changed, 109 insertions(+), 108 deletions(-) diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 26d25e3a25e3..7405829baf94 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,4 +1,4 @@ -FROM alpine:3.14.3 +FROM alpine:3.15 RUN addgroup -S ory; \ adduser -S ory -G ory -D -u 10000 -h /home/ory -s /bin/nologin; \ diff --git a/.docker/Dockerfile-build b/.docker/Dockerfile-build index 5860d698dca6..2be845494507 100644 --- a/.docker/Dockerfile-build +++ b/.docker/Dockerfile-build @@ -1,4 +1,5 @@ -FROM golang:1.16.10-alpine3.14 AS builder +FROM golang:1.17-alpine3.15 AS base +# syntax = docker/dockerfile:1-experimental RUN apk -U --no-cache add build-base git gcc bash @@ -19,17 +20,17 @@ ARG VERSION ARG COMMIT ARG BUILD_DATE -RUN go build -tags sqlite \ +RUN --mount=type=cache,target=/root/.cache/go-build go build -tags sqlite \ -ldflags="-X 'github.com/ory/kratos/driver/config.Version=${VERSION}' -X 'github.com/ory/kratos/driver/config.Date=${BUILD_DATE}' -X 'github.com/ory/kratos/driver/config.Commit=${COMMIT}'" \ -o /usr/bin/kratos -FROM alpine:3.14.3 +FROM alpine:3.15.0 RUN addgroup -S ory; \ adduser -S ory -G ory -D -u 10000 -h /home/ory -s /bin/nologin; \ chown -R ory:ory /home/ory -COPY --from=builder /usr/bin/kratos /usr/bin/kratos +COPY --from=base /usr/bin/kratos /usr/bin/kratos # By creating the sqlite folder as the ory user, the mounted volume will be owned by ory:ory, which # is required for read/write of SQLite. diff --git a/.docker/Dockerfile-debug b/.docker/Dockerfile-debug index dde3ebe74abb..bd694ecf04aa 100644 --- a/.docker/Dockerfile-debug +++ b/.docker/Dockerfile-debug @@ -1,4 +1,4 @@ -FROM golang:1.16-buster +FROM golang:1.17.3-buster ENV CGO_ENABLED 1 RUN apt-get update && apt-get install -y --no-install-recommends inotify-tools psmisc diff --git a/.docker/Dockerfile-sqlite b/.docker/Dockerfile-sqlite index 3f3623c2290c..bd0194ee9b81 100644 --- a/.docker/Dockerfile-sqlite +++ b/.docker/Dockerfile-sqlite @@ -1,4 +1,4 @@ -FROM alpine:3.14.3 +FROM alpine:3.15 # Because this image is built for SQLite, we create /home/ory and /home/ory/sqlite which is owned by the ory user # and declare /home/ory/sqlite a volume. diff --git a/Makefile b/Makefile index 20dcaea2314a..e1160c66ff4e 100644 --- a/Makefile +++ b/Makefile @@ -135,7 +135,7 @@ format: .bin/goimports docs/node_modules node_modules # Build local docker image .PHONY: docker docker: - docker build -f .docker/Dockerfile-build --build-arg=COMMIT=$(VCS_REF) --build-arg=BUILD_DATE=$(BUILD_DATE) -t oryd/kratos:latest-sqlite . + DOCKER_BUILDKIT=1 docker build -f .docker/Dockerfile-build --build-arg=COMMIT=$(VCS_REF) --build-arg=BUILD_DATE=$(BUILD_DATE) -t oryd/kratos:latest-sqlite . # Runs the documentation tests .PHONY: test-docs diff --git a/docs/docs/self-service/flows/code/registration/index.js b/docs/docs/self-service/flows/code/registration/index.js index 9c227491c9bd..41589ae5479b 100644 --- a/docs/docs/self-service/flows/code/registration/index.js +++ b/docs/docs/self-service/flows/code/registration/index.js @@ -20,8 +20,7 @@ export const getFlowMethodOidcWithCompletion = { browser: { label: 'Browser UI', image: require('./images/browser-oidc-invalid.png').default, - alt: - 'User Registration HTML Form with missing or invalid fields when performing an OpenID Connect flow' + alt: 'User Registration HTML Form with missing or invalid fields when performing an OpenID Connect flow' }, missing: { label: 'Missing Website', diff --git a/docs/docs/self-service/flows/code/verification/index.js b/docs/docs/self-service/flows/code/verification/index.js index ac065261e151..5e6194bdeffd 100644 --- a/docs/docs/self-service/flows/code/verification/index.js +++ b/docs/docs/self-service/flows/code/verification/index.js @@ -2,8 +2,7 @@ export const getFlowMethodLinkWithErrors = { browser: { label: 'Browser UI', image: require('./images/browser-missing.png').default, - alt: - 'Email Verification and Account Activation HTML Form with validation errors' + alt: 'Email Verification and Account Activation HTML Form with validation errors' }, missing: { label: 'Missing Email', @@ -16,8 +15,7 @@ export const getFlowMethodLinkSuccess = { browser: { label: 'Browser UI', image: require('./images/browser-success.png').default, - alt: - 'Email Verification and Account Activation HTML Form with success message' + alt: 'Email Verification and Account Activation HTML Form with success message' }, missing: { label: 'Email Sent', @@ -30,8 +28,7 @@ export const getFlowMethodLinkInvalidChallenge = { browser: { label: 'Browser UI', image: require('./images/browser-invalid-challenge.png').default, - alt: - 'Email Verification and Account Activation HTML Form with an invalid challenge' + alt: 'Email Verification and Account Activation HTML Form with an invalid challenge' }, missing: { label: 'Invalid Challenge', @@ -44,8 +41,7 @@ export const getFlowMethodLinkChallengeDone = { browser: { label: 'Browser UI', image: require('./images/browser-challenge-completed.png').default, - alt: - 'Email Verification and Account Activation HTML Form with an invalid challenge' + alt: 'Email Verification and Account Activation HTML Form with an invalid challenge' }, missing: { label: 'Success State', diff --git a/docs/scripts/config.js b/docs/scripts/config.js index 058a030e0567..ce2bc434d818 100644 --- a/docs/scripts/config.js +++ b/docs/scripts/config.js @@ -45,98 +45,100 @@ if (process.argv.length !== 3 || process.argv[1] === 'help') { const config = require(path.resolve(process.argv[2])) -const enhance = (schema, parents = []) => (item) => { - const key = item.key.value - - const path = [ - ...parents.map((parent) => ['properties', parent]), - ['properties', key] - ].flat() - - if (['title', 'description'].find((f) => path[path.length - 1] === f)) { - return - } +const enhance = + (schema, parents = []) => + (item) => { + const key = item.key.value + + const path = [ + ...parents.map((parent) => ['properties', parent]), + ['properties', key] + ].flat() + + if (['title', 'description'].find((f) => path[path.length - 1] === f)) { + return + } - const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, ''] + const comments = [`# ${pathOr(key, [...path, 'title'], schema)} ##`, ''] - const description = pathOr('', [...path, 'description'], schema) - if (description) { - comments.push(' ' + description.split('\n').join('\n '), '') - } + const description = pathOr('', [...path, 'description'], schema) + if (description) { + comments.push(' ' + description.split('\n').join('\n '), '') + } - const defaultValue = pathOr('', [...path, 'default'], schema) - if (defaultValue || defaultValue === false) { - comments.push(' Default value: ' + defaultValue, '') - } + const defaultValue = pathOr('', [...path, 'default'], schema) + if (defaultValue || defaultValue === false) { + comments.push(' Default value: ' + defaultValue, '') + } - const enums = pathOr('', [...path, 'enum'], schema) - if (enums && Array.isArray(enums)) { - comments.push( - ' One of:', - ...YAML.stringify(enums) - .split('\n') - .map((i) => ` ${i}`) - ) // split always returns one empty object so no need for newline - } + const enums = pathOr('', [...path, 'enum'], schema) + if (enums && Array.isArray(enums)) { + comments.push( + ' One of:', + ...YAML.stringify(enums) + .split('\n') + .map((i) => ` ${i}`) + ) // split always returns one empty object so no need for newline + } - const min = pathOr('', [...path, 'minimum'], schema) - if (min || min === 0) { - comments.push(` Minimum value: ${min}`, '') - } + const min = pathOr('', [...path, 'minimum'], schema) + if (min || min === 0) { + comments.push(` Minimum value: ${min}`, '') + } - const max = pathOr('', [...path, 'maximum'], schema) - if (max || max === 0) { - comments.push(` Maximum value: ${max}`, '') - } + const max = pathOr('', [...path, 'maximum'], schema) + if (max || max === 0) { + comments.push(` Maximum value: ${max}`, '') + } - const examples = pathOr('', [...path, 'examples'], schema) - if (examples) { - comments.push( - ' Examples:', - ...YAML.stringify(examples) - .split('\n') - .map((i) => ` ${i}`) - ) // split always returns one empty object so no need for newline - } + const examples = pathOr('', [...path, 'examples'], schema) + if (examples) { + comments.push( + ' Examples:', + ...YAML.stringify(examples) + .split('\n') + .map((i) => ` ${i}`) + ) // split always returns one empty object so no need for newline + } - let hasChildren - if (item.value.items) { - item.value.items.forEach((item) => { - if (item.key) { - enhance(schema, [...parents, key])(item) - hasChildren = true - } - }) - } + let hasChildren + if (item.value.items) { + item.value.items.forEach((item) => { + if (item.key) { + enhance(schema, [...parents, key])(item) + hasChildren = true + } + }) + } - const showEnvVarBlockForObject = pathOr( - '', - [...path, 'showEnvVarBlockForObject'], - schema - ) - if (!hasChildren || showEnvVarBlockForObject) { - const env = [...parents, key].map((i) => i.toUpperCase()).join('_') - comments.push( - ' Set this value using environment variables on', - ' - Linux/macOS:', - ` $ export ${env}=`, - ' - Windows Command Line (CMD):', - ` > set ${env}=`, - '' + const showEnvVarBlockForObject = pathOr( + '', + [...path, 'showEnvVarBlockForObject'], + schema ) - - // Show this if the config property is an object, to call out how to specify the env var - if (hasChildren) { + if (!hasChildren || showEnvVarBlockForObject) { + const env = [...parents, key].map((i) => i.toUpperCase()).join('_') comments.push( - ' This can be set as an environment variable by supplying it as a JSON object.', + ' Set this value using environment variables on', + ' - Linux/macOS:', + ` $ export ${env}=`, + ' - Windows Command Line (CMD):', + ` > set ${env}=`, '' ) + + // Show this if the config property is an object, to call out how to specify the env var + if (hasChildren) { + comments.push( + ' This can be set as an environment variable by supplying it as a JSON object.', + '' + ) + } } - } - item.commentBefore = comments.join('\n') - item.spaceBefore = true -} + item.commentBefore = comments.join('\n') + item.spaceBefore = true + } new Promise((resolve, reject) => { parser.dereference( diff --git a/docs/src/theme/CodeFromRemote.js b/docs/src/theme/CodeFromRemote.js index a3609647f381..189028c2091d 100644 --- a/docs/src/theme/CodeFromRemote.js +++ b/docs/src/theme/CodeFromRemote.js @@ -53,21 +53,23 @@ const findLine = (needle, haystack) => { return index } -const transform = ({ startAt, endAt }) => (content) => { - let lines = content.split('\n') +const transform = + ({ startAt, endAt }) => + (content) => { + let lines = content.split('\n') - const startIndex = findLine(startAt, lines) - if (startIndex > 0) { - lines = ['// ...', ...lines.slice(startIndex, -1)] - } + const startIndex = findLine(startAt, lines) + if (startIndex > 0) { + lines = ['// ...', ...lines.slice(startIndex, -1)] + } - const endIndex = findLine(endAt, lines) - if (endIndex > 0) { - lines = [...lines.slice(0, endIndex + 1), '// ...'] - } + const endIndex = findLine(endAt, lines) + if (endIndex > 0) { + lines = [...lines.slice(0, endIndex + 1), '// ...'] + } - return lines.join('\n') -} + return lines.join('\n') + } const CodeFromRemote = (props) => { const { src, title } = props diff --git a/docs/src/theme/ketoRelationTuplesPrism.js b/docs/src/theme/ketoRelationTuplesPrism.js index 513d653dfddb..9a00e5bbf706 100644 --- a/docs/src/theme/ketoRelationTuplesPrism.js +++ b/docs/src/theme/ketoRelationTuplesPrism.js @@ -44,7 +44,8 @@ export default (prism) => (prism.languages['keto-relation-tuples'] = { comment: /\/\/.*(\n|$)/, 'relation-tuple': { - pattern: /([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/, + pattern: + /([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]+)@?((\(([^:#@()\n]+:)?([^:#@()\n]+)#([^:#@()\n]*)\))|([^:#@()\n]+))/, inside: { namespace, object, From a97bfd10a68ed9a05dca6223ebd4dcc92c3171f5 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Mon, 6 Dec 2021 18:49:15 +0000 Subject: [PATCH 23/37] autogen(docs): generate and format documentation From 31a3c19034456dac1810d3c29c87ab49ad7cfd94 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 7 Dec 2021 00:01:22 +0000 Subject: [PATCH 24/37] autogen(docs): update milestone document --- docs/docs/milestones.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/docs/milestones.md b/docs/docs/milestones.md index f58e8e6cc5ce..53b6d097e974 100644 --- a/docs/docs/milestones.md +++ b/docs/docs/milestones.md @@ -88,8 +88,6 @@ New feature or request. ([kratos#969](https://github.com/ory/kratos/issues/969)) - [ ] Access identity schema information (e.g. usernames) within the jsonnet mapper ([kratos#987](https://github.com/ory/kratos/issues/987)) -- [ ] login ui returned without flowid - ([kratos#1055](https://github.com/ory/kratos/issues/1055)) - [ ] [Feature] LOG_LEVEL to allow stacktrace in error for /api endpoint ([kratos#1589](https://github.com/ory/kratos/issues/1589)) - [ ] Deprecate webhook loader without URI scheme @@ -112,6 +110,8 @@ New feature or request. [@Alano Terblanche](https://github.com/Benehiko) - [x] Add i18n support to mail templates ([kratos#834](https://github.com/ory/kratos/issues/834)) +- [x] login ui returned without flowid + ([kratos#1055](https://github.com/ory/kratos/issues/1055)) - [x] Allow account recovery for identities without email address ([kratos#1419](https://github.com/ory/kratos/issues/1419)) - [x] Field validation answer status code 422 instead of 400 From bbd2355bbb220389021b596eec339a25652d932a Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Tue, 7 Dec 2021 15:44:10 +0100 Subject: [PATCH 25/37] docs: fix incorrect tag Closes #2032 Closes #2028 --- docs/versioned_docs/version-v0.8/quickstart.mdx | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/versioned_docs/version-v0.8/quickstart.mdx b/docs/versioned_docs/version-v0.8/quickstart.mdx index 1d8c9a0a6ccd..0e0ce0d04e56 100644 --- a/docs/versioned_docs/version-v0.8/quickstart.mdx +++ b/docs/versioned_docs/version-v0.8/quickstart.mdx @@ -126,7 +126,7 @@ Let's clone Ory Kratos and run `docker-compose`: ```shell script git clone https://github.com/ory/kratos.git cd kratos -git checkout v0.8.0-alpha.4.pre.0 +git checkout v0.8.0-alpha.3 docker-compose -f quickstart.yml -f quickstart-standalone.yml up --build --force-recreate # If you have SELinux, run: @@ -559,11 +559,11 @@ recovery, head over to the #### Configuration You can find all configuration files used for this quickstart guide in -[`./contrib/quickstart/kratos`](https://github.com/ory/kratos/tree/v0.8.0-alpha.4.pre.0/contrib/quickstart/kratos/email-password) +[`./contrib/quickstart/kratos`](https://github.com/ory/kratos/tree/v0.8.0-alpha.3/contrib/quickstart/kratos/email-password) , -[`./quickstart.yml`](https://github.com/ory/kratos/blob/v0.8.0-alpha.4.pre.0/quickstart.yml), +[`./quickstart.yml`](https://github.com/ory/kratos/blob/v0.8.0-alpha.3/quickstart.yml), and -[`./quickstart-standalone.yml`](https://github.com/ory/kratos/blob/v0.8.0-alpha.4.pre.0/quickstart-standalone.yml). +[`./quickstart-standalone.yml`](https://github.com/ory/kratos/blob/v0.8.0-alpha.3/quickstart-standalone.yml). To understand what each of those configuration files does, consult the other chapters of this documentation. @@ -571,11 +571,11 @@ chapters of this documentation. To get a minimal version of Ory Kratos running, you need to set configuration values for -[`identity.default_schema_url`](https://github.com/ory/kratos/blob/v0.8.0-alpha.4.pre.0/contrib/quickstart/kratos/email-password/kratos.yml#L75) +[`identity.default_schema_url`](https://github.com/ory/kratos/blob/v0.8.0-alpha.3/contrib/quickstart/kratos/email-password/kratos.yml#L75) and -[`DSN`](https://github.com/ory/kratos/blob/v0.8.0-alpha.4.pre.0/quickstart.yml#L42). +[`DSN`](https://github.com/ory/kratos/blob/v0.8.0-alpha.3/quickstart.yml#L42). You should also configure -[`selfservice.flows.*.ui_url`](https://github.com/ory/kratos/blob/v0.8.0-alpha.4.pre.0/contrib/quickstart/kratos/email-password/kratos.yml#L24) +[`selfservice.flows.*.ui_url`](https://github.com/ory/kratos/blob/v0.8.0-alpha.3/contrib/quickstart/kratos/email-password/kratos.yml#L24) or else Kratos will use fallback URLs. ::: From 54eaf3a08293acde4de1e79f7b8d20edf7698251 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Tue, 7 Dec 2021 14:55:25 +0000 Subject: [PATCH 26/37] autogen(docs): generate and format documentation From 80e53eb83d0dc84d2082ee343bfcecd2bfd99e13 Mon Sep 17 00:00:00 2001 From: Mitar Date: Tue, 7 Dec 2021 23:53:59 -0800 Subject: [PATCH 27/37] docs: webhooks have landed (#2035) --- docs/docs/faq.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/docs/faq.mdx b/docs/docs/faq.mdx index 5240a2215253..4aa916e761db 100644 --- a/docs/docs/faq.mdx +++ b/docs/docs/faq.mdx @@ -146,12 +146,11 @@ import { Question, FaqTags } from '@theme/Faq' #kratos #hooks #feature

- Q: Are there plans to provide hooks on + Q: Are there hooks on registration/login/logouts/identity updates?

- A: Yes! See these issues for more information on the - current progress:{' '} + A: Yes! See these issues for more information:{' '} Feature Request: Webhooks {' '} From ba6981e344e880936b5e995c433dae85659ba780 Mon Sep 17 00:00:00 2001 From: Mitar Date: Tue, 7 Dec 2021 23:54:30 -0800 Subject: [PATCH 28/37] docs: improve text around bcrypt (#2037) --- docs/docs/concepts/credentials/username-email-password.mdx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/docs/concepts/credentials/username-email-password.mdx b/docs/docs/concepts/credentials/username-email-password.mdx index bad32c742937..c6a2ad819a27 100644 --- a/docs/docs/concepts/credentials/username-email-password.mdx +++ b/docs/docs/concepts/credentials/username-email-password.mdx @@ -36,9 +36,8 @@ hashers: :::warning -Due to the way BCrypt is implemented in Golang, passwords will be truncated -after 72 characters before being hashed. This implies that all characters in the -password after position 72 will be ignored! +BCrypt has a maximum length of 72 bytes for passwords. If a longer password +is attempted to be used, an error will be returned to the user. ::: From fc4703aa34066a56fa3cf3b664a0d032157e477a Mon Sep 17 00:00:00 2001 From: Mitar Date: Tue, 7 Dec 2021 23:54:47 -0800 Subject: [PATCH 29/37] docs: fixed date format example (#2038) --- docs/docs/concepts/rest-api.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/docs/concepts/rest-api.mdx b/docs/docs/concepts/rest-api.mdx index 50c7d5ba0177..5af6e407f396 100644 --- a/docs/docs/concepts/rest-api.mdx +++ b/docs/docs/concepts/rest-api.mdx @@ -49,6 +49,6 @@ format: ``` { - "created_at": "2006-01-02T15:04:05Z07:00" + "created_at": "2006-01-02T15:04:05+07:00" } ``` From 393b6b38cdc4758e838eec20e81d486662f7b4a7 Mon Sep 17 00:00:00 2001 From: Mitar Date: Tue, 7 Dec 2021 23:55:14 -0800 Subject: [PATCH 30/37] docs: Levenshtein-Distance has been released (#2040) --- docs/docs/concepts/security.mdx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/docs/concepts/security.mdx b/docs/docs/concepts/security.mdx index dc5433ae1d48..f68c5fd8982c 100644 --- a/docs/docs/concepts/security.mdx +++ b/docs/docs/concepts/security.mdx @@ -267,8 +267,7 @@ Ory Kratos implements a password policy that: - Checks if a password has previously been leaked using the [HIBP API](https://haveibeenpwned.com/API/v2), -- Checks if a password is too similar to one of the identifiers (in a future - release [kratos#184](https://github.com/ory/kratos/issues/184)), +- Checks if a password is too similar to one of the identifiers, - Does not expire passwords. This is a rundown of all the practices Ory Kratos implements and why. **Some From 9848fb3b40c12799eafc73d2ec0f410bf5b22aa8 Mon Sep 17 00:00:00 2001 From: Mitar Date: Tue, 7 Dec 2021 23:55:22 -0800 Subject: [PATCH 31/37] docs: password-strength meter has been dropped (#2041) --- docs/docs/concepts/security.mdx | 9 --------- 1 file changed, 9 deletions(-) diff --git a/docs/docs/concepts/security.mdx b/docs/docs/concepts/security.mdx index f68c5fd8982c..07c99f5a8723 100644 --- a/docs/docs/concepts/security.mdx +++ b/docs/docs/concepts/security.mdx @@ -316,15 +316,6 @@ Passwords must be checked against a database of compromised secrets such as > reason for rejection, and SHALL require the subscriber to choose a different > value. -Show the user a password-strength meter (to be implemented, see -[#136](https://github.com/ory/kratos/issues/136)): - -> Verifiers SHOULD offer guidance to the subscriber, such as a password-strength -> meter [Meters], to assist the user in choosing a strong memorized secret. This -> is particularly important following the rejection of a memorized secret on the -> above list as it discourages trivial modification of listed (and likely very -> weak) memorized secrets - Do not require mixtures of characters types or prohibiting repeated characters: > Verifiers SHOULD NOT impose other composition rules (e.g., requiring mixtures From 263747050e93ed238acc57bd3ed64fa23650132e Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Wed, 8 Dec 2021 07:57:06 +0000 Subject: [PATCH 32/37] autogen(docs): generate cli docs --- docs/docs/concepts/credentials/username-email-password.mdx | 4 ++-- docs/docs/faq.mdx | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/docs/concepts/credentials/username-email-password.mdx b/docs/docs/concepts/credentials/username-email-password.mdx index c6a2ad819a27..6c0a4ca80551 100644 --- a/docs/docs/concepts/credentials/username-email-password.mdx +++ b/docs/docs/concepts/credentials/username-email-password.mdx @@ -36,8 +36,8 @@ hashers: :::warning -BCrypt has a maximum length of 72 bytes for passwords. If a longer password -is attempted to be used, an error will be returned to the user. +BCrypt has a maximum length of 72 bytes for passwords. If a longer password is +attempted to be used, an error will be returned to the user. ::: diff --git a/docs/docs/faq.mdx b/docs/docs/faq.mdx index 4aa916e761db..50bb4c108ed7 100644 --- a/docs/docs/faq.mdx +++ b/docs/docs/faq.mdx @@ -146,8 +146,8 @@ import { Question, FaqTags } from '@theme/Faq' #kratos #hooks #feature

- Q: Are there hooks on - registration/login/logouts/identity updates? + Q: Are there hooks on registration/login/logouts/identity + updates?

A: Yes! See these issues for more information:{' '} From 0064e350ccb417fefee6f48ca5895f3d75247bb3 Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Wed, 8 Dec 2021 09:00:51 +0100 Subject: [PATCH 33/37] feat(oidc): add spotify provider (#2024) Co-authored-by: Keith Mitchell --- ...n-with-github-google-facebook-linkedin.mdx | 64 +++++++++++++ embedx/config.schema.json | 5 +- go.mod | 3 +- go.sum | 6 +- selfservice/strategy/oidc/provider_config.go | 2 + selfservice/strategy/oidc/provider_spotify.go | 95 +++++++++++++++++++ 6 files changed, 171 insertions(+), 4 deletions(-) create mode 100644 selfservice/strategy/oidc/provider_spotify.go diff --git a/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx b/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx index 38856294f9be..cc5491ef1eca 100644 --- a/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx +++ b/docs/docs/guides/sign-in-with-github-google-facebook-linkedin.mdx @@ -1078,6 +1078,70 @@ selfservice: Next, open the login endpoint of the SecureApp and you should see the Apple Login option! +## Spotify + +To set up "Sign in with Spotify" you must create an +[Spotify Application](https://developer.spotify.com/dashboard/applications). + +Set the "Redirect URI" to: + +``` +https://playground.projects.oryapis.com/api/kratos/public/self-service/methods/oidc/callback/spotify +``` + +The pattern of this URL is: + +``` +http(s)://:/self-service/methods/oidc/callback/ +``` + +:::note + +While Spotify +[provides an OIDC discovery URL](https://accounts.spotify.com/.well-known/openid-configuration), +Spotify does not actually support the `openid` claim and only returns an access +token. Therefore, Ory Kratos makes a request to +[Spotify's /me API](https://developer.spotify.com/documentation/web-api/reference/#/operations/get-current-users-profile) +and adds the user info to `std.extVar('claims')`. + +::: + +```json title="contrib/quickstart/kratos/email-password/oidc.spotify.jsonnet" +# claims contains all the data sent by the upstream. +local claims = std.extVar('claims'); + +{ + identity: { + traits: { + email: claims.email + }, + }, +} +``` + +Now, enable the Spotify provider in the Ory Kratos config located at +`/contrib/quickstart/kratos/email-password/kratos.yml`. + +```yaml title="contrib/quickstart/kratos/email-password/kratos.yml" +# $ kratos -c path/to/my/kratos/config.yml serve +selfservice: + methods: + oidc: + enabled: true + config: + providers: + - id: spotify # this is `` in the Authorization callback URL. DO NOT CHANGE IT ONCE SET! + provider: spotify + client_id: .... # Replace this with the OAuth2 Client ID provided by Spotify + client_secret: .... # Replace this with the OAuth2 Client Secret provided by Spotify + mapper_url: file:///etc/config/kratos/oidc.spotify.jsonnet + scope: + - user-read-email + - user-read-private +``` + +Spotify is now an option to log in via Kratos. + ## LinkedIn Connecting with other Social Sign In providers will be very similar to the diff --git a/embedx/config.schema.json b/embedx/config.schema.json index f55a4c380e57..c75eceef15e7 100644 --- a/embedx/config.schema.json +++ b/embedx/config.schema.json @@ -310,7 +310,7 @@ }, "provider": { "title": "Provider", - "description": "Can be one of github, github-app, gitlab, generic, google, microsoft, discord, slack, facebook, auth0, vk, yandex.", + "description": "Can be one of github, github-app, gitlab, generic, google, microsoft, discord, slack, facebook, auth0, vk, yandex, spotify.", "type": "string", "enum": [ "github", @@ -325,7 +325,8 @@ "auth0", "vk", "yandex", - "apple" + "apple", + "spotify" ], "examples": [ "google" diff --git a/go.mod b/go.mod index ceacb212f6de..b4d5001dc9dc 100644 --- a/go.mod +++ b/go.mod @@ -90,9 +90,10 @@ require ( github.com/tidwall/gjson v1.9.4 github.com/tidwall/sjson v1.2.2 github.com/urfave/negroni v1.0.0 + github.com/zmb3/spotify/v2 v2.0.0 golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 golang.org/x/net v0.0.0-20211020060615-d418f374d309 - golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c + golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5 golang.org/x/sync v0.0.0-20210220032951-036812b2e83c golang.org/x/tools v0.1.7 ) diff --git a/go.sum b/go.sum index 8dcd89c306d0..d0e7cfe64ab3 100644 --- a/go.sum +++ b/go.sum @@ -1937,6 +1937,8 @@ github.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPS github.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= +github.com/zmb3/spotify/v2 v2.0.0 h1:NHW9btztNZTrJ0+3yMNyfY5qcu1ck9s36wwzc7zrCic= +github.com/zmb3/spotify/v2 v2.0.0/go.mod h1:+LVh9CafHu7SedyqYmEf12Rd01dIVlEL845yNhksW0E= go.elastic.co/apm v1.8.0/go.mod h1:tCw6CkOJgkWnzEthFN9HUP1uL3Gjc/Ur6m7gRPLaoH0= go.elastic.co/apm v1.13.0/go.mod h1:dylGv2HKR0tiCV+wliJz1KHtDyuD8SPe69oV7VyK6WY= go.elastic.co/apm v1.14.0 h1:9yilcTbWpqhfyunUj6/SDpZbR4FOVB50xQgODe0TW/0= @@ -2177,6 +2179,7 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20211020060615-d418f374d309 h1:A0lJIi+hcTR6aajJH4YqKWwohY4aW9RO7oRMcdv+HKI= golang.org/x/net v0.0.0-20211020060615-d418f374d309/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -2193,8 +2196,9 @@ golang.org/x/oauth2 v0.0.0-20210218202405-ba52d332ba99/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20210220000619-9bb904979d93/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210313182246-cd4f82c27b84/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/oauth2 v0.0.0-20210402161424-2e8d93401602/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= -golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c h1:pkQiBZBvdos9qq4wBAHqlzuZHEXo07pqV06ef90u1WI= golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= +golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5 h1:Ati8dO7+U7mxpkPSxBZQEvzHVUYB/MqCklCN8ig5w/o= +golang.org/x/oauth2 v0.0.0-20210810183815-faf39c7919d5/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= diff --git a/selfservice/strategy/oidc/provider_config.go b/selfservice/strategy/oidc/provider_config.go index 6723081e145c..f53e3062b782 100644 --- a/selfservice/strategy/oidc/provider_config.go +++ b/selfservice/strategy/oidc/provider_config.go @@ -136,6 +136,8 @@ func (c ConfigurationCollection) Provider(id string, public *url.URL) (Provider, return NewProviderYandex(&p, public), nil case addProviderName("apple"): return NewProviderApple(&p, public), nil + case addProviderName("spotify"): + return NewProviderSpotify(&p, public), nil } return nil, errors.Errorf("provider type %s is not supported, supported are: %v", p.Provider, providerNames) } diff --git a/selfservice/strategy/oidc/provider_spotify.go b/selfservice/strategy/oidc/provider_spotify.go new file mode 100644 index 000000000000..13282ed110c5 --- /dev/null +++ b/selfservice/strategy/oidc/provider_spotify.go @@ -0,0 +1,95 @@ +package oidc + +import ( + "context" + "fmt" + "net/url" + + "golang.org/x/oauth2/spotify" + + "github.com/pkg/errors" + "golang.org/x/oauth2" + + "github.com/ory/x/stringslice" + "github.com/ory/x/stringsx" + + spotifyapi "github.com/zmb3/spotify/v2" + spotifyauth "github.com/zmb3/spotify/v2/auth" + + "github.com/ory/herodot" +) + +type ProviderSpotify struct { + config *Configuration + public *url.URL +} + +func NewProviderSpotify( + config *Configuration, + public *url.URL, +) *ProviderSpotify { + return &ProviderSpotify{ + config: config, + public: public, + } +} + +func (g *ProviderSpotify) Config() *Configuration { + return g.config +} + +func (g *ProviderSpotify) oauth2() *oauth2.Config { + return &oauth2.Config{ + ClientID: g.config.ClientID, + ClientSecret: g.config.ClientSecret, + Endpoint: spotify.Endpoint, + Scopes: g.config.Scope, + RedirectURL: g.config.Redir(g.public), + } +} + +func (g *ProviderSpotify) OAuth2(ctx context.Context) (*oauth2.Config, error) { + return g.oauth2(), nil +} + +func (g *ProviderSpotify) AuthCodeURLOptions(r ider) []oauth2.AuthCodeOption { + return []oauth2.AuthCodeOption{} +} + +func (g *ProviderSpotify) Claims(ctx context.Context, exchange *oauth2.Token) (*Claims, error) { + grantedScopes := stringsx.Splitx(fmt.Sprintf("%s", exchange.Extra("scope")), " ") + for _, check := range g.Config().Scope { + if !stringslice.Has(grantedScopes, check) { + return nil, errors.WithStack(ErrScopeMissing) + } + } + + auth := spotifyauth.New( + spotifyauth.WithRedirectURL(g.config.Redir(g.public)), + spotifyauth.WithScopes(spotifyauth.ScopeUserReadPrivate)) + + client := spotifyapi.New(auth.Client(ctx, exchange)) + + user, err := client.CurrentUser(ctx) + if err != nil { + return nil, errors.WithStack(herodot.ErrInternalServerError.WithReasonf("%s", err)) + } + + var userPicture string + if len(user.Images) > 0 { + userPicture = user.Images[0].URL + } + + claims := &Claims{ + Subject: user.ID, + Issuer: spotify.Endpoint.TokenURL, + Name: user.DisplayName, + Nickname: user.DisplayName, + Email: user.Email, + Picture: userPicture, + Profile: user.ExternalURLs["spotify"], + Birthdate: user.Birthdate, + } + + return claims, nil +} From 7e8c91ace5229fdc394461b3453acb3f01da0a6c Mon Sep 17 00:00:00 2001 From: Mitar Date: Thu, 9 Dec 2021 01:04:18 -0800 Subject: [PATCH 34/37] docs: this has been done (#2045) --- docs/docs/self-service/flows/user-settings.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/docs/self-service/flows/user-settings.mdx b/docs/docs/self-service/flows/user-settings.mdx index 7294f8d580bb..443e3529c58f 100644 --- a/docs/docs/self-service/flows/user-settings.mdx +++ b/docs/docs/self-service/flows/user-settings.mdx @@ -684,9 +684,7 @@ the interaction. There are no expected validation errors except for an error where the profile (e.g. Google) to be linked is already linked with another identity in the -system. This will currently result in a system error but will be a validation -error in the future (tracked as -[kratos#694](https://github.com/ory/kratos/issues/694)). +system. ## Successful Settings Update From 0b426d2eb2960ca20f755ee6883e344a42654f84 Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Thu, 9 Dec 2021 09:14:47 +0000 Subject: [PATCH 35/37] autogen(docs): generate and format documentation --- docs/docs/faq.mdx | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/docs/docs/faq.mdx b/docs/docs/faq.mdx index 50bb4c108ed7..5240a2215253 100644 --- a/docs/docs/faq.mdx +++ b/docs/docs/faq.mdx @@ -146,11 +146,12 @@ import { Question, FaqTags } from '@theme/Faq' #kratos #hooks #feature

- Q: Are there hooks on registration/login/logouts/identity - updates? + Q: Are there plans to provide hooks on + registration/login/logouts/identity updates?

- A: Yes! See these issues for more information:{' '} + A: Yes! See these issues for more information on the + current progress:{' '} Feature Request: Webhooks {' '} From 176141860f3aa946519073d0e35bf3acacd6c685 Mon Sep 17 00:00:00 2001 From: hackerman <3372410+aeneasr@users.noreply.github.com> Date: Fri, 10 Dec 2021 17:02:27 +0100 Subject: [PATCH 36/37] test(e2e): split e2e script into setup and test phase (#2027) --- .circleci/config.yml | 105 ++++++++++-- package-lock.json | 266 ++++++++----------------------- package.json | 2 +- test/e2e/package-lock.json | 266 ++++++++----------------------- test/e2e/package.json | 2 +- test/e2e/proxy/package-lock.json | 1 + test/e2e/run.sh | 158 +++++++++++------- 7 files changed, 322 insertions(+), 478 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5680bdad5a48..b2dae3a5f631 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -74,7 +74,7 @@ jobs: - run: | bash <(curl -s https://codecov.io/bash) - test-e2e: + test-e2e-1: docker: - image: oryd/e2e-env:latest environment: @@ -143,30 +143,103 @@ jobs: echo "unset DISPLAY" >> $BASH_ENV - run: - description: Run sqlite e2e test + description: Run postrgres e2e test command: | source $BASH_ENV - ./test/e2e/run.sh sqlite + ./test/e2e/run.sh postgres - run: - description: Run postrgres e2e test + description: Run cockroach e2e test command: | source $BASH_ENV - ./test/e2e/run.sh postgres + ./test/e2e/run.sh cockroach + + test-e2e-2: + docker: + - image: oryd/e2e-env:latest + environment: + TEST_DATABASE_MYSQL: mysql://root:test@(localhost:3306)/mysql?parseTime=true&multiStatements=true + TEST_DATABASE_COCKROACHDB: cockroach://root@localhost:26257/defaultdb?sslmode=disable + TEST_DATABASE_POSTGRESQL: postgres://test:test@localhost:5432/kratos?sslmode=disable + - image: postgres:9.6 + environment: + POSTGRES_USER: test + POSTGRES_PASSWORD: test + POSTGRES_DB: kratos + - image: cockroachdb/cockroach:v21.1.9 + command: start-single-node --insecure + - image: mysql:5.7 + environment: + - MYSQL_ROOT_PASSWORD=test + - image: oryd/mailslurper:latest-smtps + steps: + - browser-tools/install-browser-tools + - checkout + + - restore_cache: + keys: + - v3-e2e-deps-{{ checksum "package-lock.json" }}-{{ checksum "test/e2e/package-lock.json" }} + - run: npm ci + - run: cd test/e2e; npm ci + - run: sudo npm i -g expo-cli + - save_cache: + key: v3-e2e-deps-{{ checksum "package-lock.json" }}-{{ checksum "test/e2e/package-lock.json" }} + paths: + - node_modules + - ~/.cache # cypress + - ~/.npm/node_modules # global npm + - test/e2e/node_modules # e2e npm + + - go/load-cache + - go/mod-download + - go/save-cache + + - run: npm config set prefix ~/.npm/node_modules + - run: - description: Run mysql e2e test + description: "Install selfservice-ui-node" + command: | + node_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/kratos-selfservice-ui-node" + echo "export NODE_UI_PATH=$node_ui_dir" >> $BASH_ENV + + git clone https://github.com/ory/kratos-selfservice-ui-node.git --depth 1 --branch master "$node_ui_dir" + cd "$node_ui_dir" + npm i + npm run build + + - run: + description: "Install selfservice-ui-react-native" + command: | + rn_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/kratos-selfservice-ui-react-native" + echo "export RN_UI_PATH=$rn_ui_dir" >> $BASH_ENV + + git clone https://github.com/ory/kratos-selfservice-ui-react-native.git --depth 1 --branch master "$rn_ui_dir" + cd "$rn_ui_dir" + npm i + + - run: + description: "Unset DISPLAY - see https://github.com/cypress-io/cypress/issues/4034" + command: | + echo "unset DISPLAY" >> $BASH_ENV + + - run: + description: Run sqlite e2e test command: | source $BASH_ENV - ./test/e2e/run.sh mysql + ./test/e2e/run.sh sqlite - run: - description: Run cockroach e2e test + description: Run mysql e2e test command: | source $BASH_ENV - ./test/e2e/run.sh cockroach + ./test/e2e/run.sh mysql workflows: tbr: jobs: - - test-e2e: + - test-e2e-1: + filters: + tags: + only: /.*/ + - test-e2e-2: filters: tags: only: /.*/ @@ -183,7 +256,8 @@ workflows: - sdk/generate-openapi: requires: - test - - test-e2e + - test-e2e-1 + - test-e2e-2 filters: tags: only: /.*/ @@ -201,7 +275,8 @@ workflows: swagpath: spec/api.json requires: - test - - test-e2e + - test-e2e-1 + - test-e2e-2 - sdk/generate-openapi - sdk/test - goreleaser/release @@ -213,7 +288,8 @@ workflows: - changelog/generate: requires: - test - - test-e2e + - test-e2e-1 + - test-e2e-2 filters: tags: only: /.*/ @@ -222,7 +298,8 @@ workflows: - goreleaser/release: requires: - test - - test-e2e + - test-e2e-1 + - test-e2e-2 filters: branches: ignore: /.*/ diff --git a/package-lock.json b/package-lock.json index b14f83957e28..db32ba51b043 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@types/node": "^16.9.6", "@types/yamljs": "^0.2.31", "chrome-remote-interface": "^0.31.0", - "cypress": "^8.5.0", + "cypress": "^9.1.1", "dayjs": "^1.10.4", "got": "^11.8.2", "ory-prettier-styles": "1.1.1", @@ -24,9 +24,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.6", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.6.tgz", - "integrity": "sha512-z0UxBE/+qaESAHY9p9sM2h8Y4XqtsbDCt0/DPOrqA/RZgKi4PkxdpXyK4wCCnSk1xHqWHZZAE+gV6aDAR6+caQ==", + "version": "2.88.10", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz", + "integrity": "sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -36,8 +36,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", + "http-signature": "~1.3.6", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", @@ -430,22 +429,6 @@ "node": ">=8" } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -512,9 +495,9 @@ ] }, "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "dependencies": { "safer-buffer": "~2.1.0" @@ -1011,20 +994,20 @@ "dev": true }, "node_modules/cypress": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.5.0.tgz", - "integrity": "sha512-MMkXIS+Ro2KETn4gAlG3tIc/7FiljuuCZP0zpd9QsRG6MZSyZW/l1J3D4iQM6WHsVxuX4rFChn5jPFlC2tNSvQ==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.1.1.tgz", + "integrity": "sha512-yWcYD8SEQ8F3okFbRPqSDj5V0xhrZBT5QRIH+P1J2vYvtEmZ4KGciHE7LCcZZLILOrs7pg4WNCqkj/XRvReQlQ==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "^2.88.6", + "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", "@types/node": "^14.14.31", "@types/sinonjs__fake-timers": "^6.0.2", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", - "bluebird": "^3.7.2", + "bluebird": "3.7.2", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -1052,7 +1035,6 @@ "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", "proxy-from-env": "1.0.0", - "ramda": "~0.27.1", "request-progress": "^3.0.0", "supports-color": "^8.1.1", "tmp": "~0.2.1", @@ -1464,18 +1446,6 @@ "node >=0.6.0" ] }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, "node_modules/fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -1672,29 +1642,6 @@ "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==", "license": "ISC" }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dev": true, - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1710,18 +1657,17 @@ "dev": true }, "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", + "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, "dependencies": { "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "jsprim": "^2.0.2", + "sshpk": "^1.14.1" }, "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" + "node": ">=0.10" } }, "node_modules/http2-wrapper": { @@ -1956,15 +1902,9 @@ "dev": true }, "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "node_modules/json-stringify-safe": { @@ -1985,9 +1925,9 @@ } }, "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", + "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "engines": [ "node >=0.6.0" @@ -1995,7 +1935,7 @@ "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -2141,21 +2081,21 @@ "license": "MIT" }, "node_modules/mime-db": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", - "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.32", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", - "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", "dev": true, "dependencies": { - "mime-db": "1.49.0" + "mime-db": "1.51.0" }, "engines": { "node": ">= 0.6" @@ -2473,12 +2413,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ramda": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", - "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", - "dev": true - }, "node_modules/readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -2851,15 +2785,6 @@ "node": ">=8" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", @@ -3056,9 +2981,9 @@ }, "dependencies": { "@cypress/request": { - "version": "2.88.6", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.6.tgz", - "integrity": "sha512-z0UxBE/+qaESAHY9p9sM2h8Y4XqtsbDCt0/DPOrqA/RZgKi4PkxdpXyK4wCCnSk1xHqWHZZAE+gV6aDAR6+caQ==", + "version": "2.88.10", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz", + "integrity": "sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -3068,8 +2993,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", + "http-signature": "~1.3.6", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", @@ -3388,18 +3312,6 @@ "indent-string": "^4.0.0" } }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -3434,9 +3346,9 @@ "dev": true }, "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "requires": { "safer-buffer": "~2.1.0" @@ -3805,19 +3717,19 @@ "dev": true }, "cypress": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.5.0.tgz", - "integrity": "sha512-MMkXIS+Ro2KETn4gAlG3tIc/7FiljuuCZP0zpd9QsRG6MZSyZW/l1J3D4iQM6WHsVxuX4rFChn5jPFlC2tNSvQ==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.1.1.tgz", + "integrity": "sha512-yWcYD8SEQ8F3okFbRPqSDj5V0xhrZBT5QRIH+P1J2vYvtEmZ4KGciHE7LCcZZLILOrs7pg4WNCqkj/XRvReQlQ==", "dev": true, "requires": { - "@cypress/request": "^2.88.6", + "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", "@types/node": "^14.14.31", "@types/sinonjs__fake-timers": "^6.0.2", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", - "bluebird": "^3.7.2", + "bluebird": "3.7.2", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -3845,7 +3757,6 @@ "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", "proxy-from-env": "1.0.0", - "ramda": "~0.27.1", "request-progress": "^3.0.0", "supports-color": "^8.1.1", "tmp": "~0.2.1", @@ -4141,18 +4052,6 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, "fast-safe-stringify": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.1.1.tgz", @@ -4290,22 +4189,6 @@ "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.4.tgz", "integrity": "sha512-WjKPNJF79dtJAVniUlGGWHYGz2jWxT6VhN/4m1NdkbZ2nOsEF+cI1Edgql5zCRhs/VsQYRvrXctxktVXZUkixw==" }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -4318,14 +4201,14 @@ "dev": true }, "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", + "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, "requires": { "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "jsprim": "^2.0.2", + "sshpk": "^1.14.1" } }, "http2-wrapper": { @@ -4503,15 +4386,9 @@ "dev": true }, "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "json-stringify-safe": { @@ -4530,14 +4407,14 @@ } }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", + "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -4646,18 +4523,18 @@ "dev": true }, "mime-db": { - "version": "1.49.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.49.0.tgz", - "integrity": "sha512-CIc8j9URtOVApSFCQIF+VBkX1RwXp/oMMOrqdyXSBXq5RWNEsRfyj1kiRnQgmNXmHxPoFIxOroKA3zcU9P+nAA==", + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", "dev": true }, "mime-types": { - "version": "2.1.32", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.32.tgz", - "integrity": "sha512-hJGaVS4G4c9TSMYh2n6SQAGrC4RnfU+daP8G7cSCmaqNjiOoUY0VHCMS42pxnQmVF1GWwFhbHWn3RIxCqTmZ9A==", + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", "dev": true, "requires": { - "mime-db": "1.49.0" + "mime-db": "1.51.0" } }, "mimic-fn": { @@ -4882,12 +4759,6 @@ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true }, - "ramda": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", - "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", - "dev": true - }, "readable-stream": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", @@ -5159,15 +5030,6 @@ "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", "dev": true }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, "url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", diff --git a/package.json b/package.json index ba025eafb84b..df1a55d34d89 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@types/node": "^16.9.6", "@types/yamljs": "^0.2.31", "chrome-remote-interface": "^0.31.0", - "cypress": "^8.5.0", + "cypress": "^9.1.1", "dayjs": "^1.10.4", "got": "^11.8.2", "ory-prettier-styles": "1.1.1", diff --git a/test/e2e/package-lock.json b/test/e2e/package-lock.json index c8254be27a4f..e94337c0da65 100644 --- a/test/e2e/package-lock.json +++ b/test/e2e/package-lock.json @@ -12,7 +12,7 @@ "@types/node": "^16.9.6", "@types/yamljs": "^0.2.31", "chrome-remote-interface": "^0.31.0", - "cypress": "8.6.0", + "cypress": "^9.1.1", "dayjs": "^1.10.4", "got": "^11.8.2", "otplib": "^12.0.1", @@ -22,9 +22,9 @@ } }, "node_modules/@cypress/request": { - "version": "2.88.6", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.6.tgz", - "integrity": "sha512-z0UxBE/+qaESAHY9p9sM2h8Y4XqtsbDCt0/DPOrqA/RZgKi4PkxdpXyK4wCCnSk1xHqWHZZAE+gV6aDAR6+caQ==", + "version": "2.88.10", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz", + "integrity": "sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==", "dev": true, "dependencies": { "aws-sign2": "~0.7.0", @@ -34,8 +34,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", + "http-signature": "~1.3.6", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", @@ -269,22 +268,6 @@ "node": ">=8" } }, - "node_modules/ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "dependencies": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/epoberezkin" - } - }, "node_modules/ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -363,9 +346,9 @@ } }, "node_modules/asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "dependencies": { "safer-buffer": "~2.1.0" @@ -728,20 +711,20 @@ } }, "node_modules/cypress": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.6.0.tgz", - "integrity": "sha512-F7qEK/6Go5FsqTueR+0wEw2vOVKNgk5847Mys8vsWkzPoEKdxs+7N9Y1dit+zhaZCLtMPyrMwjfA53ZFy+lSww==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.1.1.tgz", + "integrity": "sha512-yWcYD8SEQ8F3okFbRPqSDj5V0xhrZBT5QRIH+P1J2vYvtEmZ4KGciHE7LCcZZLILOrs7pg4WNCqkj/XRvReQlQ==", "dev": true, "hasInstallScript": true, "dependencies": { - "@cypress/request": "^2.88.6", + "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", "@types/node": "^14.14.31", "@types/sinonjs__fake-timers": "^6.0.2", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", - "bluebird": "^3.7.2", + "bluebird": "3.7.2", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -769,7 +752,6 @@ "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", "proxy-from-env": "1.0.0", - "ramda": "~0.27.1", "request-progress": "^3.0.0", "supports-color": "^8.1.1", "tmp": "~0.2.1", @@ -1001,18 +983,6 @@ "node >=0.6.0" ] }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "node_modules/fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, "node_modules/fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -1200,29 +1170,6 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, - "node_modules/har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "deprecated": "this library is no longer supported", - "dev": true, - "dependencies": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - }, - "engines": { - "node": ">=6" - } - }, "node_modules/has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -1239,18 +1186,17 @@ "dev": true }, "node_modules/http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", + "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, "dependencies": { "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "jsprim": "^2.0.2", + "sshpk": "^1.14.1" }, "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" + "node": ">=0.10" } }, "node_modules/http2-wrapper": { @@ -1423,15 +1369,9 @@ "dev": true }, "node_modules/json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "node_modules/json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "node_modules/json-stringify-safe": { @@ -1453,9 +1393,9 @@ } }, "node_modules/jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", + "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "engines": [ "node >=0.6.0" @@ -1463,7 +1403,7 @@ "dependencies": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -1599,21 +1539,21 @@ "dev": true }, "node_modules/mime-db": { - "version": "1.50.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz", - "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==", + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", "dev": true, "engines": { "node": ">= 0.6" } }, "node_modules/mime-types": { - "version": "2.1.33", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz", - "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==", + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", "dev": true, "dependencies": { - "mime-db": "1.50.0" + "mime-db": "1.51.0" }, "engines": { "node": ">= 0.6" @@ -1872,12 +1812,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/ramda": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", - "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", - "dev": true - }, "node_modules/request-progress": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", @@ -2203,15 +2137,6 @@ "node": ">=8" } }, - "node_modules/uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "dependencies": { - "punycode": "^2.1.0" - } - }, "node_modules/url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", @@ -2356,9 +2281,9 @@ }, "dependencies": { "@cypress/request": { - "version": "2.88.6", - "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.6.tgz", - "integrity": "sha512-z0UxBE/+qaESAHY9p9sM2h8Y4XqtsbDCt0/DPOrqA/RZgKi4PkxdpXyK4wCCnSk1xHqWHZZAE+gV6aDAR6+caQ==", + "version": "2.88.10", + "resolved": "https://registry.npmjs.org/@cypress/request/-/request-2.88.10.tgz", + "integrity": "sha512-Zp7F+R93N0yZyG34GutyTNr+okam7s/Fzc1+i3kcqOP8vk6OuajuE9qZJ6Rs+10/1JFtXFYMdyarnU1rZuJesg==", "dev": true, "requires": { "aws-sign2": "~0.7.0", @@ -2368,8 +2293,7 @@ "extend": "~3.0.2", "forever-agent": "~0.6.1", "form-data": "~2.3.2", - "har-validator": "~5.1.3", - "http-signature": "~1.2.0", + "http-signature": "~1.3.6", "is-typedarray": "~1.0.0", "isstream": "~0.1.2", "json-stringify-safe": "~5.0.1", @@ -2590,18 +2514,6 @@ "indent-string": "^4.0.0" } }, - "ajv": { - "version": "6.12.6", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", - "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, - "requires": { - "fast-deep-equal": "^3.1.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.2" - } - }, "ansi-colors": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", @@ -2648,9 +2560,9 @@ } }, "asn1": { - "version": "0.2.4", - "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.6.tgz", + "integrity": "sha512-ix/FxPn0MDjeyJ7i/yoHGFt/EX6LyNbxSEhPPXODPL+KB0VPk86UYfL0lMdy+KCnv+fmvIzySwaK5COwqVbWTQ==", "dev": true, "requires": { "safer-buffer": "~2.1.0" @@ -2944,19 +2856,19 @@ } }, "cypress": { - "version": "8.6.0", - "resolved": "https://registry.npmjs.org/cypress/-/cypress-8.6.0.tgz", - "integrity": "sha512-F7qEK/6Go5FsqTueR+0wEw2vOVKNgk5847Mys8vsWkzPoEKdxs+7N9Y1dit+zhaZCLtMPyrMwjfA53ZFy+lSww==", + "version": "9.1.1", + "resolved": "https://registry.npmjs.org/cypress/-/cypress-9.1.1.tgz", + "integrity": "sha512-yWcYD8SEQ8F3okFbRPqSDj5V0xhrZBT5QRIH+P1J2vYvtEmZ4KGciHE7LCcZZLILOrs7pg4WNCqkj/XRvReQlQ==", "dev": true, "requires": { - "@cypress/request": "^2.88.6", + "@cypress/request": "^2.88.10", "@cypress/xvfb": "^1.2.4", "@types/node": "^14.14.31", "@types/sinonjs__fake-timers": "^6.0.2", "@types/sizzle": "^2.3.2", "arch": "^2.2.0", "blob-util": "^2.0.2", - "bluebird": "^3.7.2", + "bluebird": "3.7.2", "cachedir": "^2.3.0", "chalk": "^4.1.0", "check-more-types": "^2.24.0", @@ -2984,7 +2896,6 @@ "ospath": "^1.2.2", "pretty-bytes": "^5.6.0", "proxy-from-env": "1.0.0", - "ramda": "~0.27.1", "request-progress": "^3.0.0", "supports-color": "^8.1.1", "tmp": "~0.2.1", @@ -3156,18 +3067,6 @@ "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", "dev": true }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true - }, "fd-slicer": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/fd-slicer/-/fd-slicer-1.1.0.tgz", @@ -3302,22 +3201,6 @@ "integrity": "sha512-qkIilPUYcNhJpd33n0GBXTB1MMPp14TxEsEs0pTrsSVucApsYzW5V+Q8Qxhik6KU3evy+qkAAowTByymK0avdg==", "dev": true }, - "har-schema": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz", - "integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=", - "dev": true - }, - "har-validator": { - "version": "5.1.5", - "resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.5.tgz", - "integrity": "sha512-nmT2T0lljbxdQZfspsno9hgrG3Uir6Ks5afism62poxqBM6sDnMEuPmzTq8XN0OEwqKLLdh1jQI3qyE66Nzb3w==", - "dev": true, - "requires": { - "ajv": "^6.12.3", - "har-schema": "^2.0.0" - } - }, "has-flag": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", @@ -3331,14 +3214,14 @@ "dev": true }, "http-signature": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz", - "integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=", + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz", + "integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==", "dev": true, "requires": { "assert-plus": "^1.0.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" + "jsprim": "^2.0.2", + "sshpk": "^1.14.1" } }, "http2-wrapper": { @@ -3472,15 +3355,9 @@ "dev": true }, "json-schema": { - "version": "0.2.3", - "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz", - "integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", + "integrity": "sha512-es94M3nTIfsEPisRafak+HDLfHXnKBhV3vU5eqPcS3flIWqcxJWgXHXiey3YrpaNsanY5ei1VoYEbOzijuq9BA==", "dev": true }, "json-stringify-safe": { @@ -3500,14 +3377,14 @@ } }, "jsprim": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", - "integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz", + "integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==", "dev": true, "requires": { "assert-plus": "1.0.0", "extsprintf": "1.3.0", - "json-schema": "0.2.3", + "json-schema": "0.4.0", "verror": "1.10.0" } }, @@ -3612,18 +3489,18 @@ "dev": true }, "mime-db": { - "version": "1.50.0", - "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.50.0.tgz", - "integrity": "sha512-9tMZCDlYHqeERXEHO9f/hKfNXhre5dK2eE/krIvUjZbS2KPcqGDfNShIWS1uW9XOTKQKqK6qbeOci18rbfW77A==", + "version": "1.51.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz", + "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==", "dev": true }, "mime-types": { - "version": "2.1.33", - "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.33.tgz", - "integrity": "sha512-plLElXp7pRDd0bNZHw+nMd52vRYjLwQjygaNg7ddJ2uJtTlmnTCjWuPKxVu6//AdaRuME84SvLW91sIkBqGT0g==", + "version": "2.1.34", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz", + "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==", "dev": true, "requires": { - "mime-db": "1.50.0" + "mime-db": "1.51.0" } }, "mimic-fn": { @@ -3812,12 +3689,6 @@ "integrity": "sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==", "dev": true }, - "ramda": { - "version": "0.27.1", - "resolved": "https://registry.npmjs.org/ramda/-/ramda-0.27.1.tgz", - "integrity": "sha512-PgIdVpn5y5Yns8vqb8FzBUEYn98V3xcPgawAkkgj0YJ0qDsnHCiNmZYfOGMgOvoB0eWFLpYbhxUR3mxfDIMvpw==", - "dev": true - }, "request-progress": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/request-progress/-/request-progress-3.0.0.tgz", @@ -4054,15 +3925,6 @@ "integrity": "sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==", "dev": true }, - "uri-js": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", - "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, "url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", diff --git a/test/e2e/package.json b/test/e2e/package.json index 939dbde27147..c35835c92e6d 100644 --- a/test/e2e/package.json +++ b/test/e2e/package.json @@ -13,7 +13,7 @@ "@types/node": "^16.9.6", "@types/yamljs": "^0.2.31", "chrome-remote-interface": "^0.31.0", - "cypress": "8.6.0", + "cypress": "^9.1.1", "dayjs": "^1.10.4", "got": "^11.8.2", "otplib": "^12.0.1", diff --git a/test/e2e/proxy/package-lock.json b/test/e2e/proxy/package-lock.json index d559e4ccca62..1a4852f395e8 100644 --- a/test/e2e/proxy/package-lock.json +++ b/test/e2e/proxy/package-lock.json @@ -5,6 +5,7 @@ "requires": true, "packages": { "": { + "name": "proxy", "version": "1.0.0", "dependencies": { "express": "^4.17.1", diff --git a/test/e2e/run.sh b/test/e2e/run.sh index 56d6d79ddbca..051283470d32 100755 --- a/test/e2e/run.sh +++ b/test/e2e/run.sh @@ -18,58 +18,25 @@ export KRATOS_UI_REACT_NATIVE_URL=http://127.0.0.1:4457/ export LOG_LEAK_SENSITIVE_VALUES=true export DEV_DISABLE_API_FLOW_ENFORCEMENT=true -if [ -z ${TEST_DATABASE_POSTGRESQL+x} ]; then - docker rm -f kratos_test_database_mysql kratos_test_database_postgres kratos_test_database_cockroach || true - docker run --platform linux/amd64 --name kratos_test_database_mysql -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:5.7 - docker run --name kratos_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:9.6 postgres -c log_statement=all - docker run --name kratos_test_database_cockroach -p 3446:26257 -d cockroachdb/cockroach:v20.2.4 start-single-node --insecure - - export TEST_DATABASE_MYSQL="mysql://root:secret@(localhost:3444)/mysql?parseTime=true&multiStatements=true" - export TEST_DATABASE_POSTGRESQL="postgres://postgres:secret@localhost:3445/postgres?sslmode=disable" - export TEST_DATABASE_COCKROACHDB="cockroach://root@localhost:3446/defaultdb?sslmode=disable" -fi - base=$(pwd) -if [ -z ${NODE_UI_PATH+x} ]; then - node_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/kratos-selfservice-ui-node" - git clone --depth 1 --branch master https://github.com/ory/kratos-selfservice-ui-node.git "$node_ui_dir" - (cd "$node_ui_dir" && npm i && npm run build) -else - node_ui_dir="${NODE_UI_PATH}" -fi - -if [ -z ${RN_UI_PATH+x} ]; then - rn_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/kratos-selfservice-ui-react-native" - git clone --depth 1 --branch master https://github.com/ory/kratos-selfservice-ui-react-native.git "$rn_ui_dir" - (cd "$rn_ui_dir" && npm i) -else - rn_ui_dir="${RN_UI_PATH}" -fi - -if [ -z ${REACT_UI_PATH+x} ]; then - react_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/ory/kratos-selfservice-ui-react-nextjs" - git clone --depth 1 --branch master https://github.com/ory/kratos-selfservice-ui-react-nextjs.git "$react_ui_dir" - (cd "$react_ui_dir" && npm i) -else - react_ui_dir="${REACT_UI_PATH}" -fi - -( - rm test/e2e/proxy.json || true - echo '"express"' > test/e2e/proxy.json - cd test/e2e/proxy - npm i -) - -if [ -z ${CI+x} ]; then - docker rm mailslurper hydra hydra-ui -f || true - docker run --name mailslurper -p 4436:4436 -p 4437:4437 -p 1025:1025 oryd/mailslurper:latest-smtps > "${base}/test/e2e/mailslurper.e2e.log" 2>&1 & -fi - +setup=yes dev=no +nokill=no for i in "$@"; do case $i in + --no-kill) + nokill=yes + shift # past argument=value + ;; + --only-setup) + setup=only + shift # past argument=value + ;; + --no-setup) + setup=no + shift # past argument=value + ;; --dev) dev=yes shift # past argument=value @@ -77,16 +44,62 @@ for i in "$@"; do esac done -run() { - killall kratos || true - killall node || true - killall modd || true - killall hydra || true - killall hydra-login-consent || true +prepare() { + if [[ "${nokill}" == "no" ]]; then + killall node || true + killall modd || true + killall hydra || true + killall hydra-login-consent || true + fi + + if [ -z ${TEST_DATABASE_POSTGRESQL+x} ]; then + docker rm -f kratos_test_database_mysql kratos_test_database_postgres kratos_test_database_cockroach || true + docker run --platform linux/amd64 --name kratos_test_database_mysql -p 3444:3306 -e MYSQL_ROOT_PASSWORD=secret -d mysql:5.7 + docker run --name kratos_test_database_postgres -p 3445:5432 -e POSTGRES_PASSWORD=secret -e POSTGRES_DB=postgres -d postgres:9.6 postgres -c log_statement=all + docker run --name kratos_test_database_cockroach -p 3446:26257 -d cockroachdb/cockroach:v20.2.4 start-single-node --insecure + + export TEST_DATABASE_MYSQL="mysql://root:secret@(localhost:3444)/mysql?parseTime=true&multiStatements=true" + export TEST_DATABASE_POSTGRESQL="postgres://postgres:secret@localhost:3445/postgres?sslmode=disable" + export TEST_DATABASE_COCKROACHDB="cockroach://root@localhost:3446/defaultdb?sslmode=disable" + fi + + if [ -z ${NODE_UI_PATH+x} ]; then + node_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/kratos-selfservice-ui-node" + git clone --depth 1 --branch master https://github.com/ory/kratos-selfservice-ui-node.git "$node_ui_dir" + (cd "$node_ui_dir" && npm i && npm run build) + else + node_ui_dir="${NODE_UI_PATH}" + fi + + if [ -z ${RN_UI_PATH+x} ]; then + rn_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/kratos-selfservice-ui-react-native" + git clone --depth 1 --branch master https://github.com/ory/kratos-selfservice-ui-react-native.git "$rn_ui_dir" + (cd "$rn_ui_dir" && npm i) + else + rn_ui_dir="${RN_UI_PATH}" + fi + + if [ -z ${REACT_UI_PATH+x} ]; then + react_ui_dir="$(mktemp -d -t ci-XXXXXXXXXX)/ory/kratos-selfservice-ui-react-nextjs" + git clone --depth 1 --branch master https://github.com/ory/kratos-selfservice-ui-react-nextjs.git "$react_ui_dir" + (cd "$react_ui_dir" && npm i) + else + react_ui_dir="${REACT_UI_PATH}" + fi + + ( + rm test/e2e/proxy.json || true + echo '"express"' > test/e2e/proxy.json + cd test/e2e/proxy + npm i + ) + + if [ -z ${CI+x} ]; then + docker rm mailslurper hydra hydra-ui -f || true + docker run --name mailslurper -p 4436:4436 -p 4437:4437 -p 1025:1025 oryd/mailslurper:latest-smtps > "${base}/test/e2e/mailslurper.e2e.log" 2>&1 & + fi # Check if any ports that we need are open already - ! nc -zv localhost 4434 - ! nc -zv localhost 4433 ! nc -zv localhost 4446 ! nc -zv localhost 4455 ! nc -zv localhost 4456 @@ -179,11 +192,20 @@ run() { go build . && PORT=4446 HYDRA_ADMIN_URL=http://localhost:4445 ./hydra-login-consent >"${base}/test/e2e/hydra-ui.e2e.log" 2>&1 & ) +} + +run() { + killall modd || true + killall kratos || true export DSN=${1} + ! nc -zv localhost 4434 + ! nc -zv localhost 4433 + + ls -la . for profile in email mobile oidc recovery verification mfa spa; do - yq merge test/e2e/profiles/kratos.base.yml "test/e2e/profiles/${profile}/.kratos.yml" >test/e2e/kratos.${profile}.yml + yq merge test/e2e/profiles/kratos.base.yml "test/e2e/profiles/${profile}/.kratos.yml" > test/e2e/kratos.${profile}.yml cp test/e2e/kratos.email.yml test/e2e/kratos.generated.yml done @@ -243,19 +265,31 @@ To run e2e tests in dev mode (useful for writing them), run: $0 --dev +To set up all the services without running the tests, use: + + $0 --only-setup + +To then run the tests without the set up steps, use: + + $0 --no-setup + +To prevent processes from being killed during set up phase, use: + $0 --no-kill + If you are making changes to the kratos-selfservice-ui-node project as well, point the 'NODE_UI_PATH' environment variable to the path where the kratos-selfservice-ui-node project is checked out: export NODE_UI_PATH=$HOME/workspace/kratos-selfservice-ui-node export RN_UI_PATH=$HOME/workspace/kratos-selfservice-ui-react-native + export REACT_UI_PATH=$HOME/workspace/kratos-selfservice-ui-react-nextjs $0 ..." } export TEST_DATABASE_SQLITE="sqlite:///$(mktemp -d -t ci-XXXXXXXXXX)/db.sqlite?_fk=true" export TEST_DATABASE_MEMORY="memory" -case "$1" in +case "${1:-default}" in sqlite) echo "Database set up at: $TEST_DATABASE_SQLITE" db="${TEST_DATABASE_SQLITE}" @@ -275,8 +309,16 @@ cockroach) *) usage - exit 1 + if [[ "${setup}" == "only" ]]; then + prepare + exit 0 + else + exit 1 + fi ;; esac +if [[ "${setup}" == "yes" ]]; then + prepare +fi run "${db}" From 6bfd55e84ba345592cb1699add68a3e1ad17cbdf Mon Sep 17 00:00:00 2001 From: aeneasr <3372410+aeneasr@users.noreply.github.com> Date: Fri, 10 Dec 2021 16:09:42 +0000 Subject: [PATCH 37/37] autogen(docs): generate and format documentation