Skip to content

fix: Write device.yml with owner-only permissions - #825

Merged
andypalmi merged 1 commit into
mainfrom
device-file-owner-only
Nov 16, 2026
Merged

andypalmi merged 1 commit into
mainfrom
device-file-owner-only

Conversation

@andypalmi

Copy link
Copy Markdown
Contributor

Description

The agent rewrites device.yml with mode 0600.

  1. A new file is opened with mode 0600. This is the usual path, because the old file is first renamed to a backup.
  2. If the file is truncated in place instead (for example when the rename fails on a bind mount), the agent also calls fchmod on it. If that fails, for example with EPERM on a file owned by another user, the error is logged and the write goes ahead.

Tests cover both paths. They are skipped on Windows.

The agent now creates device.yml with mode 0600 and sets that mode when the file is rewritten in place. Failing to change the mode of a file owned by another user is logged and ignored.
@hardillb hardillb changed the title Write device.yml with owner-only permissions fix: Write device.yml with owner-only permissions Nov 13, 2026
@andypalmi andypalmi assigned andypalmi and unassigned hardillb Nov 13, 2026
@andypalmi
andypalmi requested a review from hardillb November 13, 2026 14:50
@hardillb
hardillb requested a review from Steve-Mcl November 13, 2026 15:15
@hardillb

Copy link
Copy Markdown
Contributor

Tagging Steve as well to test on Windows as I can't get to my windows box from here

@andypalmi

Copy link
Copy Markdown
Contributor Author

I will wait for @Steve-Mcl 's approval too

@Steve-Mcl Steve-Mcl left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

tested on windows - no issues with changes

@andypalmi
andypalmi merged commit bbc6c8b into main Nov 16, 2026
6 of 7 checks passed
@andypalmi
andypalmi deleted the device-file-owner-only branch November 16, 2026 10:57
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