fix(im): harden Yunzhijia image download and prune dead validation

- Follow a single download redirect while re-validating the target stays
  within the allowed host suffix; never forward the bearer token across it.
  The shared http client disables auto-redirects for SSRF safety, so a 302
  from downloadfileOpen previously failed the download outright.
- Cap in-memory download size at 32 MiB via a limited read-closer that
  errors instead of silently truncating, avoiding OOM on large responses.
- Remove dead frontend host-suffix validation branch (normalize always
  fills the default) and drop the now-unused i18n keys
  yunzhijiaAllowedHostSuffixRequired / yunzhijiaRequiredCredentials.
- Add tests for redirect follow/reject and the size limit.
This commit is contained in:
wizardchen
2026-07-23 12:34:36 +08:00
committed by lyingbug
parent 85c9b61ad0
commit 0869f3e829
7 changed files with 211 additions and 21 deletions
-2
View File
@@ -5488,9 +5488,7 @@ export default {
yunzhijiaTimeoutHint: 'Таймаут отправки ответов через URL отправки сообщений, по умолчанию 10 секунд',
yunzhijiaAllowedHostSuffix: 'Допустимый суффикс хоста',
yunzhijiaAllowedHostSuffixHint: 'Ограничить хост URL отправки сообщений этим суффиксом для безопасности (напр. yunzhijia.com)',
yunzhijiaRequiredCredentials: 'Укажите URL отправки сообщений и допустимый суффикс хоста',
yunzhijiaSendMsgUrlRequired: 'Укажите URL отправки сообщений из настроек робота Yunzhijia',
yunzhijiaAllowedHostSuffixRequired: 'Укажите допустимый суффикс хоста',
mattermostModeHint: 'Mattermost поддерживает только режим Webhook (исходящий вебхук + токен бота).',
mattermostPostToMain: 'Ответы в основной ленте канала',
mattermostPostToMainHint: