Skip to content

Commit 0a8b77c

Browse files
committed
fix(activation): stamp staged-file owner to the token user
activation_windows_security_init built the creation security descriptor with a protected current-user DACL but never set an owner, so a file created with these attributes inherited the token's default owner. Under an Administrators-default-owner policy -- standard on Windows Server and on GitHub's elevated Windows runners -- that default is BUILTIN\Administrators, not the calling user. Every staged file is then validated with the strict activation_windows_owner_is_current check, which rejected the Administrators-owned file and made private staging fail with "launcher/payload source pair did not remain runnable after private staging" (smoke Phase 8). Stamp the owner explicitly to the token user in the creation descriptor, the same fix the daemon side already applies. This keeps the strict owner check intact -- the staged file genuinely becomes current-user-owned -- so it is not a validation relaxation; setting the owner to our own token user needs no extra privilege. Complements the launcher's trusted-owner acceptance, which covers the installed binary that a non-admin user cannot re-stamp. Signed-off-by: Martin Vogel <martin.vogel.tech@gmail.com>
1 parent 9ef0f31 commit 0a8b77c

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎src/cli/activation_transaction.c‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,17 @@ static bool activation_windows_security_init(activation_windows_security_t *secu
284284
SetEntriesInAclW(1, &access, NULL, &security->acl) == ERROR_SUCCESS &&
285285
InitializeSecurityDescriptor(&security->descriptor, SECURITY_DESCRIPTOR_REVISION) &&
286286
SetSecurityDescriptorDacl(&security->descriptor, TRUE, security->acl, FALSE) &&
287+
/* Stamp the owner explicitly to the token user. Without this the file
288+
* created with these attributes inherits the token's DEFAULT owner,
289+
* which under an Administrators-default-owner policy (standard on
290+
* Windows Server and GitHub's elevated runners) is BUILTIN\
291+
* Administrators, not this user. Every staged file is then validated
292+
* with a strict owner-is-current-user check (activation_windows_owner_
293+
* is_current), so an unstamped file is rejected and private staging
294+
* fails. The daemon stamps the owner identically for the same reason
295+
* (see src/daemon/ipc.c). Setting the owner to our own token user
296+
* needs no extra privilege. */
297+
SetSecurityDescriptorOwner(&security->descriptor, security->user_sid, FALSE) &&
287298
SetSecurityDescriptorControl(&security->descriptor, SE_DACL_PROTECTED, SE_DACL_PROTECTED);
288299
if (!ok) {
289300
if (security->acl) {

0 commit comments

Comments
 (0)