Bug/Security: chown() failures during metadata restoration are silently ignored #169
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
file_restore_metadata()insrc/shared/metadata.c:100callschown(path, metadata->uid, metadata->gid)but explicitly casts away the return value. Ifchown()fails (e.g., insufficient privileges, invalid uid/gid), the failure is silently ignored, and the caller believes metadata was fully restored. When the server runs as an unprivileged user, it may also unintentionally apply auid/gidfrom a different machine that has no meaning locally.Location
src/shared/metadata.c:100-101—int chown_ret = chown(...); (void)chown_ret;Suggested fix
chown_retand log/return an error on failure.uid/gidfrom a remote peer is appropriate at all; at minimum, it should only be attempted when the receiver is running as root and the caller has opted in.Severity
Low
Category
bug, security
This issue was automatically generated by the issue-creator agent.