Fix template directive injection handling - #41244
Open
angelvilaplana wants to merge 1 commit into
Open
Conversation
|
Hi @angelvilaplana. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
Contributor
Author
|
@magento run all tests |
angelvilaplana
force-pushed
the
fix/template-directive-injection
branch
from
September 8, 2026 18:52
d157315 to
326de5f
Compare
Contributor
Author
|
@magento run all tests |
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.
Description (*)
This PR fixes an issue in the template directive filtering that can cause directive content originating from template data to be processed again when deferred directives are resolved.
The issue can be reproduced through a guest cart by storing a template directive in an address field and subsequently triggering the Payflow Pro response handling flow.
The proposed changes introduce two mechanisms to prevent this behavior:
Unresolved signature markers are also removed when the root template finishes processing, preventing internal marker values from reaching the rendered output.
Related Pull Requests
Fixed Issues (if relevant)
Manual testing scenarios (*)
Create a guest cart using the
createGuestCartGraphQL mutation and save the returned cart ID.Set the billing address of the guest cart using the following setBillingAddressOnCart GraphQL mutation. Replace <CART_ID> with the guest cart ID returned in the previous step.
The important part of this payload is that the
firstnameis set to Injected Code Example, while theregionfield contains the template directive:{{if city}}{{var firstname}}{{/if}}handlePayflowProResponseGraphQL mutation for the same guest cart:Injected Code Exampleappears twice in the payment transaction failure information: once as the firstname value and once where the template directive is injected.If you do the same steps with this PR applied, you can see that this unintended replacement doesn't happen.
Questions or comments
Contribution checklist (*)