tpitale / mail_room

Forward mail from gmail IMAP to a callback URL or job worker, simply.
MIT License
193 stars 51 forks source link

Add `iat` payload to postback JWT authentication #135

Closed 0x2c7 closed 2 years ago

0x2c7 commented 2 years ago

This PR is the following-up PR of https://github.com/tpitale/mail_room/pull/134. In the previous PR, I implemented JWT authentication support for postback strategy. The new authentication works well, but expose a potential attack vector such as replay attacks. A good way to prevent such attacks is to make token time-limited. JWT provides two ways of doing this via the claims:

The second approach seems most reasonable.

0x2c7 commented 2 years ago

@stanhu Could you have a look at this small change? Sorry, I missed your comment when implementing the previous PR.

stanhu commented 2 years ago

Looks good to me, thanks!