The cgroup names a scope; only logind's record of it says whose session it is. The engine now takes a session only when /run/systemd/sessions/<id> says it is this account's (UID), of class user (not a greeter's or the user manager's), and of this very scope. And it reads the session the moment the connection is accepted, with the namespaces, before the line, so the peer is judged as it was when it connected. Tests: session-9.scope with a user record is taken; x.scope, a different uid, another account's session, a greeter's, a record naming another scope, no record, and a path with dots are not; the session is read before the line is forwarded.