Fix task status badge#4
Conversation
caveatIs it possible the bug exists in a helper function upstream to Jetpack? AI root-cause analysisI had Claude analyze and try to find if the error was a regression, as the task status badge seemed to work at some point in time. It provided the following root-cause analysis: <span class='ui grey label'>Incomplete</span>
HistoryThis bug has been present since the initial monorepo commit ( Parallel code in
|
| SHA | Date | Message | Affected Task Status? |
|---|---|---|---|
08d6d8ff |
2026-05-08 | CRM: Use proper string escape functions (#48496) | No — only JS nonce output |
1285bad7 |
2026-02-05 | CRM: Fix code style formatting throughout codebase (#46809) | No — whitespace/comment only |
06ee1cc3 |
2025-09-17 | Phan: Address PhanTypeSuspiciousStringExpression violations (#45182) | No — variable renaming only |
fa9394b9 |
2025-08-22 | Phan: Address PhanImpossibleCondition violations (#44869) | No |
dbad794f |
2025-01-20 | Phan: functionify and statusify exit() and die() (#41167) | No |
None of the recent commits introduced or modified the task status escaping logic. The bug predates all of them.
Fix
Escape each interpolated value individually when building $status, and output the result directly — mirroring the contact view pattern:
// FIXED
$status = "<span class='" . esc_attr( zeroBSCRM_html_taskStatusLabel( $task ) ) . "'>" . esc_html( $statusStr ) . '</span>';
echo '<td>' . $status . '</td>'; // $status is already safely escaped aboveFiles to change:
admin/company/view.page.php— task loop, approximately line 854 on upstreamtrunk
No change needed:
admin/contact/view.page.php— already correct on upstreamtrunk
Local Fork Status
The fix is already applied in this fork at admin/company/view.page.php:854–861. This fork is ready to submit as a PR to Automattic/jetpack-crm.
References
- Upstream repo: Automattic/jetpack-crm
- Initial monorepo commit:
7aea499e(January 2023) - WordPress escaping docs:
esc_html(),esc_attr() - WordPress WPCS output escaping standards: Plugin Handbook — Data Validation
HTML was being output where the Task status badge should have been.
Fixes: #3