Repository navigation
Use 0755 instead of 0700 for the packages directory #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | 🏗️ Heavy lift
🧩 Analysis chain
🌐 Web query:
Composer 2.10.2 src Composer Autoload AutoloadGenerator generate filePutContentsIfModified vendor/autoload.php chmod💡 Result:
In Composer 2.10.2, the AutoloadGenerator class is responsible for generating autoloader files within the vendor directory [1][2][3]. The process involves generating several files (e.g., autoload.php, autoload_static.php, autoload_real.php) using the filePutContentsIfModified method from the Filesystem utility class [1][3][4][5]. The filePutContentsIfModified method is implemented in src/Composer/Util/Filesystem.php as follows: public function filePutContentsIfModified(string $path, string $content) { $currentContent = Silencer::call('file_get_contents', $path); if (false === $currentContent || $currentContent!== $content) { return file_put_contents($path, $content); } return 0; } This method only performs a file write operation if the target file does not exist or if the content has changed, which helps avoid unnecessary disk I/O and maintains original file timestamps when no modification is required [4]. It does not explicitly call chmod to modify file permissions during the generation of these files; standard file permissions are determined by the PHP file_put_contents function and the system's default umask settings [4].
Citations:
🌐 Web query:
Composer 2.10.2 Package_Command require composer version autoload vendor autoload.php include chmod💡 Result:
Composer 2.10.2 is a version of the Composer dependency manager released on July 1, 2026 [1][2]. The
requirecommand is used to add new packages to yourcomposer.jsonfile and install them into your project [3]. When you runcomposer require <package-name>, Composer updates your dependencies and regenerates the autoloading files, specifically thevendor/autoload.phpentry point [4][5][6]. Regardingvendor/autoload.phpandchmodpermissions: 1. Purpose of vendor/autoload.php: This file is the central entry point for PHP's autoloading mechanism in Composer-managed projects [4][6]. By including it at the start of your application (e.g.,require DIR . '/vendor/autoload.php';), PHP will automatically load any classes from your installed packages when needed, eliminating the need for manualrequireorincludestatements for individual class files [4][7][5][6]. 2. Permission Issues and chmod: If you encounter "Permission denied" or "Failed opening required" errors when attempting to include this file, it is typically due to incorrect file system permissions or ownership [8][9][10]. - Ownership: Thevendordirectory and its contents should be owned by the user or service account that executes your PHP scripts (such aswww-data,apache, or your own user) [8][9][10]. You can fix ownership issues usingchown(e.g.,sudo chown -R <user>:<group> vendor) [10]. - Permissions: Ensure the directories and files are readable by the PHP process [8]. Whilechmodcan be used to set permissions (e.g.,chmod 755 -R vendor), it is generally better practice to manage ownership correctly rather than granting broad, insecure permissions likeo+w(world-writable) [11][10]. If thevendor/autoload.phpfile is missing, ensure you have successfully runcomposer installorcomposer updatein the project root [4][6]. If you change your project's autoload configuration incomposer.json, you must runcomposer dump-autoloadto regenerate the autoloader files [4][6].Citations:
🏁 Script executed:
Repository: wp-cli/package-command
Length of output: 2955
🏁 Script executed:
Repository: wp-cli/package-command
Length of output: 16208
Security Misconfiguration (CWE-732): Incorrect Permission Assignment for Critical Resource
Reachability: Internal
Protect generated autoload files, not only the packages directory.
0755clears group/other write from the directory, but Composer 2.10.2 still writes generated PHP files throughfile_put_contents()without clearing file write bits. On a shared packages directory with a permissive umask, a local peer with file access can overwritevendor/autoload.phpeven though they cannot create files there. Enforce that Composer-created PHP files under WP-CLI packages are not group- or world-writable, or keep the Composer root private until Composer applies stricter default permissions.🤖 Prompt for AI Agents
Source: MCP tools