fix: correct file ownership on mounted volumes (#11231)

This commit is contained in:
Yakshith 2025-10-04 21:09:33 -04:00 committed by GitHub
parent 3bf038ed7c
commit e9c3335656
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -12,7 +12,7 @@ def init_user_and_working_directory(
It performs the following steps effectively:
* Creates the Working Directory:
- Uses mkdir -p to create the directory.
- Sets ownership to username:root.
- Sets ownership to username:group (respects SANDBOX_GROUP_ID if set).
- Adjusts permissions to be readable and writable by group and others.
* User Verification and Creation:
- Checks if the user exists using id -u.
@ -113,7 +113,9 @@ def init_user_and_working_directory(
output = subprocess.run(command, shell=True, capture_output=True)
out_str = output.stdout.decode()
command = f'chown -R {username}:root {initial_cwd}'
# Get group ID from environment variable, default to 'root' for backward compatibility
group_id = os.getenv('SANDBOX_GROUP_ID', 'root')
command = f'chown -R {username}:{group_id} {initial_cwd}'
output = subprocess.run(command, shell=True, capture_output=True)
out_str += output.stdout.decode()