Repository navigation
feat(client): fetch several records by their codes in one request - #55
Merged
Merged
Conversation
A code is interpolated into a FlexiBee filter as (kod eq '<code>'). The validator only checked length and upper case, so a code such as "A') OR (1=1" passed and changed the meaning of the filter. Codes with an apostrophe are now rejected.
Client::findByCodes() loads the records of the configured evidence whose
codes are in the given list through a single (kod in ('A','B')) filter.
Every code is validated like in getByCode(); an empty list returns no
results without a request.
Closes #43
pekral
marked this pull request as ready for review
November 12, 2026 15:03
Collaborator
Author
Code ReviewStatus: clean Summary: 0 Critical · 0 Moderate · 0 Minor · 0 Refactoring · assignment conformance: conformant (#43: batch fetch by codes from evidence in one request) · reviewer comments: none |
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.
Closes #43
TL;DR
Nová metoda
Client::findByCodes(array $codes, array $uriParameters = [])načte více záznamů evidence podle seznamu kódů jedním requestem. Navíc oprava bezpečnostní chyby: kód s apostrofem mohl změnit filtr.Změny
Client::findByCodes()pošle jeden GET s filtrem(kod in ('A','B'))a vrátí poleEvidenceResultjen pro nalezené záznamy. Pro prázdný seznam kódů request neposílá a vrátí[].UrlBuilder::createUriByCodes()validuje každý kód stejně jakogetByCode().ParameterValidatordosud kontroloval jen délku a velká písmena. KódA') OR (1=1prošel a změnil význam filtru(kod eq '…')vgetByCode()/findByCode(). Kód s apostrofem je teď odmítnut. Chyba existovala už ve verzi 1.4, je zapsaná vCHANGELOG.md.Zdroje
in(„Je prvkem výčtu“, příklada in (1, 2, 3)) a řetězce v apostrofech: https://podpora.flexibee.eu/cs/articles/4722195-filtrovani-zaznamuMerge danger
429 Too Many Requestspro všechny dotazy s filtrem, i pro dříve funkčníkod eq. Kombinaceins textovými hodnotami vychází ze zdokumentované syntaxe (operátorin+ řetězce v apostrofech), přímý příklad pro řetězce dokumentace neuvádí.Testování
kod in, validace každého kódu, prázdný seznam bez requestu, vrácení výsledků z klienta, odmítnutí apostrofu.composer checkprochází, pokrytí změněných řádků 20/20.$client->findByCodes(['KOD1', 'KOD2'])musí vrátit oba záznamy, neexistující kód se ve výsledku neobjeví.