Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: regenerate csrf if flow has expired #2455

Merged
merged 1 commit into from
Dec 29, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 4 additions & 2 deletions selfservice/strategy/link/strategy_verification_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ func TestVerification(t *testing.T) {
assert.Equal(t, "The verification token is invalid or has already been used. Please retry the flow.", sr.Ui.Messages[0].Text)
})

t.Run("description=should not be able to use an outdated link", func(t *testing.T) {
t.Run("description=should not be able to request link with an outdated flow", func(t *testing.T) {
conf.MustSet(ctx, config.ViperKeySelfServiceVerificationRequestLifespan, time.Millisecond*200)
t.Cleanup(func() {
conf.MustSet(ctx, config.ViperKeySelfServiceVerificationRequestLifespan, time.Minute)
Expand All @@ -230,7 +230,7 @@ func TestVerification(t *testing.T) {
assert.Contains(t, res.Request.URL.String(), conf.SelfServiceFlowVerificationUI(ctx).String())
})

t.Run("description=should not be able to use an outdated flow", func(t *testing.T) {
t.Run("description=should not be able to use link with an outdated flow", func(t *testing.T) {
conf.MustSet(ctx, config.ViperKeySelfServiceVerificationRequestLifespan, time.Millisecond*200)
t.Cleanup(func() {
conf.MustSet(ctx, config.ViperKeySelfServiceVerificationRequestLifespan, time.Minute)
Expand All @@ -248,6 +248,8 @@ func TestVerification(t *testing.T) {

time.Sleep(time.Millisecond * 201)

//Clear cookies as link might be opened in another browser
c = testhelpers.NewClientWithCookies(t)
res, err := c.Get(verificationLink)
require.NoError(t, err)

Expand Down