Plugin Directory: Rebuild the security scan alert with Block Kit - #782
Plugin Directory: Rebuild the security scan alert with Block Kit#782obenland wants to merge 1 commit into
Conversation
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
247d0b9 to
96430e7
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves the readability of the Plugin Directory’s Gandalf security-scan Slack alert by adding severity-driven visual cues and tightening up Slack mrkdwn formatting, while fixing double-encoded plugin titles in the message.
Changes:
- Decode entity-encoded plugin post titles before Slack escaping to prevent
&-style double-encoding. - Add CVSS-band severity “dot” indicators and normalized 1-decimal risk-score badges (including restored investigation result markers).
- Wrap findings in a Slack blockquote and make the overflow line an italicized link to the full report, reusing a safely-escaped report URL.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Replaces the text-only alert with a structured message: a header block with the plugin name and version, a findings/installs summary with a View report button, wp-admin and Plugin page context links, and one color-barred attachment per finding (red >=9, orange >=6, yellow >=4) holding the risk score, title, and a File: link to the Trac browser. The plain-text fallback keeps notifications readable, and the sender displays as "Gandalf" instead of the dispatching web host. Requires the notify_slack() array support in the private repository to deploy first; until then the webhook would reject the array payload. Follow-up to WordPress#779 and WordPress#781. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
96430e7 to
62c9cef
Compare
Matches the design language of the Gandalf alert while staying distinguishable: sender "Plugin Check", a header block with the plugin name and scanned ref, an error/install summary line, wp-admin, Source, and Plugin page context links, and the error-code table in a code block with columns sized to the content instead of a fixed 80 characters, sorted by error count and capped at 15 rows. Pure blocks, no buttons or attachments, so no "Added by" attribution appears. The headline error count is derived from the displayed summary rather than the PCP totals, which could disagree with the table. Entity-encoded post titles are decoded, the‼️ wall is gone, and untrusted strings are escaped for mrkdwn or URL-encoded. Requires the notify_slack() array support in the private repository to deploy first, same as WordPress#782. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Matches the design language of the Gandalf alert while staying distinguishable: sender "Plugin Check", a header block with the plugin name and scanned ref, an error/install summary line, wp-admin, Source, and Plugin page context links, and the error-code table in a code block with columns sized to the content instead of a fixed 80 characters, sorted by error count and capped at 10 rows. Pure blocks, no buttons or attachments, so no "Added by" attribution appears. The headline error count is derived from the displayed summary rather than the PCP totals, which could disagree with the table. Entity-encoded post titles are decoded, the‼️ wall is gone, and untrusted strings are escaped for mrkdwn or URL-encoded. Requires the notify_slack() array support in the private repository to deploy first, same as WordPress#782. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Follow-up to #779 and #781, superseding the earlier text-mrkdwn restyle on this branch. The alert becomes a structured Block Kit message, designed iteratively against rendered mockups of real callback payloads:
Accordion and Accordion Slider 1.4.4), with(closed)appended for closed plugins. Header blocks are plain text, so entity-encoded titles are decoded (fixes the literal&visible in current alerts) and control sequences like<!channel>are inert without escaping.*3 findings* · 3,000+ active installs(installs bold at ≥10,000), with a primary View report link button as the section accessory. The button URL isesc_url_raw()-sanitized and omitted entirely if the callback carries no report URL, so the block set stays valid.wp-admin · Plugin pageline; the scanned ref is appended (escaped) only when it differs from the version, e.g.· trunk.*9.8* — <title>(score padded to one decimal, title excerpted to 150 chars) plus a smallFile:context line linking to the plugins Trac browser at the scanned ref and line.usernameoverride, instead of the dispatching web host (web2.dca.wordpress.org).Security scan found 3 findings in <plugin> <version> (max risk 9.8), escaped, keeping push notifications and non-block surfaces informative.Verified in a rendering harness against the example callback payload, an entity-encoded Jetpack-style title with 17 findings, and hostile strings (
<!channel>/<!here>in titles,|and</>in file paths and the report URL) — mrkdwn escaping, link syntax, and block validity hold in all cases.phpcs-changedagainst trunk reports no new violations.Deploy-order dependency: this requires the
notify_slack()/slack_dm()array-message support (text/blocks/attachments/usernamekeys) in the private dotorg repository to land first. Against an un-upgradedslack_dm(), the array would be JSON-encoded into the webhooktextfield and Slack would reject the payload, silently dropping the alert.🤖 Generated with Claude Code