fix(webhooks): блокировать DNS rebinding в outbound fetch#559
Merged
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#530
Author
Working session summaryГотово: PR #559 обновлен и переведен в ready for review: #559 Сделано:
Проверки локально прошли:
CI на свежем head This summary was automatically extracted from the AI working session output. |
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: (321.1K + 9.8M cached) input tokens, 54.2K output tokens, $15.400462 cost 🤖 Models used:
📎 Log file uploaded as Repository (60591KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #530
Что изменено
outbound-url-guardтеперь резолвит hostname перед outbound-запросом, проверяет все A/AAAA адреса на private/loopback/link-local/metadata ranges и возвращает validated address set.fetchValidatedOutboundUrl: запрос выполняется через одноразовыйundici.Agentс pinnedlookup, поэтому подключение использует только уже проверенные IP; redirects переведены вmanual, чтобы не следовать на непроверенный URL.WebhookDispatcherиспользуют новый pinned fetch на request-time. Create/update webhooks сохраняют синхронную shape-проверку, а DNS SSRF-блокировка происходит непосредственно перед отправкой.call_apiпереведен на тот же pinned outbound fetch helper, чтобы execution-time защита соответствовала workflow validation.README.mdсинхронизирован с текущей версией0.8.32, чтобы существующий docs-тест оставался зеленым.Как воспроизвести
До исправления webhook hostname вроде
https://rebind.example.com/hookмог пройти literal URL validation, а затем при фактическомfetchрезолвиться в169.254.169.254или другой internal address. Также DNS lookup, который делал обычныйfetch, не был привязан к предварительно проверенному IP, что оставляло окно для DNS rebinding между validation и connect.Регрессионные проверки
src/services/__tests__/alerting.test.ts:validateWebhookUrlи anomaly webhook dispatch отклоняют hostname, который резолвится в metadata IP, и не вызываютfetch.src/services/__tests__/webhook-dispatcher.test.ts: delivery в metadata-resolved hostname помечается как permanent failure без outboundfetch.src/services/__tests__/workflow-executor.test.ts: successfulcall_apiполучает pinned dispatcher иredirect: "manual"; DNS lookup выполняется с{ all: true, verbatim: true }.Проверки
npm run build:sdknpm run typechecknpm run lintnpm test -- src/services/__tests__/alerting.test.ts src/services/__tests__/webhook-dispatcher.test.ts src/services/__tests__/workflow-executor.test.ts src/webui/__tests__/workflows-routes.test.tsnpm test -- src/docs/__tests__/readme.test.tsnpm test(222 files, 3631 tests)npm run format:checknpm run build:backend