Skip to content

PLANET-7630: render special chars when post is shared #2893

Open
GP-Dan-Tovbein wants to merge 5 commits intomainfrom
PLANET-7630-shared-link-speacal-char
Open

PLANET-7630: render special chars when post is shared #2893
GP-Dan-Tovbein wants to merge 5 commits intomainfrom
PLANET-7630-shared-link-speacal-char

Conversation

@GP-Dan-Tovbein
Copy link
Contributor

@GP-Dan-Tovbein GP-Dan-Tovbein commented Feb 13, 2026

Summary

Render just raw the content and prevent XSS atacks.

Please check the reported issue on Slack https://greenpeace.slack.com/archives/C0151L0KKNX/p1770909176985789

After
Screenshot 2026-02-18 at 11 57 15 AM


Ref: https://greenpeace-planet4.atlassian.net/browse/PLANET-7630

Testing

  1. Create a new post using the title of https://bsky.app/profile/greenpeace.eu/post/3meoaaow4p22t
  2. BlueSky account it's required 🙏

@GP-Dan-Tovbein GP-Dan-Tovbein self-assigned this Feb 13, 2026
@GP-Dan-Tovbein GP-Dan-Tovbein changed the title Follow up fix PLANET-7630: render special chars when post is shared Feb 13, 2026
@GP-Dan-Tovbein GP-Dan-Tovbein marked this pull request as ready for review February 13, 2026 14:21
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Feb 13, 2026
/unhold 492b7730-0b10-4932-9b4d-031237c4b548
@planet-4
Copy link
Contributor

planet-4 commented Feb 13, 2026

Test instance is ready 🚀

🌑 nix | admin | blocks report | CircleCI | composer-local.json

⌚ 2026.02.24 05:09:06

planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Feb 13, 2026
/unhold 05b5cf1d-c422-4804-ac1a-268becd3f631
- Render just raw the content
- Standarize title content
- Make the variable safe
@GP-Dan-Tovbein GP-Dan-Tovbein force-pushed the PLANET-7630-shared-link-speacal-char branch from 20c7396 to 61635fc Compare February 18, 2026 14:48
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Feb 18, 2026
/unhold 3b10c28a-63f5-44ed-8a6e-206332ba0cfb

<meta name="title" content="{{ title|e('html_attr')|raw }}"/>
<meta property="og:title" content="{{ title|e('html_attr')|raw }}" />
{% set title = title|replace({'`': "'"})|raw %}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We might need to replace backticks with ' to avoid XSS atacks.

@sagarsdeshmukh
Copy link
Member

Code-wise, the fix looks good to me 👍 However, I would suggest doing UAT with an NRO person who reported the issue, as there may be additional cases involving special characters (such as &) that could still affect social sharing.

@GP-Dan-Tovbein GP-Dan-Tovbein marked this pull request as draft February 19, 2026 15:04
- Move title logic to PHP instead of Twig
@GP-Dan-Tovbein GP-Dan-Tovbein marked this pull request as ready for review February 23, 2026 12:24
@GP-Dan-Tovbein GP-Dan-Tovbein added the UAT Needed This PR requires User Acceptance Tests before merge label Feb 23, 2026
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Feb 23, 2026
/unhold 90d2b9f1-bf9f-4220-82cd-fffbe5da3187
@sagarsdeshmukh
Copy link
Member

I am checking this page preview on Twitter (I am not aware of any official tool if exist to test this, but for now using the one below) -
https://tweethunter.io/tweetpik/twitter-card-validator

image

The special characters in the title are breaking social share previews.
The PHPUnit tests need to be check, as they are currently failing.
The special character issue is also commonly reported when using the social share option on the post details page, so it would be good to verify this while working on the ticket.

Remove unnecesary comments
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Feb 23, 2026
/unhold 9a4e6b64-2707-4965-b401-05a75122ecfe
planet-4 added a commit to greenpeace/planet4-test-nix that referenced this pull request Feb 24, 2026
/unhold 6ade0555-31a2-4cd4-a3bd-e9f113ebda8d
@GP-Dan-Tovbein
Copy link
Contributor Author

I am checking this page preview on Twitter (I am not aware of any official tool if exist to test this, but for now using the one below) - https://tweethunter.io/tweetpik/twitter-card-validator
image

The special characters in the title are breaking social share previews. The PHPUnit tests need to be check, as they are currently failing. The special character issue is also commonly reported when using the social share option on the post details page, so it would be good to verify this while working on the ticket.

I'm getting a different result

Screenshot 2026-02-24 at 7 37 36 AM

While on X.com I get
Screenshot 2026-02-24 at 7 39 13 AM

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

Labels

UAT Needed This PR requires User Acceptance Tests before merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants