Skip to content

/models files security audit and fixes and query update - #3136

Open
Anindra123 wants to merge 40 commits into
4.2.1from
chore/models/security-fixes
Open

Anindra123 wants to merge 40 commits into
4.2.1from
chore/models/security-fixes

Conversation

@Anindra123

@Anindra123 Anindra123 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

ClickUp ticket link:
https://app.clickup.com/t/9018365849/z8zyy1pz6b

Description

  • Found out vulnerabilities for classes in models/ folder

  • Updated classes in models folder to use new fluent DB query instead of QueryHelper

  • Added unit tests for several model classes

  • QuizModel.php

    • Added ABSPATH check
    • In get_quiz_answers_by_attempt_id the attempt_id was not type casted to int, further more there was no prepare statement on the query
    • IN get_quiz_attempt_timing @unserialize was calling with error suppressed with no proper flag passed to prevent PHP object injection
    • In get_quiz_count_by_course the query was updated to use query helper instead
  • CourseModel.php

    • Added abspath check
    • In get_courses added check for excludes id array and post status parameter and used prepare in clause
    • Utilized cap manage_options instead of administrator
  • EnrollmentModel.php

    • Added abspath check
    • In get_enrolled_data added check for status and course id post type
  • OrderModel.php

    • Added abspath check
    • In create_order after catch no rollback query was running
    • In get_refunds_by_user the $user_id was placed with direct interpolation with no prepare query check

Testing

  • Tested
  • Not tested

Use of AI Tool

Used: Yes

Used for:
Finding security issues on all the classes in models/

Anindra123 and others added 30 commits October 1, 2026 15:31
`UserModel.php` Fix:  typcast to int before placing it in string interpolation for query
Fix: Query hardened for the several model class
 `QuizModel.php` : Security Fixes
@Anindra123 Anindra123 self-assigned this Oct 28, 2026
@Anindra123 Anindra123 changed the title Chore/models/security fixes /models files security audit and fixes Oct 28, 2026
@Anindra123 Anindra123 changed the title /models files security audit and fixes /models files security audit and fixes and query update Oct 28, 2026
@Anindra123
Anindra123 changed the base branch from dev to 4.2.1 October 28, 2026 05:47
@Anindra123 Anindra123 added 4.2.1 and removed future labels Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants