Skip to content

refactor: sanitize session variables - #5

Open
deepsource-dev-autofix[bot] wants to merge 1 commit into
v1.18.1-basefrom
deepsource-autofix-a0eaf435
Open

refactor: sanitize session variables#5
deepsource-dev-autofix[bot] wants to merge 1 commit into
v1.18.1-basefrom
deepsource-autofix-a0eaf435

Conversation

@deepsource-dev-autofix

Copy link
Copy Markdown

This PR refactors the way session variables for queue sorting are assigned by adding proper input validation and sanitization.

  • Trust Boundary Violation in Session Variables: Previously, the code directly assigned raw $_GET['sort'] and $_GET['dir'] values into the session, creating a trust boundary violation where untrusted user input could persist across requests. The update applies filter_input with FILTER_SANITIZE_STRING to clean the 'sort' parameter and then checks it against a whitelist ($queue_sort_options), defaulting to the first allowed option if the provided value is invalid. For 'dir', it uses FILTER_VALIDATE_INT and forces the value to either 0 or 1, ensuring only expected integers are stored. Note: this implementation assumes that $queue_sort_options[0] is the correct default sort order—please review and adjust if a different default is required.

This Autofix was generated by AI. Please review the change before merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants