[Mate] Create scaffolded secrets and log files with restrictive permissions#2247
Open
wachterjohannes wants to merge 1 commit into
Open
[Mate] Create scaffolded secrets and log files with restrictive permissions#2247wachterjohannes wants to merge 1 commit into
wachterjohannes wants to merge 1 commit into
Conversation
…ssions Files written by mate that can contain secrets or local configuration were created with the process default (typically world-readable 0644). On shared hosts other users could read them. mate init now creates mate/.env and mate/config.php with 0640 and the mate/ directory with 0750; the Logger creates its log file with 0640 and its log directory with 0750.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Files written by Mate that can hold secrets or local configuration were created with the process default umask (typically world-readable
0644). On a shared/multi-user host, other users could readmate/.env(secrets),mate/config.php, and the debug log.This PR makes those files owner/group-only:
mate initcreatesmate/.envandmate/config.phpwith0640and themate/(andmate/src/) directories with0750;Loggercreates its log file with0640(only on first creation) and its log directory with0750.The permission modes live in a single
Symfony\AI\Mate\Service\FilePermissionsholder (FILE,DIRECTORY,EXECUTABLE) used by both classes, so there are no duplicated constants or magic mode literals. Non-sensitive scaffolded files (mcp.json,AGENTS.md,AGENT_INSTRUCTIONS.md,.gitignore) are left at the default — they are typically committed and contain no secrets;bin/codexstays executable (0755).Hardening is best-effort (
@chmod), so it is a no-op on platforms without POSIX permissions rather than a hard failure. Tests assert the resulting permissions for the scaffolded files/directories and the log file/directory (skipped on Windows).