feat: sync deployed v1.0.0-rc.38-custom.42
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
This commit is contained in:
1 parent
aa6c3f50f4
commit
ceddfd3d6b
828 files changed
+122253
-13702
No files matched your search
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/QuantumNous/new-api/common"
|
||||
"github.com/QuantumNous/new-api/setting/system_setting"
|
||||
"github.com/go-redis/redis/v8"
|
||||
"github.com/go-webauthn/webauthn/webauthn"
|
||||
"github.com/pquerna/otp/totp"
|
||||
@@ -260,6 +261,22 @@ func TestSecurityFactorMutationsAdvanceUserAuthVersion(t *testing.T) {
|
||||
|
||||
func TestUpdatePasskeyAssertionStateCannotRewriteRegistrationIdentity(t *testing.T) {
|
||||
truncateTables(t)
|
||||
require.NoError(t, DB.AutoMigrate(&Option{}))
|
||||
previousSettings := *system_setting.GetPasskeySettings()
|
||||
domainKeys := map[string]any{"key": []string{"ServerAddress", "passkey.rp_id", "passkey.legacy_rp_ids", "passkey.origins"}}
|
||||
var previousOptions []Option
|
||||
require.NoError(t, DB.Where(domainKeys).Find(&previousOptions).Error)
|
||||
t.Cleanup(func() {
|
||||
*system_setting.GetPasskeySettings() = previousSettings
|
||||
require.NoError(t, DB.Where(domainKeys).Delete(&Option{}).Error)
|
||||
if len(previousOptions) > 0 {
|
||||
require.NoError(t, DB.Create(&previousOptions).Error)
|
||||
}
|
||||
})
|
||||
*system_setting.GetPasskeySettings() = system_setting.PasskeySettings{RPID: "example.com", Origins: "https://example.com"}
|
||||
for _, option := range []Option{{Key: "passkey.rp_id", Value: "example.com"}, {Key: "passkey.legacy_rp_ids", Value: ""}, {Key: "passkey.origins", Value: "https://example.com"}} {
|
||||
require.NoError(t, DB.Save(&option).Error)
|
||||
}
|
||||
|
||||
user := User{Username: "passkey-assertion-state", Password: "password", AuthVersion: 1}
|
||||
require.NoError(t, DB.Create(&user).Error)
|
||||
@@ -292,7 +309,7 @@ func TestUpdatePasskeyAssertionStateCannotRewriteRegistrationIdentity(t *testing
|
||||
CloneWarning: true,
|
||||
},
|
||||
}
|
||||
require.NoError(t, UpdatePasskeyAssertionState(user.Id, validated, usedAt))
|
||||
require.NoError(t, UpdatePasskeyAssertionState(user.Id, validated, usedAt, "example.com"))
|
||||
|
||||
var updated PasskeyCredential
|
||||
require.NoError(t, DB.First(&updated, stored.ID).Error)
|
||||
@@ -312,7 +329,7 @@ func TestUpdatePasskeyAssertionStateCannotRewriteRegistrationIdentity(t *testing
|
||||
assert.Equal(t, usedAt.Unix(), updated.LastUsedAt.Unix())
|
||||
|
||||
validated.ID = []byte("another-credential")
|
||||
assert.ErrorIs(t, UpdatePasskeyAssertionState(user.Id, validated, usedAt), ErrPasskeyNotFound)
|
||||
assert.ErrorIs(t, UpdatePasskeyAssertionState(user.Id, validated, usedAt, "example.com"), ErrPasskeyNotFound)
|
||||
}
|
||||
|
||||
func assertUserAuthVersion(t *testing.T, userID int, expected int64) {
|
||||
|
||||
Reference in new issue
Block a user