Skip to content

fix(frontend): validate HTTPS protocol and URL format in WebhookModal - #1681

Closed
aazminu wants to merge 1 commit into
LabsCrypt:mainfrom
aazminu:fix/issue-1634-webhook-modal-https-validation
Closed

aazminu wants to merge 1 commit into
LabsCrypt:mainfrom
aazminu:fix/issue-1634-webhook-modal-https-validation

Conversation

@aazminu

@aazminu aazminu commented Oct 19, 2026 •

Copy link
Copy Markdown

Description

Enforces explicit client-side URL parsing and HTTPS protocol validation in WebhookModal (frontend/src/components/webhooks/WebhookModal.tsx) so invalid or insecure non-loopback http:// URLs are caught immediately in the form before submitting to the backend.

Type of Change

  • 🐛 Bug fix (non-breaking change which fixes an issue)
  • ✨ New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • 📚 Documentation update
  • 🔧 Refactoring (no functional changes)
  • ⚡ Performance improvement
  • 🧪 Test addition or update

Related Issues

Closes #1634
Fixes #1634
/claim #1634

Changes Made

  • Added and exported validateWebhookUrl(rawUrl) in frontend/src/components/webhooks/WebhookModal.tsx using new URL() to validate that the input is a well-formed URL with a non-empty hostname and no embedded whitespace.
  • Enforced https: protocol for remote webhook endpoints while permitting loopback http://localhost, http://127.0.0.1, and http://[::1] for local development testing.
  • Rendered an accessible inline error message (id="webhook-url-error", role="alert", wired via aria-invalid and aria-describedby on #webhook-url) below the URL input when an invalid or non-loopback http:// URL is entered.
  • Kept the Save webhook button disabled whenever validUrl is false and trimmed targetUrl on submission.
  • Added comprehensive unit and component tests in frontend/src/components/webhooks/WebhookModal.test.tsx.

Testing

Test Coverage

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed

Test Steps

  1. Run npx vitest run src/components/webhooks/WebhookModal.test.tsx src/components/webhooks/WebhookTable.test.tsx in frontend/ (18/18 tests pass).
  2. Run npx tsc --noEmit in frontend/ (0 errors).
  3. Run npx eslint src/components/webhooks/WebhookModal.tsx src/components/webhooks/WebhookModal.test.tsx in frontend/ (0 errors).

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have checked for breaking changes and documented them if applicable

Additional Notes

Payout Details

  • USDT/USDC Receiving Wallet (EVM / ERC-20 / Polygon / Arbitrum / Optimism / Base / BSC): 0x9a51790aC01c54184bcFa067bC38f7F0E7C6F6B6

Validate webhook target URLs with the URL constructor so only valid
https:// endpoints (and loopback http://localhost, http://127.0.0.1,
http://[::1] for local testing) are accepted. Display an inline error
alert when a plain http:// or malformed URL is entered and keep the Save
button disabled.

Fixes LabsCrypt#1634
@K1NGD4VID K1NGD4VID closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Frontend] Validate HTTPS protocol requirement in WebhookModal URL input field

2 participants