Skip to content

Stop password-protected and private articles leaking to visitors - #81

Merged
ajaydsouza merged 5 commits into
masterfrom
claude/password-protected-article-disclosure-y3o813
Oct 12, 2026
Merged

ajaydsouza merged 5 commits into
masterfrom
claude/password-protected-article-disclosure-y3o813

Conversation

@ajaydsouza

@ajaydsouza ajaydsouza commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Free-tier sync of WebberZone/knowledgebase-pro#38. The changed files under includes/ and phpunit/tests/ are identical to the Pro branch; Pro-only files are left out.

Fixes the reported unauthenticated disclosure of password-protected Knowledge Base articles (CVSS 5.3) and the related leaks.

Changes

  • REST API: protected articles return an empty excerpt and content until the visitor enters the password, with a protected flag on every item. Responses containing protected articles are never cached; the list endpoint only returns published articles. /wzkb/v1/related no longer caches and now honours post_id and limit. Cache keys are versioned so 3.2.0 entries are never read.
  • [kbtoc] shortcode: renders nothing for a locked article (new TOC::is_post_locked()).
  • Thumbnails: skip the content scan and attached images of locked articles.
  • Related articles and listings: published articles only; no excerpts for locked articles.
  • Caching: section listings use the persistent content version in Util\Cache, so they refresh when an article gains a password and still cache without a persistent object cache.
  • Readme: 3.2.1 Security and Fixed entries without Pro-only fixes, and the upgrade notice.

Testing

  • CI green across PHP 7.4 to 8.6, PHPCS and PHP compatibility.
  • PHPUnit: 24/24, including phpunit/tests/test-rest-password-protection.php.
  • HTTP leak checks run against the free plugin as well as Pro.

Notes

  • Follows WebberZone/knowledgebase-pro#38.

The /wzkb/v1/knowledgebase, /wzkb/v1/knowledgebase/{id} and /wzkb/v1/search
endpoints returned the content and excerpt of password-protected articles
without the password. Return an empty excerpt and content when
post_password_required() is true, add a 'protected' flag like core, and skip
caching responses that include password-protected posts so an unlocked
response is never served to another requester.
… Help widget

The table of contents renderers that sit outside the article body (the
[kbtoc] shortcode, the floating TOC, the docs layout outline, and the TOC
widget and block) built their outline from the raw content of a
password-protected article before the password was entered. Add
TOC::is_post_locked() and return nothing from each renderer when the post is
locked, while keeping the TOC in the editor preview for users who can edit
the post.

Also blank the Help widget's manual excerpt for locked suggested articles,
skip the thumbnail content scan for locked posts, and version the REST cache
keys so responses cached by 3.2.0 are never served again.
Key the section listing cache to the persistent content version in
Util\Cache instead of wp_cache_get_last_changed( 'posts' ), which changes on
every request without a persistent object cache. Add the remaining
password-protection fixes to the changelog, without Pro-only fixes.
@ajaydsouza
ajaydsouza merged commit 8d89551 into master Oct 12, 2026
36 checks passed
@ajaydsouza
ajaydsouza deleted the claude/password-protected-article-disclosure-y3o813 branch October 12, 2026 19:29
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.

1 participant