Skip to content

Add channel proxy plug with endpoint routing#4418

Merged
stuartc merged 3 commits intochannelsfrom
4401-channel-proxy-plug
Feb 11, 2026
Merged

Add channel proxy plug with endpoint routing#4418
stuartc merged 3 commits intochannelsfrom
4401-channel-proxy-plug

Conversation

@stuartc
Copy link
Member

@stuartc stuartc commented Feb 11, 2026

Description

This PR adds the channel proxy plug that routes incoming HTTP requests to channel sink URLs via the Weir streaming proxy.

  • Adds ChannelProxyPlug mounted at /channels/:channel_id in the endpoint
  • Validates sink_url on channel changeset (must be absolute HTTP/HTTPS URL)
  • Uses Weir for streaming HTTP proxy with configurable adapter
  • Adds weir dependency (GitHub source, with WEIR_PATH local override)
  • Path traversal protection and comprehensive test coverage

Closes #4401

Validation steps

  1. Run mix test test/lightning_web/plugs/channel_proxy_plug_test.exs
  2. Run mix test test/lightning/channels_test.exs

Additional notes for the reviewer

  1. Weir is sourced from GitHub (not yet on Hex). Set WEIR_PATH env var for local development.

AI Usage

  • I have used Claude Code
  • I have used another model
  • I have not used AI

Pre-submission checklist

  • I have performed an AI review of my code
  • I have implemented and tested all related authorization policies.
  • I have updated the changelog.
  • I have ticked a box in "AI usage" in this PR

@github-project-automation github-project-automation bot moved this to New Issues in v2 Feb 11, 2026
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.31%. Comparing base (fd6c24e) to head (f42efd9).
⚠️ Report is 1 commits behind head on channels.

Additional details and impacted files
@@            Coverage Diff            @@
##           channels    #4418   +/-   ##
=========================================
  Coverage     89.31%   89.31%           
=========================================
  Files           430      431    +1     
  Lines         20103    20121   +18     
=========================================
+ Hits          17955    17972   +17     
- Misses         2148     2149    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Base automatically changed from 4399-channels-pipeline to channels February 11, 2026 12:18
Wire Weir as a path dependency and create ChannelProxyPlug that
intercepts /channels/:id/*path requests before Plug.Parsers,
looks up the channel, sets proxy headers, and forwards to the
sink via Weir.proxy/2 with streaming.
#4401)

- Validate sink_url with Validators.validate_url/2 in Channel changeset
  to reject non-http(s) URLs at creation time rather than at proxy time
- Remove manual x-request-id handling from ChannelProxyPlug since Weir
  now injects it into upstream requests automatically
- Add path traversal tests documenting that ".." as channel_id fails
  UUID validation (404) and ".." in subpaths is forwarded as-is
@stuartc stuartc force-pushed the 4401-channel-proxy-plug branch from 8269b4e to f42efd9 Compare February 11, 2026 12:26
@stuartc stuartc marked this pull request as ready for review February 11, 2026 13:14
@stuartc stuartc merged commit b59edcb into channels Feb 11, 2026
7 checks passed
@stuartc stuartc deleted the 4401-channel-proxy-plug branch February 11, 2026 13:14
@github-project-automation github-project-automation bot moved this from New Issues to Done in v2 Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant

Comments