Skip to content

fix(review): accept canary/ptb Discord hosts in loop-escalation webhook validation (#9288) - #9390

Merged
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-discord-hosts-allowlist-9288
Jul 27, 2026
Merged

fix(review): accept canary/ptb Discord hosts in loop-escalation webhook validation (#9288)#9390
loopover-orb[bot] merged 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-discord-hosts-allowlist-9288

Conversation

@RealDiligent

Copy link
Copy Markdown
Contributor

Problem

Closes #9288.

src/review/loop-escalation-wire.ts's ALLOWED_DISCORD_HOSTS listed only discord.com and discordapp.com, while the two sibling Discord-webhook validators accept the wider, correct set:

  • src/review/alerts.tsdiscord.com, discordapp.com, canary.discord.com, ptb.discord.com
  • src/services/notify-discord.ts — the identical four-host set

So isValidDiscordWebhook silently rejected a valid canary.discord.com or ptb.discord.com DISCORD_WEBHOOK_URL — the notification was dropped as invalid_global_webhook with no indication to the operator. The host allowlist had zero test coverage.

Fix

Align ALLOWED_DISCORD_HOSTS with the four-host set the siblings already use (with a comment noting the byte-faithful parity). No other change to isValidDiscordWebhook's protocol/path validation; alerts.ts and notify-discord.ts are untouched. The validator is exported so the allowlist can be tested directly.

Test

test/unit/loop-escalation-wire.test.ts adds direct coverage: all four hosts (including canary/ptb, case-insensitively) are accepted, while non-Discord hosts, non-https, wrong paths, and malformed URLs are still rejected. Reverting the constant drops the canary/ptb assertions.

@RealDiligent
RealDiligent requested a review from JSONbored as a code owner July 27, 2026 15:40
@superagent-security

Copy link
Copy Markdown
Contributor

Superagent didn't find any vulnerabilities or security issues in this PR.

…ok validation

loop-escalation-wire's ALLOWED_DISCORD_HOSTS listed only discord.com and
discordapp.com, while its two sibling validators (alerts.ts,
notify-discord.ts) accept the wider, correct four-host set. A valid
canary.discord.com or ptb.discord.com DISCORD_WEBHOOK_URL was silently
dropped as invalid_global_webhook. Align the constant with the siblings;
the host allowlist previously had zero test coverage, now covered directly.
@codecov

codecov Bot commented Jul 27, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.42%. Comparing base (29591ca) to head (663ccb4).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #9390       +/-   ##
===========================================
- Coverage   89.46%   75.42%   -14.05%     
===========================================
  Files         836      276      -560     
  Lines      109597    58114    -51483     
  Branches    26100     6208    -19892     
===========================================
- Hits        98055    43830    -54225     
- Misses      10279    14014     +3735     
+ Partials     1263      270      -993     
Flag Coverage Δ
backend 100.00% <100.00%> (+4.77%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/review/loop-escalation-wire.ts 100.00% <100.00%> (ø)

... and 698 files with indirect coverage changes

@loopover-orb loopover-orb Bot added the gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier. label Jul 27, 2026
@loopover-orb

loopover-orb Bot commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Tip

✅ LoopOver review result - approve/merge recommended

Review updated: 2026-07-27 15:59:22 UTC

2 files · 1 AI reviewer · no blockers · readiness 98/100 · CI green · clean

✅ Suggested Action - Approve/Merge

  • safe to merge

Review summary
Small, correct fix: aligns loop-escalation-wire.ts's ALLOWED_DISCORD_HOSTS with the four-host set already used by alerts.ts and notify-discord.ts, so canary.discord.com and ptb.discord.com webhooks are no longer silently rejected. isValidDiscordWebhook is exported and directly unit-tested for all four hosts (case-insensitively), plus negative cases for non-Discord hosts, http, wrong paths, and malformed URLs. Diff is minimal, targeted, closes the linked issue #9288, and doesn't touch the untouched sibling validators or the rest of isValidDiscordWebhook's logic.

Nits — 2 non-blocking
  • The inline comment on the ALLOWED_DISCORD_HOSTS line (src/review/loop-escalation-wire.ts) is a bit verbose for a one-line constant change, though it usefully documents the parity intent.
  • Consider extracting the four-host allowlist into a shared constant used by all three validators (alerts.ts, notify-discord.ts, loop-escalation-wire.ts) to prevent this kind of drift from recurring.

Decision drivers

  • ✅ Code review — No blockers (1 reviewer)
  • ✅ Gate result — Passing (No configured blocker found.)
Context & advisory signals — never blocks the verdict
Signal Result Evidence
Linked issue ✅ Linked #9288
Related work ✅ No active overlap found No same-issue or scoped active PR overlap found.
Change scope ✅ 20/20 Low review scope from cached public metadata (1 linked issue).
Validation posture ✅ 25/25 PR body includes validation/test evidence.
Contributor workload ✅ 10/10 Author activity: 271 registered-repo PR(s), 113 merged, 37 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 271 PR(s), 37 issue(s).
Improvement ✅ Minor risk: clean · value: minor · LLM: minor
Linked issue satisfaction

Addressed
The PR updates ALLOWED_DISCORD_HOSTS to the exact four-host set matching alerts.ts and notify-discord.ts, leaves the rest of isValidDiscordWebhook's logic and the sibling files untouched, and adds tests covering acceptance of all four hosts (including canary/ptb case-insensitively) plus regression checks for non-Discord hosts, non-https, and wrong-path URLs.

Review context
  • Author: RealDiligent
  • Role context: outside_contributor
  • Public audience mode: oss maintainer
  • Lane context: Repository is configured for direct PR review.
  • Public profile languages: Python, Ruby, TypeScript, Svelte, Cuda, JavaScript, Markdown, MDX
  • Official Gittensor activity: 271 PR(s), 37 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Keep the PR focused and include validation evidence before maintainer review.
Signal definitions
  • Related work = same linked issue, overlapping active PRs, or title/path similarity.
  • Change scope = cached public metadata such as size labels, draft state, and review-burden hints.
  • Validation posture = whether the PR provides enough public validation/test evidence for maintainer review.
  • Contributor workload = public contributor activity and cleanup pressure, not a repo-wide quality failure.
  • Contributor context = public GitHub/Gittensor identity context; non-Gittensor status is not a blocker.
🧪 Chat with LoopOver

Ask LoopOver a question about this PR directly in a comment — grounded only in the same cached, public-safe facts shown above, never a new claim.

  • @loopover ask &lt;question&gt; answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat &lt;question&gt; answers in natural prose from cached decision-pack facts via local inference (maintainer/collaborator; read-only).
  • A plain-language @loopover mention with a real question is routed to the closest matching read-only command automatically — no exact syntax required.

Full command reference: https://loopover.ai/docs/loopover-commands

🧪 Experimental — new and may change.

🟩 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 LoopOver, a quiet PR intelligence layer for OSS maintainers.

  • Re-run LoopOver review

@loopover-orb loopover-orb Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LoopOver approves — the gate is satisfied and CI is green.

@loopover-orb
loopover-orb Bot merged commit 14f73e8 into JSONbored:main Jul 27, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gittensor:bug Gittensor-scored bug fix — scores a 0.05x multiplier.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

review: loop-escalation-wire's ALLOWED_DISCORD_HOSTS missing canary/ptb hosts its two siblings accept

1 participant