Skip to content

File owner fix#2

Merged
et-nik merged 1 commit into
masterfrom
hotfix-files-owner
May 14, 2026
Merged

File owner fix#2
et-nik merged 1 commit into
masterfrom
hotfix-files-owner

Conversation

@et-nik

@et-nik et-nik commented May 14, 2026

Copy link
Copy Markdown
Member

No description provided.

@et-nik et-nik changed the title Аile owner fix File owner fix May 14, 2026
@coveralls

Copy link
Copy Markdown

Coverage Report for CI Build 25878532318

Coverage increased (+0.4%) to 36.413%

Details

  • Coverage increased (+0.4%) from the base build.
  • Patch coverage: 102 uncovered changes across 5 files (65 of 167 lines covered, 38.92%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
internal/app/grpc/transfer_handler.go 32 0 0.0%
internal/app/grpc/file_handler.go 51 26 50.98%
internal/app/osowner/owner.go 59 34 57.63%
internal/app/osowner/owner_unix.go 23 4 17.39%
internal/app/game_server_commands/install_server.go 2 1 50.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 12663
Covered Lines: 4611
Line Coverage: 36.41%
Coverage Strength: 27026.19 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors file-ownership/chown logic out of install_server.go into a new internal/app/osowner package and threads owner options (User / UID / GID coming from the proto) through the gRPC file write, transfer, and mkdir handlers so files/directories created by the daemon on behalf of API requests can be assigned to the correct unprivileged user. Also bumps the gameap proto module and a few transitive golang.org/x/* deps.

Changes:

  • New osowner package with Options, Resolve, ApplyToPath, ApplyRecursive, MissingSegments, plus unix/windows split for isRootUser, lchown, chownTree.
  • grpc/file_handler.go (HandleFileWrite, handleMkdirOp) and grpc/transfer_handler.go (HandleFileUploadTask) now compute newly-created path segments, apply owner to them, and honor a per-request Mode.
  • install_server.go chown rewritten to delegate to osowner.ApplyRecursive; duplicated chownR/build-tagged helpers removed from game_server_commands/os_utils_*.go. Bumps gameap proto and go-jose, crypto, net, sys, text, genproto/rpc deps in go.mod/go.sum.

Reviewed changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/app/osowner/owner.go New package: Options/Resolve/ApplyToPath/ApplyRecursive/MissingSegments.
internal/app/osowner/owner_unix.go Linux/Darwin implementations of isRootUser, lchown, chownTree (uses os.OpenRoot).
internal/app/osowner/owner_windows.go Windows no-op lchown/chownTree; isRootUser checks System/Administrator.
internal/app/osowner/owner_test.go Unit tests for IsZero, Resolve short-circuit, Apply* no-ops, and MissingSegments.
internal/app/grpc/file_handler.go HandleFileWrite and handleMkdirOp thread osowner.Options and chown only newly-created path segments.
internal/app/grpc/transfer_handler.go Upload task chowns new parent dirs + temp file before atomic rename; honors task.Mode.
internal/app/grpc/file_owner_test.go New tests for owner-propagation paths in file write and mkdir handlers.
internal/app/game_server_commands/install_server.go chown now delegates to osowner.ApplyRecursive (also implicitly fixes the prior Atoi(systemUser.Uid) bug used for the gid).
internal/app/game_server_commands/os_utils_unix.go Removes now-duplicated chownR and io/fs import.
internal/app/game_server_commands/os_utils_windows.go Removes the now-duplicated chownR no-op.
go.mod / go.sum Bumps gameap proto to the version that adds OwnerUser/OwnerUid/OwnerGid/Mode; transitive bumps.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@et-nik et-nik merged commit ad257ac into master May 14, 2026
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants