feat: v0.3.0 — broadcast-safety fix, reverse tool, validator & MCP hardening - #7
Merged
Merged
Conversation
…rdening Security: - converter: h2-h6 headings (and any heading routed to the section.mrkdwn fallback) now entity-escape < > & in the heading text. The fallback previously escaped only emphasis markers, so `## <!channel>` in rich_text mode emitted a live broadcast. handleFallback and the blockquote unknown-child path were hardened the same way. Added: - server: block_kit_to_markdown tool (inverse conversion; lossy, warns) - server: MCP tool annotations on all six tools - server: block-kit-cheatsheet MCP resource + format_for_slack prompt - validator: button/context/table/image-title/section-accessory rules - validator: surface-aware validation (modal/home 100-block ceiling) - converter: MaxNestingDepth guard (ErrInputTooDeeplyNested) - internal/reverse package; block_kit re-exports the new surface Changed: - server: return_preview_url is a real opt-out (*bool) - server: convert rejects unknown split values; non-loopback bind warning - deps: slack-go/slack v0.23.0 -> v0.23.1 Fixed: - splitter: SplitText no longer cuts inside a multi-byte UTF-8 rune - converter: long-heading fallback truncation is rune-safe, no dangling \ ci: coverage gate now enforces >=80% per package, not just overall.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context
A deep, multi-iteration expert audit of the whole project — every finding verified against primary sources (Slack Block Kit docs, the MCP go-sdk, slack-go, goldmark) rather than assumed. Targets a v0.3.0 release.
Security (the headline)
h2–h6 headings — and any heading routed to the
section.mrkdwnfallback (a long h1, or an h1 containing a link/image/inline code) — only escaped the emphasis markers* _ ~ \``, **not**< > &. So## <!channel>inrich_textmode emitted a **live broadcast token**. Now entity-escaped via the same gate the markdown_block emitter uses;handleFallbackand the blockquote unknown-child path were hardened the same way.allow_broadcasts/preserve_mention_tokens` still honored.Regression check:
## <!channel>→*<!channel>*.Correctness fixes
SplitTextno longer cuts inside a multi-byte UTF-8 rune for un-breakable tokens (long CJK runs, non-ASCII URLs) — the hard-cut steps back to a rune boundary. Fuzz target gained multibyte seeds + autf8.ValidStringinvariant.section.mrkdwnfallback truncation is rune-safe and strips a dangling\that could escape the closing*.Validator completeness
Per-element rules added against verified Slack limits: buttons (text/value/url/action_id), context blocks (≤10 elements), table blocks (≤100 rows / ≤20 cols / ≤20 column_settings), image titles (≤2000), section accessories. New surface-aware
ValidateForSurface(modal/home → 100-block ceiling).New features
block_kit_to_markdown— 6th MCP tool, inverse conversion (newinternal/reversepackage; lossy, reports warnings).readOnlyHint,openWorldHint, titles) on all 6 tools.block-kit-cheatsheetMCP resource +format_for_slackMCP prompt.surfaceinput onvalidate_block_kit/lint_block_kit.Hardening / hygiene
Options.MaxNestingDepth(default 100) →ErrInputTooDeeplyNested;MaxInputBytesbounds bytes, not structural depth.return_preview_urlis now a real opt-out (*bool); unknownsplitvalues rejected; non-loopback bind warning.slack-go/slackv0.23.0 → v0.23.1.Verification
make test-race— all packages pass, coverage 80.0–95.9% (overall ~88%)make lint0 issues ·make vetclean ·make vulncleanmake fuzz30s — 1.3M execs, no UTF-8 invariant violationsinternal/reverseat 87.5%CHANGELOG
[0.3.0]section is in place for the GoReleaser flow.