Skip to content

Commit 103d126

Browse files
author
depthfirst-app[bot]
committed
fix: enforce SIWE expiration without not-before
1 parent 0fb56ca commit 103d126

2 files changed

Lines changed: 9 additions & 3 deletions

File tree

internal/api/web3.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func (a *API) web3GrantEthereum(ctx context.Context, w http.ResponseWriter, r *h
244244
return apierrors.NewOAuthError("invalid_grant", "Signed Ethereum message becomes valid in the future")
245245
}
246246

247-
if parsedMessage.NotBefore != nil && parsedMessage.ExpirationTime != nil && !parsedMessage.ExpirationTime.IsZero() && now.After(*parsedMessage.ExpirationTime) {
247+
if parsedMessage.ExpirationTime != nil && !parsedMessage.ExpirationTime.IsZero() && now.After(*parsedMessage.ExpirationTime) {
248248
return apierrors.NewOAuthError("invalid_grant", "Signed Ethereum message is expired")
249249
}
250250

internal/api/web3_test.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,8 +594,14 @@ func (ts *Web3TestSuite) TestValidationRules_ValidatedBeforeNotBefore() {
594594
}
595595

596596
func (ts *Web3TestSuite) TestValidationRules_Expired() {
597+
solanaEnabled := ts.Config.External.Web3Solana.Enabled
598+
ethereumEnabled := ts.Config.External.Web3Ethereum.Enabled
599+
ts.Config.External.Web3Solana.Enabled = true
600+
ts.Config.External.Web3Ethereum.Enabled = true
597601
defer func() {
598602
ts.API.overrideTime = nil
603+
ts.Config.External.Web3Solana.Enabled = solanaEnabled
604+
ts.Config.External.Web3Ethereum.Enabled = ethereumEnabled
599605
}()
600606

601607
ts.API.overrideTime = func() time.Time {
@@ -615,8 +621,8 @@ func (ts *Web3TestSuite) TestValidationRules_Expired() {
615621
},
616622
{
617623
chain: ChainEthereum,
618-
message: "supabase.com wants you to sign in with your Ethereum account:\n0xDAEaF48CC1736705388Bb0cB2A22559d751FCBaC\n\nStatement\n\nURI: https://supabase.com/\nVersion: 1\nIssued At: 2025-03-29T00:00:00Z\nExpiration Time: 2025-03-29T00:10:00Z\nNot Before: 2025-03-29T00:00:00Z",
619-
signature: "0x3c1d21a56fcb057cc43f8a59a1de903022b30a31ff7bcf8e33387ba08d5f450337df6dfdd48dc941caf925e51c2e8d9987683822c9c413d16ef0ce03c6d1e12f1c"},
624+
message: "supabase.com wants you to sign in with your Ethereum account:\n0x7E5F4552091A69125d5DfCb7b8C2659029395Bdf\n\nStatement\n\nURI: https://supabase.com/\nVersion: 1\nIssued At: 2025-03-29T00:04:00Z\nExpiration Time: 2025-03-29T00:05:00Z",
625+
signature: "0x5bddcab7ca868bbb5a93c7fe93e24205d596f594deedecb6c22d72bd9af863d72becc70a15574e07f7f856cd4ee17dc1ed3512a297ebef41b7aa07f3152049e600"},
620626
}
621627

622628
for _, example := range examples {

0 commit comments

Comments
 (0)