Skip to main content

SKY-D358 · Security in code

Gradio app open on every network interface without a login

High

Gradio is a Python library for putting a web page in front of a model or function; launch() starts its web server. SKY-D358 reports a launch() that binds to every network interface (server_name of "0.0.0.0" or "::") without setting auth or auth_dependency.

Languages
Python
Quality gate
counted toward the gate limits (full and diff scans)
Finding type
review
Catalog name
Public Gradio launch without configured auth
Wrong result? Report itA false positive, a missed case or a confusing message: it goes privately to the founder.

Why it matters

Anyone who can reach the machine's address can use the app: run the model on your bill, read whatever the tool can read, and call the app's HTTP API directly. Demo apps often wrap internal data or paid model calls and are then left running on a cloud server.

What Skylos flags

app/support_ui.py · PythonReported on line 13
import gradio as gr from support.agent import answer_ticket  def respond(message, history):    return answer_ticket(message, history)  demo = gr.ChatInterface(respond, title="Support assistant") if __name__ == "__main__":    demo.launch(server_name="0.0.0.0", server_port=7860)

What Skylos leaves alone

app/support_ui.py · Python
import gradio as gr from support.agent import answer_ticket  def respond(message, history):    return answer_ticket(message, history)  demo = gr.ChatInterface(respond, title="Support assistant") if __name__ == "__main__":    demo.launch(server_name="127.0.0.1", server_port=7860)

Why Skylos leaves it alone

127.0.0.1 is the loopback address: only programs on the same machine, such as a reverse proxy that does the login, can connect. Only the all-interfaces addresses are reported.

How Skylos decides

  1. Runs with --danger on Python files. Finds .launch() calls on an object made by gradio.Blocks(), gradio.Interface() or gradio.ChatInterface(): called directly, through a variable, or bound by with gr.Blocks() as demo:.
  2. Reads the keyword arguments, including those spread from a dictionary with **options when every key of that dictionary is a fixed string. When a variable can hold several values (a list in a loop, or different if branches), each visible combination is checked.
  3. Reports HIGH when server_name can be the literal "0.0.0.0", "::" or "[::]", no keyword set is unknown, and auth and auth_dependency are both missing or set to None. Any other value of auth counts as configured.

How to fix it

Require a login with auth, taking the user name and password from the environment or a secret store, or pass an auth_dependency that checks your own single sign-on. If only one machine needs the app, bind to 127.0.0.1 instead.

app/support_ui.py · Python · the fix, against the flagged file
Added: import osAdded:  import gradio as gr from support.agent import answer_ticket  def respond(message, history):    return answer_ticket(message, history)  demo = gr.ChatInterface(respond, title="Support assistant") if __name__ == "__main__":Removed:     demo.launch(server_name="0.0.0.0", server_port=7860)Added:     demo.launch(Added:         server_name="0.0.0.0",Added:         server_port=7860,Added:         auth=(os.environ["SUPPORT_UI_USER"], os.environ["SUPPORT_UI_PASSWORD"]),Added:     )

When it can be wrong

  • An app in a container must bind to 0.0.0.0 for port mapping to work. When the container is only reachable through a proxy that does the login, the finding is a false alarm.
  • Any auth value other than None counts as configured, even a function that accepts every password.
  • Missed: share=True (which publishes the app on a public gradio.live link), a host read at run time such as os.environ.get("HOST", "0.0.0.0"), the GRADIO_SERVER_NAME environment variable, chained calls such as demo.queue().launch(server_name="0.0.0.0"), and options passed as **kwargs whose keys Skylos cannot see.

Seeing a case that isn't listed here? Report the wrong result so the rule can be fixed. Don't paste company code: describe the shape of it.

How to silence it

  • Mark the launch( line when a proxy in front of the app requires a login, and say which.

    Python
    demo.launch(server_name="0.0.0.0")  # skylos: ignore[SKY-D358] behind SSO proxy
  • skylos baseline ., then --baseline, accepts existing launches by file and line.

  • [tool.skylos] ignore = ["SKY-D358"] turns the rule off for the whole project.

From the Skylos rule handbook, Skylos 5.8.0 (commit 5b880b0). All rules.