| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
There was a problem hiding this comment.
Thanks for the PR. Could you please adjust the PR title, description, and commit message to avoid framing this as a security vulnerability?
As discussed, the affected priority list is normally controlled by the application developer/operator through config or CLI, not by untrusted end users in normal usage. This is better described as hardening the database queue ordering logic.
Sorry, something went wrong.
| public function testSetPriority(): void | ||
| { | ||
| $model = model(QueueJobModel::class); | ||
| $method = $this->getPrivateMethodInvoker($model, 'setPriority'); | ||
| $builder = $model->builder(); | ||
|
|
||
| $result = $method($builder, ['high', 'low']); | ||
|
|
||
| $sql = $result->getCompiledSelect(); | ||
|
|
||
| $this->assertStringContainsString('priority', $sql); | ||
| if ($model->db->DBDriver === 'MySQLi') { | ||
| $this->assertStringContainsString('FIELD(priority, ', $sql); | ||
| } else { | ||
| $this->assertStringContainsString('CASE ', $sql); | ||
| $this->assertStringContainsString(' WHEN ', $sql); | ||
| $this->assertStringContainsString(' THEN ', $sql); | ||
| $this->assertStringContainsString(' END', $sql); | ||
| } | ||
| } |
There was a problem hiding this comment.
The test seems a bit weak. It checks that SQL contains CASE/FIELD, but not that dangerous values are escaped or keys are normalized.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
This PR fixes a potential SQL injection vulnerability in the QueueJobModel by properly escaping priority values before using them in CASE and FIELD SQL statements. A unit test was also added to ensure correct behavior.