Company Size Filter SQL prüfen#77
Closed
flolanger wants to merge 1 commit into
Closed
Conversation
CompanyRepository::findByFilter()/findAmountByFilter() (and PagevisitRepository::findLatestPagevisitsWithCompanies()) build raw SQL by concatenating FilterDto::getSizeClass() and getRevenueClass() unquoted into the WHERE clause. Those getters only apply the StringUtility::sanitizeString() denylist, which leaves spaces, commas, digits and SQL keywords intact. A backend user with access to the Lead module could therefore inject SQL through the company size/revenue class filter (e.g. UNION-based reads of other tables and bypass of the per-site scoping enforced via getSitesForFilter()). Cast both values to int at the point of concatenation, mirroring the existing branch_code handling in the same class. The filter only ever carries numeric class codes and the previous unquoted comparison was already interpreted numerically by the database, so behaviour is unchanged for legitimate input. Adds a unit test that proves the size_class/revenue_class fragments are no longer injectable.
Contributor
Author
|
After Review: AI Changes are not quite the solution, we need to look into this further first. |
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.
[Claude Code]
Problem
FilterDto::getSizeClass()undgetRevenueClass()werden inAbstractRepositoryunquotiert in rohes SQL eingefügt (Company-/Pagevisit-Filter). Die Werte durchlaufen nur die DenylistStringUtility::sanitizeString(), die Leerzeichen, Kommas, Ziffern und SQL-Schlüsselwörter durchlässt.Fix
Beide Werte an der Konkatenationsstelle nach
intcasten – analog zum bestehendenbranch_code. Der Filter enthält ausschließlich numerische Klassen-Codes, das Verhalten für legitime Eingaben bleibt unverändert.Tests
Neuer
AbstractRepositoryTestbelegt, dass die Fragmente nicht mehr injizierbar sind. Unit-Suite grün (203 Tests), php-cs-fixer sauber.