Skip to content

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

Closed
RealDiligent wants to merge 1 commit into
JSONbored:mainfrom
RealDiligent:fix/critical-issue-discord-hosts-allowlist-9288
Closed

fix(review): accept canary/ptb Discord hosts in loop-escalation webhook validation (#9288)#9325
RealDiligent wants to merge 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 in this repo 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. There was no comment justifying a narrower scope, and 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 13:07
@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

❌ 2 Tests Failed:

Tests completed Failed Passed Skipped
3957 2 3955 11
View the top 2 failed test(s) by shortest run time
test/unit/selfhost-pg-retention.test.ts > runRetentionPrune + processJob on the Postgres backend (#977) > processJob prune-retention deletes eligible rows and records a success audit event on Postgres
Stack Traces | 0.00588s run time
AssertionError: expected 3 to be +0 // Object.is equality

- Expected
+ Received

- 0
+ 3

 ❯ test/unit/selfhost-pg-retention.test.ts:119:44
test/unit/selfhost-pg-retention.test.ts > pruneExpiredRecords on the Postgres backend (#977) > deletes across multiple bounded batches and stops at the per-table cap, same as the SQLite path
Stack Traces | 0.0131s run time
AssertionError: expected +0 to be 4 // Object.is equality

- Expected
+ Received

- 4
+ 0

 ❯ test/unit/selfhost-pg-retention.test.ts:76:33

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@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

Caution

🛑 LoopOver review result - fixes required

Review updated: 2026-07-27 13:18:52 UTC

2 files · 1 AI reviewer · no blockers · CI failing · unstable

🛑 Suggested Action - Fix Blockers

Review summary
This PR aligns loop-escalation-wire.ts's ALLOWED_DISCORD_HOSTS with the four-host set already used by the sibling validators in alerts.ts and notify-discord.ts, fixing a real bug where canary.discord.com and ptb.discord.com webhooks were silently rejected as invalid_global_webhook. The fix is minimal and correctly scoped (only the allowlist constant and an export needed for direct testability), with no changes to protocol/path validation logic. New tests directly exercise the exported isValidDiscordWebhook against all four hosts (case-insensitively) plus the existing rejection paths, and the PR closes the linked issue #9288.

Nits — 2 non-blocking
  • The two FAILED checks (validate, validate-tests) have no detail provided in CI STATUS, so the cause can't be verified from what's given here — worth confirming they aren't flagging something in this diff before merge.
  • Consider a brief comment or follow-up noting whether alerts.ts/notify-discord.ts and this validator should eventually share the single ALLOWED_DISCORD_HOSTS set instead of three independent copies, to prevent this drift from recurring.

CI checks failing

  • validate
  • validate-tests

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: 270 registered-repo PR(s), 115 merged, 37 issue(s).
Contributor context ✅ Confirmed Gittensor contributor RealDiligent; Gittensor profile; 270 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 other two files untouched, and adds direct test coverage exporting/testing isValidDiscordWebhook for canary/ptb acceptance and non-Discord/invalid rejection as required.

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: 270 PR(s), 37 issue(s).
  • PR-specific overlap: none found.
Contributor next steps
  • Start here: Triage stale or unlinked PRs.
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 <question> answers contribution-quality Q&A with source citations and freshness.
  • @loopover chat <question> 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 commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

LoopOver is closing this pull request on the maintainer's behalf (CI is failing (validate, validate-tests)). This is an automated maintenance action — to pursue this change, please open a new pull request with the issues resolved. Closed PRs may be analyzed later to improve review accuracy, but they are not automatically reopened or re-reviewed.

@loopover-orb loopover-orb Bot closed this Jul 27, 2026
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