mirror of
https://github.com/go-gitea/gitea.git
synced 2025-06-21 13:57:53 +00:00
# Fix Feishu Webhook Signature Verification This PR implements proper signature verification for Feishu (Lark) webhooks according to the [official documentation](https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot). ## Changes - Implemented the `GenSign` function based on Feishu's official Go sample code - Modified the webhook request creation to include timestamp and signature in the payload when a secret is configured - Fixed the signature generation algorithm to properly use HMAC-SHA256 with the correct string format ## Implementation Details The signature verification works as follows: 1. When a webhook secret is provided, a timestamp is generated 2. The signature string is created using `timestamp + "\n" + secret` 3. The HMAC-SHA256 algorithm is applied to an empty string using the signature string as the key 4. The result is Base64 encoded to produce the final signature 5. Both timestamp and signature are added to the payload According to Feishu's documentation, the timestamp must be within 1 hour (3600 seconds) of the current time to be considered valid. ## Security Note Feishu emphasizes the importance of keeping webhook URLs secure. Do not disclose them on GitHub, blogs, or any public sites to prevent unauthorized use. ## References - [Feishu Custom Bot Documentation](https://open.feishu.cn/document/client-docs/bot-v3/add-custom-bot) --------- Co-authored-by: hiifong <i@hiif.ong> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> |
||
---|---|---|
.. | ||
deliver_test.go | ||
deliver.go | ||
dingtalk_test.go | ||
dingtalk.go | ||
discord_test.go | ||
discord.go | ||
feishu_test.go | ||
feishu.go | ||
general_test.go | ||
general.go | ||
main_test.go | ||
matrix_test.go | ||
matrix.go | ||
msteams_test.go | ||
msteams.go | ||
notifier.go | ||
packagist_test.go | ||
packagist.go | ||
payloader.go | ||
slack_test.go | ||
slack.go | ||
telegram_test.go | ||
telegram.go | ||
webhook_test.go | ||
webhook.go | ||
wechatwork.go |