-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing security issue when an user gain access to a different account.
- Loading branch information
1 parent
6d3d241
commit 8c499f9
Showing
2 changed files
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,6 +84,23 @@ func TestGetOauthReturn(t *testing.T) { | |
test.AssertRedirect(t, res, "https://localhost:9999/return?status=failed") | ||
}) | ||
|
||
t.Run("not connect provider account already linked", func(t *testing.T) { | ||
linkedAccount, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(t, err) | ||
|
||
err = app.AccountStore.AddOauthAccount(linkedAccount.ID, "test", "LINKEDID", "TOKEN") | ||
require.NoError(t, err) | ||
|
||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(t, err) | ||
|
||
session := test.CreateSession(app.RefreshTokenStore, app.Config, account.ID) | ||
|
||
res, err := client.WithCookie(session).Get("/oauth/test/return?code=LINKEDID&state=" + state) | ||
require.NoError(t, err) | ||
test.AssertRedirect(t, res, "https://localhost:9999/return?status=failed") | ||
}) | ||
|
||
t.Run("log in to existing identity", func(t *testing.T) { | ||
account, err := app.AccountStore.Create("[email protected]", []byte("password")) | ||
require.NoError(t, err) | ||
|