Repository navigation
fix(api): send a ClickStack User-Agent on generic alert webhooks - #3767
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
🦋 Changeset detectedLatest commit: 39d9e0b The changes in this PR will be included in the next version bump. This PR includes changesets to release 3 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
🔵 Tier 2 — Low RiskSmall, isolated change with no API route or data model modifications. Why this tier:
Additional context: touches background tasks or the delivery pipeline lightly (16 lines, under the 30-line bar for Tier 4) Review process: AI review + quick human skim (target: 5–15 min). Reviewer validates AI assessment and checks for domain-specific concerns. Stats
|
Duplicate code analysisNo new duplicate code introduced by this PR. jscpd compared this branch against |
PR Review
1 finding(s): 🔴 0 P0/P1 · 🟡 0 P2 · 🔵 1 P3 No inline comments. 1 P3 folded at the bottom. 🔵 1 P3 — no action needed before merge
Priority comes from a separate grading pass over the finished review. P3 is folded here instead of posted inline. No finding blocks merge automatically; a maintainer decides. |
Deep Review✅ No critical issues found. This is a small, well-scoped change: outbound generic/incident.io alert webhooks now send a default 🟡 P2 -- recommended
Reviewers (7): correctness, testing, maintainability, security, reliability, kieran-typescript, previous-comments. Testing gaps:
No finding blocks merge automatically. A maintainer will expect P0/P1 findings in code this PR changes to be fixed; P2/P3 are your call -- fix or reply. Never fix findings about surrounding code here; reply instead. Do not widen the PR. How to respond |
The undici fetch adopted for DNS-pinned webhook delivery defaults to User-Agent: undici, which some receiver WAFs block with a 403. Send ClickStack-Alerts/<version> unless the webhook sets its own User-Agent, matched case-insensitively. Refs HDX-6170
c85fb9c to
62f91cd
Compare
E2E Test Results✅ All tests passed • 475 passed • 1 skipped • 1080s
Tests ran across 4 shards in parallel. |
Summary
Generic and incident.io alert webhooks have sent
User-Agent: undicisince #3588 moved delivery to undici'sfetch(for DNS-pinned SSRF checks). Node's built-in fetch sentnode. Some receivers' WAFs blockundici. They return an HTML403 Forbiddenbefore the request reaches the receiving service, so every alert to them fails.Webhook delivery now sends
User-Agent: ClickStack-Alerts/<CODE_VERSION>, orClickStack-Alertswhen no version is set. A User-Agent in the webhook's headers still wins. The check ignores case, so a user'suser-agentis not sent next to the default.The webhook test route uses the same function, so test sends get the new header too. Slack does not use undici and is unaffected.
Not changed here: a user's lowercase
content-typeis still sent next to the defaultContent-Type. That predates this PR.Unit tests in
transports/__tests__/generic.test.tscover the default, an override, and a lowercase override. I did not run the integration suite locally. The existingcheckAlerts.int.test.tsheader assertion usesexpect.objectContaining, so the new header should not break it.How to reproduce
Starting point:
yarn dev(alerts and webhooks need the API).On
main:User-Agent: undici.On this branch:
User-Agent: ClickStack-Alerts/<version>.{"User-Agent": "custom"}under the webhook's headers and send again. The inspector showscustom.How to test on Vercel preview
N/A — non-UI change
References