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: Allowing Direct File Access to plugin files #603

Open
davidperezgar opened this issue Sep 1, 2024 · 1 comment
Open

Check: Allowing Direct File Access to plugin files #603

davidperezgar opened this issue Sep 1, 2024 · 1 comment
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

This check consists to avoid direct file access if someone directly queries a file.

For files that only contain a PHP class the risk of something funky happening when directly accessed is pretty small. For files that contain procedural code, functions and function calls, the chance of security risks is a lot bigger.

We can avoid this by putting this code at the top of all PHP files that could potentially execute code if accessed directly :
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

What we do actually in the internal scanner:

  1. Check that is not an uninstall file.
  2. Check that is valid for direct access.
  3. Look for ABPATH or WPINC, otherwise it's wrong.

Finally in results we say all files that does not contain this header.

@davidperezgar davidperezgar added Checks Audit/test of the particular part of the plugin [Team] Plugin Review Issues owned by Plugin Review Team labels Sep 1, 2024
@swissspidy
Copy link
Member

WordPress/WordPress-Coding-Standards#1850

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

No branches or pull requests

3 participants