Skip to content

feat(STD-11440): support interactive product card element in rich editor#895

Draft
W-O-X-Y wants to merge 2 commits intomasterfrom
feature/STD-11440-support-interactive-product-card-element-in-rich-editor
Draft

feat(STD-11440): support interactive product card element in rich editor#895
W-O-X-Y wants to merge 2 commits intomasterfrom
feature/STD-11440-support-interactive-product-card-element-in-rich-editor

Conversation

@W-O-X-Y
Copy link
Copy Markdown
Contributor

@W-O-X-Y W-O-X-Y commented Apr 30, 2026

What kind of change does this PR introduce? (Bug fix, feature, docs update, ...)

What is the current behaviour? (You can also link to an open issue here)

What is the new behaviour? (You can also link to the ticket here)

Does this PR introduce a breaking change?

Screenshots (If appropriate)

Greptile Summary

This PR updates the blog single article template to support interactive product card web components in the rich editor by replacing HTML entities (<, >, ") with their literal characters before rendering the article body as raw HTML.

  • P1 – Missing </article> closing tag: The refactored line drops the </article> closer that was previously on the same line, leaving the element unclosed and producing structurally invalid HTML.
  • P1 – XSS via blanket entity-unescaping before |raw: Globally converting &lt;/&gt; to </> across the entire article body then passing through |raw means any entity-encoded payload (e.g. from a code snippet in the article) will be injected as live HTML. The unescaping should be applied server-side only to the specific product card component elements.

Confidence Score: 2/5

Not safe to merge — contains a missing closing HTML tag and a potential XSS vector in the article body rendering path.

Two P1 findings: a structural HTML bug (missing closing tag) and an XSS risk from blanket entity-unescaping before |raw. The XSS finding is on a public-facing blog page processed via |raw, which places it in P0 territory if merchant-created content can include entity-encoded payloads.

src/views/pages/blog/single.twig — the only material code change and the source of both findings.

Security Review

  • XSS – entity unescaping before |raw in single.twig: The replace filter now converts &lt;<, &gt;>, and &quot;" globally across the entire article.body string before |raw is applied. Any entity-encoded HTML (e.g., code examples stored as &lt;script&gt;) will be injected as executable HTML into the rendered page. The scope of this unescaping must be narrowed to only the product card component markup rather than the full article body.

Important Files Changed

Filename Overview
src/views/pages/blog/single.twig Changed entity-replacement map in article body rendering to unescape HTML angle brackets/quotes before `
public/app.css Auto-generated/compiled CSS bundle update; content is minified and not directly authored — no logic issues to flag.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[article.body from rich editor] --> B[replace filter converts entities to literal chars]
    B --> C[raw filter bypasses Twig escaping]
    C --> D[Browser HTML parser]
    D --> E[Rendered as live HTML]

    F[Entity-encoded malicious payload in article body] -->|included| B
    B -->|entities decoded to actual tags| C
    C -->|injected as raw HTML| G[XSS executed in browser]

    style G fill:#ff4444,color:#fff
    style B fill:#ffaa00,color:#000
Loading
Prompt To Fix All With AI
Fix the following 3 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 3
src/views/pages/blog/single.twig:60
**Missing `</article>` closing tag**

The original line ended with `</article>` (the element was self-contained on one line). The new version opens `<article>` but omits the closing tag, leaving it unclosed for the rest of the main content block. This creates invalid HTML — the tags section and `<salla-comments>` are now unintentionally nested inside the `<article>` element, and the outer `</div>` that closes `.main-content` is reached while `<article>` is still open.

```suggestion
                <article class="leading-7 text-sm mb-10">{{ article.body|replace({'&quot;': '"', '&#34;': '"', '&lt;': '<', '&gt;': '>', '&#60;': '<', '&#62;': '>'})|raw }}</article>
```

### Issue 2 of 3
src/views/pages/blog/single.twig:60
**XSS risk: unescaping `&lt;`/`&gt;` before `|raw`**

The new `replace` map converts `&lt;``<`, `&gt;``>`, `&quot;``"` immediately before `|raw`. If any part of `article.body` contains intentionally entity-encoded content — for example, a code snippet stored as `&lt;script&gt;alert(1)&lt;/script&gt;` — it will now be injected as a live `<script>` tag in the rendered page. The unescaping should be scoped only to the specific product card web component attributes, not applied globally to the entire article body.

### Issue 3 of 3
src/views/pages/blog/single.twig:60
**`&nbsp;` replacement dropped without a clear reason**

The previous `replace` map included `{'&nbsp;': ' '}` to convert non-breaking spaces to regular spaces. The new map removes this entry entirely. While browsers will still display `&nbsp;` correctly as whitespace (since `|raw` bypasses Twig escaping), if the intent was to normalize whitespace for downstream text processing or styling, this silent removal may be unintentional and worth confirming.

Reviews (1): Last reviewed commit: "Merge branch 'master' into feature/STD-1..." | Re-trigger Greptile

Greptile also left 2 inline comments on this PR.

@W-O-X-Y W-O-X-Y self-assigned this Apr 30, 2026
@W-O-X-Y W-O-X-Y added the enhancement New feature or request label Apr 30, 2026
@sallainternalbot sallainternalbot Bot marked this pull request as draft April 30, 2026 07:13
@codacy-production
Copy link
Copy Markdown
Contributor

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

{% endif %}

<article class="leading-7 text-sm mb-10">{{ article.body|replace({'&nbsp;': ' '})|raw }}</article>
<article class="leading-7 text-sm mb-10">{{ article.body|replace({'&quot;': '"', '&#34;': '"', '&lt;': '<', '&gt;': '>', '&#60;': '<', '&#62;': '>'})|raw }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Missing </article> closing tag

The original line ended with </article> (the element was self-contained on one line). The new version opens <article> but omits the closing tag, leaving it unclosed for the rest of the main content block. This creates invalid HTML — the tags section and <salla-comments> are now unintentionally nested inside the <article> element, and the outer </div> that closes .main-content is reached while <article> is still open.

Suggested change
<article class="leading-7 text-sm mb-10">{{ article.body|replace({'&quot;': '"', '&#34;': '"', '&lt;': '<', '&gt;': '>', '&#60;': '<', '&#62;': '>'})|raw }}
<article class="leading-7 text-sm mb-10">{{ article.body|replace({'&quot;': '"', '&#34;': '"', '&lt;': '<', '&gt;': '>', '&#60;': '<', '&#62;': '>'})|raw }}</article>
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/views/pages/blog/single.twig
Line: 60

Comment:
**Missing `</article>` closing tag**

The original line ended with `</article>` (the element was self-contained on one line). The new version opens `<article>` but omits the closing tag, leaving it unclosed for the rest of the main content block. This creates invalid HTML — the tags section and `<salla-comments>` are now unintentionally nested inside the `<article>` element, and the outer `</div>` that closes `.main-content` is reached while `<article>` is still open.

```suggestion
                <article class="leading-7 text-sm mb-10">{{ article.body|replace({'&quot;': '"', '&#34;': '"', '&lt;': '<', '&gt;': '>', '&#60;': '<', '&#62;': '>'})|raw }}</article>
```

How can I resolve this? If you propose a fix, please make it concise.

{% endif %}

<article class="leading-7 text-sm mb-10">{{ article.body|replace({'&nbsp;': ' '})|raw }}</article>
<article class="leading-7 text-sm mb-10">{{ article.body|replace({'&quot;': '"', '&#34;': '"', '&lt;': '<', '&gt;': '>', '&#60;': '<', '&#62;': '>'})|raw }}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security XSS risk: unescaping &lt;/&gt; before |raw

The new replace map converts &lt;<, &gt;>, &quot;" immediately before |raw. If any part of article.body contains intentionally entity-encoded content — for example, a code snippet stored as &lt;script&gt;alert(1)&lt;/script&gt; — it will now be injected as a live <script> tag in the rendered page. The unescaping should be scoped only to the specific product card web component attributes, not applied globally to the entire article body.

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/views/pages/blog/single.twig
Line: 60

Comment:
**XSS risk: unescaping `&lt;`/`&gt;` before `|raw`**

The new `replace` map converts `&lt;``<`, `&gt;``>`, `&quot;``"` immediately before `|raw`. If any part of `article.body` contains intentionally entity-encoded content — for example, a code snippet stored as `&lt;script&gt;alert(1)&lt;/script&gt;` — it will now be injected as a live `<script>` tag in the rendered page. The unescaping should be scoped only to the specific product card web component attributes, not applied globally to the entire article body.

How can I resolve this? If you propose a fix, please make it concise.

Copy link
Copy Markdown
Member

@jalmatari jalmatari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's speak about it

@W-O-X-Y
Copy link
Copy Markdown
Contributor Author

W-O-X-Y commented May 3, 2026

Let's speak about it

Sure, this was a temporarily workaround just for testing purposes

@W-O-X-Y
Copy link
Copy Markdown
Contributor Author

W-O-X-Y commented May 3, 2026

/autoupdate

@sallainternalbot
Copy link
Copy Markdown
Contributor

Auto Update Summary

Failed Updates:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants