fix: add ABSPATH direct access protection to 15 PHP files#3198
Merged
brianhogg merged 3 commits intoJul 20, 2026
Merged
Conversation
Plugin Check flagged 15 files missing the standard WordPress direct file access guard. Adds the standard 'defined( "ABSPATH" ) || exit;' check to: - 13 builder view templates under includes/admin/views/builder/ - 1 access plan dialog template (access-plan-dialog.php) - 1 order view function file (llms-functions-template-view-order.php) No business logic changes. Two files (libraries/lifterlms-cli/src/commands.php, libraries/lifterlms-rest/uninstall.php) already had the guard. PHP lint and PHPCS pass on all modified files.
faisalahammad
force-pushed
the
fix/abspath-direct-access-protection
branch
from
June 19, 2026 05:31
a7b84e8 to
299beaa
Compare
brianhogg
requested changes
Jul 16, 2026
Shorten changelog entry from 28 words to 6 as requested by reviewer brianhogg. Refs gocodebox#3198
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.
Summary
Plugin Check flagged 15 PHP files missing the standard
defined( 'ABSPATH' ) || exit;direct access protection. Adds the guard to builder view templates, the access plan dialog, and the order view function file. No business logic changed.Changes
Builder view templates (13 files)
Inserts the ABSPATH guard after the file docblock, before the closing
?>:Before:
After:
Files: lesson.php, elements.php, question.php, question-type.php, editor.php, section.php, course.php, utilities.php, question-choice.php, assignment.php, sidebar.php, lesson-settings.php, quiz.php.
Access plan dialog template
The file contains no
<?phpopener, so the guard wraps the existing markup at the top of the file:Before:
After:
Order view function file
The guard sits between the file docblock and the function definition wrapper:
Before:
After:
Why: Plugin Check rejects any PHP file under
includes/,libraries/, or the plugin root that can be reached via a direct HTTP request without first going through the WordPress bootstrap. The one-liner is the standard pattern already used across the rest of the codebase (seeincludes/admin/views/access-plans/access-plan.php,includes/admin/views/dashboard.php,includes/functions/llms-functions-*.php).Skipped
Two flagged files already have an equivalent guard and were not modified:
libraries/lifterlms-cli/src/commands.php(usesdefined( 'ABSPATH' ) || exit;)libraries/lifterlms-rest/uninstall.php(usesdefined( 'ABSPATH' ) || exit;)Testing
php -lon all 15 modified files: no syntax errors../vendor/bin/phpcs --standard=phpcs.xmlon all 15 files: exit 0, no warnings or errors.includes/admin/views/builder/lesson.php) in the WP admin Course Builder screen: lesson list renders normally.includes/admin/views/access-plans/access-plan-dialog.php) in a course's access plan metabox: dialog opens and closes as before.Build
No new build artifacts. Source-only change.