Skip to content

How to restrict permissions for Unix socket? #2731

@Densaugeo

Description

@Densaugeo

Initial Checks

  • I confirm this was discussed, and the maintainers suggest I open an issue.
  • I'm aware that if I created this issue without a discussion, it may be closed without a response.

Discussion Link

I asked about this on the Discord, but didn't receive a reply after several days. Sorry if this isn't the right place.

Description

When the --uds option is used Uvicorn creates a socket with 766 permissions, accessible to any user on the server, and this does not appear to be configurable. What is the recommended way to restrict a socket to 760 or similar?

I could separately chmod the socket after it is created, but this leads to tricky questions about error detection and handling if the chmod doesn't happen for some reason.

Example Code

Python, Uvicorn & OS Version

Fedora 41
Python 3.12.11
Uvicorn 0.37.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions