Repository navigation
fix: issue #909 — ms3_get_order не должен раскрывать сырые данные доставки и служебные поля заказа - #1013
Open
Ibochkarev wants to merge 1 commit into
Open
fix: issue #909 — ms3_get_order не должен раскрывать сырые данные доставки и служебные поля заказа#1013Ibochkarev wants to merge 1 commit into
Ibochkarev wants to merge 1 commit into
Conversation
…or internal order fields
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.
fix: issue #909 —
ms3_get_orderне должен раскрывать сырые данные доставки и служебные поля заказаПроблема
Сниппет
ms3_get_orderпередавал в шаблон полные массивы данных:$delivery->toArray(), что включало полеpropertiesс ключами интеграций (webhook-ключи, секретные токены и т.п.).$msOrder->toArray(), что включало служебные поляtokenиidempotency_key.Это создавало риск утечки чувствительных данных через шаблон, даже если штатный чанк
ms3_get_order.tplпечатает толькоnameиdescription.Решение
1.
elements/snippets/ms3_get_order.phpDeliveryPublicFields.DeliveryPublicFields::fromEntityOrEmpty()— только allowlist-поля:id,name,description,price,logo.tokenиidempotency_keyперед передачей в шаблон.2.
src/Services/Customer/CustomerOrderService.phpformatDeliveryOrPayment()обновлён для использованияDeliveryPublicFields::fromEntityOrEmpty()иPaymentPublicFields::fromEntityOrEmpty()вместо ручного маппинга полей.3.
tests/SnippetSecretFieldsTest.php(новый файл)Статический тест проверяет:
DeliveryPublicFields::fromEntityOrEmpty.tokenиidempotency_keyудаляются из массива заказа.ms3_get_order.tplне обращается к полям доставки за пределами allowlist.CustomerOrderService::formatDeliveryOrPaymentиспользует allowlist-классы.Связанные issues
Тестирование
fix/909-secret-fields-ms3_get_order.ms3_get_orderна странице заказа.$delivery.propertiesс ключами интеграций.$order.tokenи$order.idempotency_key.php core/components/minishop3/tests/SnippetSecretFieldsTest.php— должен вывестиOK SnippetSecretFieldsTest.Changelog
Ветка:
fix/909-secret-fields-ms3_get_orderНа основе:
beta