Skip to content

Add support for Denon StagelinQ #1231

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

Closed
wants to merge 2 commits into from
Closed

Add support for Denon StagelinQ #1231

wants to merge 2 commits into from

Conversation

aw-was-here
Copy link
Collaborator

@aw-was-here aw-was-here commented Jul 11, 2025

replaced by #1232

Comment on lines +89 to +90
discoversocket.bind(
("", PyStagelinQDriver.STAGELINQ_DISCOVERY_PORT)) # bind socket to all interfaces

Check warning

Code scanning / CodeQL

Binding a socket to all network interfaces Medium

'' binds a socket to all interfaces.

Copilot Autofix

AI 9 days ago

The best way to fix this issue is to bind the socket to a specific network interface or IP address that is appropriate for the application's intended functionality. For example:

  • If the application is designed to discover devices on a private network, bind the socket to the IP address of the private interface.
  • If the application is intended for local-only discovery/testing, bind it to 127.0.0.1 (the loopback interface).

To implement the fix:

  1. Replace the empty string '' in the bind method with a specific IP address.
  2. If the IP address to bind to is configurable or needs to be dynamically determined, introduce a mechanism to retrieve or configure it.

The changes should be made in the _discover_stagelinq_device method around line 89 in nowplaying/inputs/stagelinq.py.


Suggested changeset 1
nowplaying/inputs/stagelinq.py

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/nowplaying/inputs/stagelinq.py b/nowplaying/inputs/stagelinq.py
--- a/nowplaying/inputs/stagelinq.py
+++ b/nowplaying/inputs/stagelinq.py
@@ -86,8 +86,10 @@
 
         # Create socket
         discoversocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+        # Bind the socket to a specific interface or IP address for security
+        bind_ip = "127.0.0.1"  # Replace with the appropriate IP address for your environment
         discoversocket.bind(
-            ("", PyStagelinQDriver.STAGELINQ_DISCOVERY_PORT))  # bind socket to all interfaces
+            (bind_ip, PyStagelinQDriver.STAGELINQ_DISCOVERY_PORT))
         discoversocket.setblocking(False)
 
         loop_timeout = time.time() + timeout
EOF
@@ -86,8 +86,10 @@

# Create socket
discoversocket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
# Bind the socket to a specific interface or IP address for security
bind_ip = "127.0.0.1" # Replace with the appropriate IP address for your environment
discoversocket.bind(
("", PyStagelinQDriver.STAGELINQ_DISCOVERY_PORT)) # bind socket to all interfaces
(bind_ip, PyStagelinQDriver.STAGELINQ_DISCOVERY_PORT))
discoversocket.setblocking(False)

loop_timeout = time.time() + timeout
Copilot is powered by AI and may make mistakes. Always verify output.
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.

1 participant