[PR #1158] [CLOSED] fix: set secure permissions (600) on generated .env files #21776

Closed
opened 2026-06-08 18:23:37 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/moghtech/komodo/pull/1158
Author: @litlmike
Created: 2/7/2026
Status: ❌ Closed

Base: main ← Head: fix-issue-1056


📝 Commits (1)

  • 62d06ff fix: set secure permissions (600) on generated .env files

📊 Changes

1 file changed (+24 additions, -0 deletions)

View changed files

📝 lib/environment/src/lib.rs (+24 -0)

📄 Description

Summary

Generated .env files now have permissions set to 600 (owner read/write only) instead of the default 644 (world-readable). This prevents potential exposure of secrets when the repository directory is accessible to other users on the host.

Changes

  • Added #[cfg(unix)] conditional code to set file permissions to 0600 after writing .env files
  • Uses okio::fs::set_permissions with PermissionsExt::from_mode(0o600) for async-compatible permission setting
  • Includes proper error handling and logging if permission setting fails

Testing

The change is Unix-specific (using #[cfg(unix)]) and will have no effect on Windows systems where file permissions work differently.

Closes #1056


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/moghtech/komodo/pull/1158 **Author:** [@litlmike](https://github.com/litlmike) **Created:** 2/7/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix-issue-1056` --- ### 📝 Commits (1) - [`62d06ff`](https://github.com/moghtech/komodo/commit/62d06ff4c48ec8768d68e44915ec4a121be26357) fix: set secure permissions (600) on generated .env files ### 📊 Changes **1 file changed** (+24 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `lib/environment/src/lib.rs` (+24 -0) </details> ### 📄 Description ## Summary Generated .env files now have permissions set to 600 (owner read/write only) instead of the default 644 (world-readable). This prevents potential exposure of secrets when the repository directory is accessible to other users on the host. ## Changes - Added #[cfg(unix)] conditional code to set file permissions to 0600 after writing .env files - Uses okio::fs::set_permissions with PermissionsExt::from_mode(0o600) for async-compatible permission setting - Includes proper error handling and logging if permission setting fails ## Testing The change is Unix-specific (using #[cfg(unix)]) and will have no effect on Windows systems where file permissions work differently. Closes #1056 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-06-08 18:23:37 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/komodo#21776