There's a new(ish) browser feature, where cookies that begin with __Host-, are required to have the secure attribute, no domain attribute, and default path attribute. This prevents an attacker who (for example) gains an xss attack from setting a cookie with these attributes, that would shadow the normal cookie in some circumstances but not others. See T113790#1676633 for specific scenarios in the Wikimedia context.
I propose we should adopt this (for MW session cookies. Probably not applicable to CentralAuth cookies). I think it would meaningfully improve our security, with very little drawbacks. Browsers that do not support this feature, would treat it as just a normal cookie, which is the status quo.
Only gotchas I see - Only works over https, so we should only do this if $wgServer is https, and we'd need to make sure varnish recognizes the new cookies. Need to investigate to what extent this is applicable to centralauth, and if not applicable, how does not extending to CA affect the security benefits of this technology.
More information: