Skip to content

TPT-4221: Enhance security of kubeconfig file permission - #919

Open
yec-akamai wants to merge 2 commits into
devfrom
TPT-4221/fix-k8s-permission
Open

TPT-4221: Enhance security of kubeconfig file permission#919
yec-akamai wants to merge 2 commits into
devfrom
TPT-4221/fix-k8s-permission

Conversation

@yec-akamai

Copy link
Copy Markdown
Contributor

📝 Description

Ensure that kubeconfig files are now created via 600 instead of 644. Permissions are set atomically at creation, so contents are never briefly world-readable. Pre-existing files with group/other bits set are tightened to 600 on write. The parent directory is created with mode 700.

✔️ How to Test

make test-unit

@yec-akamai
yec-akamai requested review from a team as code owners August 7, 2026 14:53
@yec-akamai yec-akamai added the improvement for improvements in existing functionality in the changelog. label Aug 7, 2026
@yec-akamai
yec-akamai requested review from mawilk90 and zliang-akamai and removed request for a team August 7, 2026 14:53

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

Hardens kubeconfig storage by applying restrictive POSIX permissions.

Changes:

  • Creates kubeconfig files with mode 0600.
  • Creates parent directories with mode 0700.
  • Tests new and existing file permissions.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
linodecli/plugins/get-kubeconfig.py Adds secure file and directory modes.
tests/unit/test_plugin_kubeconfig.py Tests permission enforcement.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +161 to +165
file_descriptor = os.open(
filepath,
os.O_WRONLY | os.O_CREAT | os.O_TRUNC,
KUBECONFIG_FILE_MODE,
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement for improvements in existing functionality in the changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants