Skip to content

Fix. Contacts Encoder. Shortcodes. Content sanitization improved.#794

Open
alexandergull wants to merge 2 commits intofixfrom
fix.ee.kses.ag
Open

Fix. Contacts Encoder. Shortcodes. Content sanitization improved.#794
alexandergull wants to merge 2 commits intofixfrom
fix.ee.kses.ag

Conversation

@alexandergull
Copy link
Copy Markdown
Member

Copilot AI review requested due to automatic review settings May 9, 2026 18:05
@codecov
Copy link
Copy Markdown

codecov Bot commented May 9, 2026

Codecov Report

❌ Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 15.25%. Comparing base (325dcac) to head (1ab88a3).

Files with missing lines Patch % Lines
...tWP/ContactsEncoder/Shortcodes/EncodeContentSC.php 96.55% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                fix     #794      +/-   ##
============================================
+ Coverage     15.16%   15.25%   +0.08%     
- Complexity     5593     5602       +9     
============================================
  Files           264      264              
  Lines         27331    27357      +26     
============================================
+ Hits           4146     4173      +27     
+ Misses        23185    23184       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Contacts Encoder shortcode handling to avoid extracting/rewriting [apbct_encode_data]...[/apbct_encode_data] when it appears inside HTML tag/attribute contexts, and adds additional sanitization and test coverage around shortcode extraction behavior.

Changes:

  • Added HTML-tag context detection (isShortcodeInsideHtmlTag() / isOffsetInsideHtmlTag()) and an early-return guard in changeContentBeforeEncoderModify().
  • Sanitized extracted shortcode inner content via Escape::escKsesPost() before storing/restoring.
  • Expanded PHPUnit coverage for shortcode extraction behavior, including attribute-context cases and offset detection.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/EncodeContentSC.php Adds HTML-tag context detection, early-return guard, and sanitization during shortcode extraction.
tests/ApbctWP/ContactsEncoder/TestContactsEncoderShortCodeEncode.php Adds tests for attribute-context non-processing, multiple shortcodes, and offset detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread lib/Cleantalk/ApbctWP/ContactsEncoder/Shortcodes/EncodeContentSC.php Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants