Skip to content

Commit

Permalink
reject files with 10+ seconds in the future
Browse files Browse the repository at this point in the history
because nobody who lets their time get that out of date nowadays is being honest

trying to make their post stick, are they?
  • Loading branch information
mleku committed Dec 4, 2024
1 parent fa4c076 commit 8047206
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions cmd/realy/app/implementation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"sync"
"time"

"realy.lol/context"
"realy.lol/ec/schnorr"
Expand Down Expand Up @@ -72,6 +73,11 @@ func (r *Relay) AcceptEvent(c cx, evt *event.T, hr *http.Request, origin st,
if !r.AuthEnabled() {
return true, "", nil
}
if evt.CreatedAt.I64()-10 > time.Now().Unix() {
return false,
"realy does not accept timestamps that are so obviously fake, fix your clock",
nil
}
if len(authedPubkey) != 32 {
return false, fmt.Sprintf("client not authed with auth required %s", origin), nil
}
Expand Down
2 changes: 1 addition & 1 deletion realy/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v1.2.31
v1.2.32

0 comments on commit 8047206

Please sign in to comment.