Skip to content

Preserve SELinux labels for atomic file writes#225

Open
bcho with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-node-bootstrap-selinux-issue
Open

Preserve SELinux labels for atomic file writes#225
bcho with Copilot wants to merge 5 commits into
mainfrom
copilot/fix-node-bootstrap-selinux-issue

Conversation

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Node bootstrap can fail on SELinux-enforcing hosts when atomic writes create temp files under /tmp, causing the final renamed file to retain an incompatible SELinux label.

  • Atomic writes
    • Create renameio temp files in the destination directory instead of the default temp dir.
    • Applies to both buffered writes and streamed installs in pkg/utils/utilio.
renameio.WriteFile(
    filename,
    content,
    perm,
    renameio.WithTempDir(filepath.Dir(filename)),
)

@bcho bcho left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@copilot remove test change, this fix can skip test

Copilot AI changed the title [WIP] Fix node bootstrap failure on SELinux enforced host Preserve SELinux labels for atomic file writes Jul 7, 2026
Copilot AI requested a review from bcho July 7, 2026 06:15
Copilot finished work on behalf of bcho July 7, 2026 06:15

Copilot AI commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

@copilot remove test change, this fix can skip test

Removed the utilio test changes in 3a57e56; the SELinux fix remains in production code only.

Copilot finished work on behalf of bcho July 7, 2026 06:21
@bcho bcho marked this pull request as ready for review July 7, 2026 06:24
Copilot AI review requested due to automatic review settings July 7, 2026 06:24
Copilot AI deployed to e2e-testing July 7, 2026 06:24 Active

Copilot AI 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.

Pull request overview

This PR updates pkg/utils/utilio atomic-write helpers to create renameio temporary files in the destination directory (rather than the system temp directory), preventing SELinux label mismatches on SELinux-enforcing hosts during bootstrap file installation.

Changes:

  • Update InstallFileWithLimitedSize to create renameio pending temp files in filepath.Dir(filename).
  • Update WriteFile to pass renameio.WithTempDir(filepath.Dir(filename)) to renameio.WriteFile.
  • Document the SELinux-label rationale in function comments.

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

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.

agent: node bootstrap could fail on selinux enforced host

3 participants