-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature: Dynamic port forwarding allow+deny list #38
Comments
Hi @bcpeinhardt, I'm interested in working on this. Do you think that creating a file with a list of ports to avoid automatically forwarding would be a good way to pass this info to the backend, or do you have any better ideas for this? If we go with a file, do you have any preferences on the file format (JSON, etc...)? Also, any preferences on file path (maybe under |
Better idea: Add a setting with a path to a |
devcontainer.json has a system for specifying default behavior for forwarding ports, and also behavior for specific ports and ranges of ports. Its schema is essentially identical to the settings VS Code uses to control port forwarding, so supporting this format for port settings keeps things consistent between VS Code and JetBrains. See https://containers.dev/implementors/json_reference/ for the spec. As an example, this will turn off automatic port forwarding except for ports 7123 and 8100-8150: { "otherPortsAttributes": { "onAutoForward": "ignore" }, "portsAttributes": { "7123": { "onAutoForward": "notify" }, "8100-8150": { "onAutoForward": "notify" } } } Fixes: coder#38
devcontainer.json has a system for specifying default behavior for forwarding ports, and also behavior for specific ports and ranges of ports. Its schema is essentially identical to the settings VS Code uses to control port forwarding, so supporting this format for port settings keeps things consistent between VS Code and JetBrains. See https://containers.dev/implementors/json_reference/ for the spec. As an example, this will turn off automatic port forwarding except for ports 7123 and 8100-8150: { "otherPortsAttributes": { "onAutoForward": "ignore" }, "portsAttributes": { "7123": { "onAutoForward": "notify" }, "8100-8150": { "onAutoForward": "notify" } } } Fixes: coder#38
Gave this a shot here: #49 |
The
/proc
-based automatic port forwarding is working well for us, but there are cases where the open-ended and unfiltered nature of the forwarding causes user confusion.For example: we use the sidecar pattern to break language-agnostic platform functionality out of each language framework that we provide. These sidecars often listen on a port over TCP/UDP and are thus auto-forwarded. There are cases where this can cause confusing behavior on the user's laptop, or unexpected reuse of the sidecar outside of the dev environment that it's contained in.
Unexpected forwarding could be solved via allow+deny list settings in the Coder IDE plugins. Here are some starting point requirements to kickstart the discussion:
[8080, 9000-9100]
With these requirements satisfied, we'd envision exposing the allow+deny lists to our users via the repo's
devcontainer.json
file alongside all of our other dev environment settings. A daemon of our creation would watch the devcontainer.json for changes and create/over-write a file that the Coder IDE plugin would update its settings from. I don't think we are too caught up on these specifics so long as we can signal the IDE to reload its settings from values that we provide.While I raise this possibility as being useful for port forwarding allow+deny lists, this construct may be useful for other Coder IDE plugin settings in the future.
The text was updated successfully, but these errors were encountered: