SIWE ExpirationTime check skipped when NotBefore is absent

Open Beginner friendly
#2,453 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
go

Research direction

Start at the web3GrantEthereum handler and inspect how SIWE NotBefore and ExpirationTime are validated. Compare its independent expiration handling with the Solana handler shown in the issue. Done means a SIWE message with an expirationTime but no notBefore is rejected after it expires, while the existing validity fallback remains unchanged.

Written by the indexing model from the issue text.

Description

In web3GrantEthereum, the expiration time check for SIWE messages is gated on NotBefore != nil:

if parsedMessage.NotBefore != nil && parsedMessage.ExpirationTime != nil && !parsedMessage.ExpirationTime.IsZero() && now.After(*parsedMessage.ExpirationTime) {

Per EIP-4361, not-before and expiration-time are independent optional fields. A SIWE message can specify an expirationTime without a notBefore. When that happens, the entire expiration check is skipped and the expired message is accepted.

The Solana handler checks them independently and doesn't have this issue:

if !parsedMessage.ExpirationTime.IsZero() && now.After(parsedMessage.ExpirationTime) {

The MaximumValidityDuration fallback doesn't help here because it's a broader window based on IssuedAt, not the per-message ExpirationTime. A message that sets a 5-minute expiration would still be accepted for the full MaximumValidityDuration window.

Removing parsedMessage.NotBefore != nil && from the condition fixes it.

Dominant language
Go
Stars
2.6k
Forks
764
Avg merge
5d 3h
Merged PRs (30d)
39

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from supabase/auth

All issues in supabase/auth

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.