globus / globus-compute

Globus Compute: High Performance Function Serving for Science
https://www.globus.org/compute
Apache License 2.0
148 stars 47 forks source link

Update initgroups thinking #1690

Closed khk-globus closed 1 month ago

khk-globus commented 1 month ago

The original thrust of the MEP work was that it was strictly for administrators. After we realized that normal users would want templating as well, we updated the logic to be flexible by allowing initgroups to fail but still proceed to start the UEP. But then we also included a check to only attempt to change the UID if it needed changing ... in practice, then, this should never fail because if os.getuid() != new_uid then the os.getuid() has the necessary privileges.

However, initgroups() is not a fungible action when changing the process persona, so take out the ambiguity by just letting it fail if [something happens].

In the same vein, implement a "paranoia" check that ensures that we can't get back the privileges. If the kernel doesn't have our back, then we bail out right away.

[sc-36722]

Type of change