Skip to content
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

Check: Asks users to edit/write to plugin (use uploads folder) #665

Open
davidperezgar opened this issue Sep 25, 2024 · 0 comments
Open
Assignees
Labels
Checks Audit/test of the particular part of the plugin [Team] Plugin Review Issues owned by Plugin Review Team

Comments

@davidperezgar
Copy link
Member

davidperezgar commented Sep 25, 2024

In our reviews we already say:

Saving data in the plugin folder and/or asking users to edit/write to plugin.

We cannot accept a plugin that forces (or tells) users to edit the plugin files in order to function, or saves data in the plugin folder.

Plugin folders are deleted when upgraded, so using them to store any data is problematic. Also bear in mind, any data saved in a plugin folder is accessible by the public. This means anyone can read it and use it without the site-owner’s permission.

It is preferable that you save your information to the database, via the Settings API, especially if it’s privileged data. If that’s not possible, because you’re uploading media files, you should use the media uploader.

If you can’t do either of those, you must save the data outside the plugins folder. We recommend using the uploads directory, creating a folder there with the slug of your plugin as name, as that will make your plugin compatible with multisite and other one-off configurations.

Please refer to the following links:

https://developer.wordpress.org/plugins/settings/
https://developer.wordpress.org/reference/functions/media_handle_upload/
https://developer.wordpress.org/reference/functions/wp_handle_upload/
https://developer.wordpress.org/reference/functions/wp_upload_dir/

We warn developers to use properly folders to save their data. This check could have positives, so maybe we should use a 6 severity and error.

We should check the functions: 'fwrite', 'fputs', 'file_put_contents', 'copy', 'rename', 'copy_dir', 'move_dir', and wp_filesystem. Finally, detect the place that they are using to save the data.

@davidperezgar davidperezgar self-assigned this Sep 25, 2024
@davidperezgar davidperezgar added Checks Audit/test of the particular part of the plugin [Team] Plugin Review Issues owned by Plugin Review Team labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Checks Audit/test of the particular part of the plugin [Team] Plugin Review Issues owned by Plugin Review Team
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant