Skip to content

v1.2.0 — Correctness & performance

Latest

Choose a tag to compare

@ahvega ahvega released this 21 Jul 20:29

Fixes defects found in a multi-reviewer audit (Codex, Gemini/agy, Sourcery). This release also carries the v1.1.1 security fixes, which were never tagged separately — if you are on 1.0.0 or 1.1.0, upgrade.

🔒 Security (from 1.1.1)

The wp_read_tools_get_content AJAX endpoint is registered for logged-out users, so it is reachable by anonymous remote callers.

  • Password-protected posts could be read without the password. The endpoint gated only on post_status === 'publish', but password-protected posts keep that status — protection lives in post_password. Access control now combines a post-type allowlist, is_post_publicly_viewable() and post_password_required()
  • Non-public post types stored as publish (reusable blocks, field groups, private CPTs) were readable by enumerating post IDs
  • The cache lookup ran before the access check, serving cached bodies without authorization
  • Rate limiting ran before nonce verification, letting nonce-less requests write database rows
  • X-Forwarded-For / CF-Connecting-IP were trusted unconditionally. Rotating the header bypassed the rate limit; setting it to a third party's address locked that person out. Now gated behind wp_read_tools_trusted_proxies and parsed right-to-left
  • Rate limiting silently disabled itself on containerised/load-balanced installs where the peer address is private
  • Added wp_read_tools_max_content_length (default 500 KB), truncated on character boundaries

🐛 Correctness

  • The plugin's icons had never rendered on a stock install. The Font Awesome conflict check included dashicons, which WordPress core registers unconditionally — so the check always matched and the icon stylesheet was never enqueued. FA6 class names now recognised too
  • Reading times were overstated by ~10–15% in Spanish, French, Portuguese and German. str_word_count() is byte-oriented and split every accented word — canción counted as two. Digits were never counted at all
  • Posts opening with a one-letter word were corrupted — A mi me gusta was spoken and counted as Ami me gusta. Affects A, Y, O, E in Spanish and "I" in English. Drop-caps are now matched by name, which also repairs every occurrence rather than only the first
  • Citation markers [1], [15] were deleted from spoken text and word counts
  • ' apostrophes were read aloud character by character;   leaked into speech
  • Content imported from older latin1 installs could silently yield empty speech and "0.0 min read"
  • Two read-aloud links on one page could permanently wedge the UI — pausing one and clicking the other resumed the first while leaving the second stuck on "Pause", unrecoverable without a reload
  • Chrome could queue and speak an article two or three times (voice-loading handler fired repeatedly and was never detached)
  • Links added after page load (infinite scroll, AJAX archives) had no click handler

⚡ Performance

  • Removed a database write that ran on every uncached page view, by every anonymous visitor, during shortcode render — each one also invalidating that post's entire meta cache
  • Removed 412 lines of unreachable page-builder extraction code

Changed

  • Very short posts now read "0.5 min read" instead of "0.0 min read"
  • The content_id shortcode attribute is a deprecated no-op. It is still accepted so existing shortcodes are unaffected, but its only consumer never executed and was removed

⚠️ Before upgrading

This plugin has no automated tests and no CI. Changes were verified by static analysis, a standalone regex harness, and three independent code reviews — but not against a running WordPress install. Worth checking by hand after upgrading:

  1. Font Awesome now actually enqueues from cdnjs. Confirm it does not double-load against your theme; use wp_read_tools_load_fontawesome to disable if it does
  2. Reading-time numbers change on every post (the word count is now correct). Verify they look sane, especially on Avada sites
  3. If you read aloud a custom post type registered publicly_queryable => false, opt in via wp_read_tools_allowed_post_types

Known limitations

Documented rather than silently shipped: [sic] and markdown link text are still stripped by the shortcode pattern; long articles are not chunked, so Chrome's ~15s network-voice cutoff still truncates them; Font Awesome is loaded from a CDN with no SRI; the read-aloud trigger is an <a href="#"> without role="button"/aria-live.

Installation

Download wp-read-tools-1.2.0.zip and install via Plugins → Add New → Upload Plugin, or extract into /wp-content/plugins/.