fix(selfhost): validate Discord webhook destinations#1558
Merged
JSONbored merged 1 commit intoJun 27, 2026
Conversation
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1558 +/- ##
=======================================
Coverage 95.38% 95.38%
=======================================
Files 201 201
Lines 21598 21605 +7
Branches 7807 7808 +1
=======================================
+ Hits 20601 20608 +7
Misses 416 416
Partials 581 581
🚀 New features to boost your workflow:
|
|
Tip 🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩🟩 ✅ Gittensory review — safe to merge
✅ Approved — safe to merge
Nits — 2 non-blocking
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
This was referenced Jun 27, 2026
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.
Motivation
Description
isValidDiscordWebhookwith the same allowlist (discord.com,discordapp.com,canary.discord.com,ptb.discord.com) and path/scheme checks and use it insrc/selfhost/discord-notify.tsto accept onlyhttps://.../api/webhooks/...URLs.resolveDiscordWebhookto return a repo-specific webhook only when it passes the new validation and to fall back to a validated global webhook otherwise, returningnullwhen no valid Discord webhook is configured.test/unit/selfhost-discord-notify.test.tsthat cover valid Discord webhooks, repo/global fallbacks, rejection of localhost/non-Discord URLs, malformed URLs, non-Discord HTTPS hosts, and the no-op behavior when an invalid webhook is configured.Testing
npx vitest run test/unit/selfhost-discord-notify.test.ts, which passed (14 tests).npm run typecheck, which failed locally due to missing@sentry/nodetypes in the environment.npm run test:coverage -- --run test/unit/selfhost-discord-notify.test.ts, which ran the tests but coverage generation failed with a remapping error (TypeError: jsTokens is not a function).npm audit --audit-level=moderateandnpm cifailed locally due to npm registry403 Forbiddenresponses, preventing a full local CI run in this environment.Codex Task