Skip to content

Plugin Directory: Rebuild the security scan alert with Block Kit - #782

Closed
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:update/gandalf-slack-alert-polish
Closed

Plugin Directory: Rebuild the security scan alert with Block Kit#782
obenland wants to merge 1 commit into
WordPress:trunkfrom
obenland:update/gandalf-slack-alert-polish

Conversation

@obenland

@obenland obenland commented Aug 11, 2026

Copy link
Copy Markdown
Member

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:

  • Header block — plugin name and version as Slack's large heading (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 &amp; visible in current alerts) and control sequences like <!channel> are inert without escaping.
  • Summary section*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 is esc_url_raw()-sanitized and omitted entirely if the callback carries no report URL, so the block set stays valid.
  • Context links — small wp-admin · Plugin page line; the scanned ref is appended (escaped) only when it differs from the version, e.g. · trunk.
  • One color-barred attachment per finding (top 5 by risk score): the bar encodes the risk band — red ≥9, orange ≥6, yellow ≥4, gray below. Each card is a section with *9.8* — <title> (score padded to one decimal, title excerpted to 150 chars) plus a small File: context line linking to the plugins Trac browser at the scanned ref and line.
  • Sender — displays as Gandalf via the new username override, instead of the dispatching web host (web2.dca.wordpress.org).
  • Fallback textSecurity 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-changed against trunk reports no new violations.

Deploy-order dependency: this requires the notify_slack()/slack_dm() array-message support (text/blocks/attachments/username keys) in the private dotorg repository to land first. Against an un-upgraded slack_dm(), the array would be JSON-encoded into the webhook text field and Slack would reject the payload, silently dropping the alert.

🤖 Generated with Claude Code

Copilot AI lite review requested due to automatic review settings August 11, 2026 01:29
@github-actions

Copy link
Copy Markdown

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 props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props obenland.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@obenland
obenland force-pushed the update/gandalf-slack-alert-polish branch from 247d0b9 to 96430e7 Compare August 11, 2026 01:30
@obenland obenland changed the title Plugin Directory: Color-code findings in security scan alerts Plugin Directory: Sharpen the findings list in security scan alerts Aug 11, 2026

Copilot AI left a comment

Copy link
Copy Markdown

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 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 &amp;amp;-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>
@obenland
obenland force-pushed the update/gandalf-slack-alert-polish branch from 96430e7 to 62c9cef Compare August 11, 2026 12:51
@obenland obenland changed the title Plugin Directory: Sharpen the findings list in security scan alerts Plugin Directory: Rebuild the security scan alert with Block Kit Aug 11, 2026
@bazza bazza closed this in 629bbcc Aug 11, 2026
obenland added a commit to obenland/wordpress.org that referenced this pull request Aug 12, 2026
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>
obenland added a commit to obenland/wordpress.org that referenced this pull request Aug 12, 2026
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>
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