usc allowed for docker

This commit is contained in:
Maxim Devaev 2025-05-04 06:05:30 +03:00
parent 0437f487b5
commit 79d4d99f37

View File

@ -288,7 +288,7 @@ class RequestUnixCredentials:
gid: int gid: int
def __post_init__(self) -> None: def __post_init__(self) -> None:
assert self.pid > 0 assert self.pid >= 0
assert self.uid >= 0 assert self.uid >= 0
assert self.gid >= 0 assert self.gid >= 0
@ -304,7 +304,8 @@ def get_request_unix_credentials(req: BaseRequest) -> (RequestUnixCredentials |
except Exception: except Exception:
return None return None
(pid, uid, gid) = struct.unpack("iii", data) (pid, uid, gid) = struct.unpack("iii", data)
if pid <= 0 or uid < 0 or gid < 0: if pid < 0 or uid < 0 or gid < 0:
# PID == 0 inside a docker container
return None return None
return RequestUnixCredentials(pid=pid, uid=uid, gid=gid) return RequestUnixCredentials(pid=pid, uid=uid, gid=gid)