Refuse transfers to placeholder users
Check the recipient where the money moves, so reaction tips, /send and inline sends to an existing placeholder wallet are covered too. The reply check in loadReplyToInterceptor is no longer needed and blocked /send with an explicit recipient. (cherry picked from commit c8ea81d58aed2f288d0aee9fe63c3da08a97867c) Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
committed by
Michilis
parent
8989483891
commit
d1d51bbb16
@@ -165,9 +165,6 @@ func (bot TipBot) tryLoadUserInterceptor(ctx intercept.Context) (intercept.Conte
|
||||
func (bot TipBot) loadReplyToInterceptor(ctx intercept.Context) (intercept.Context, error) {
|
||||
if ctx.Message() != nil {
|
||||
if ctx.Message().ReplyTo != nil {
|
||||
if isPlaceholderSender(ctx.Message().ReplyTo.Sender) {
|
||||
return ctx, fmt.Errorf("[loadReplyToInterceptor] reply to placeholder sender %d", ctx.Message().ReplyTo.Sender.ID)
|
||||
}
|
||||
if ctx.Message().ReplyTo.Sender != nil {
|
||||
user, _ := GetUser(ctx.Message().ReplyTo.Sender, bot)
|
||||
user.Telegram = ctx.Message().ReplyTo.Sender
|
||||
|
||||
@@ -88,6 +88,11 @@ func (t *Transaction) SendTransaction(bot *TipBot, from *lnbits.User, to *lnbits
|
||||
fromUserStr := GetUserStr(from.Telegram)
|
||||
toUserStr := GetUserStr(to.Telegram)
|
||||
|
||||
// nobody can spend from the wallet of a shared placeholder user
|
||||
if isPlaceholderSender(to.Telegram) {
|
||||
return false, fmt.Errorf("cannot send to placeholder user %s", toUserStr)
|
||||
}
|
||||
|
||||
t.FromWallet = from.Wallet.ID
|
||||
t.FromLNbitsID = from.ID
|
||||
|
||||
|
||||
Reference in New Issue
Block a user