You've already forked wp-bootstrap
Security audit fixes: regex hardening, performance, and code quality (v1.1.2)
- WidgetRenderer: single regex for h2→h4 prevents mismatched tags - ContextBuilder: O(n) comment tree with parent-indexed lookup map - ContextBuilder: consolidated sidebar queries into single check - ContextBuilder: transient caching for sidebar recent posts and tags - functions.php: hex-to-RGB consolidation, type hints, ctype_xdigit validation - Transient invalidation hooks for save_post and tag CRUD operations Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
16
CHANGELOG.md
16
CHANGELOG.md
@@ -2,6 +2,22 @@
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
## [1.1.2] - 2026-03-01
|
||||
|
||||
### Security
|
||||
|
||||
- **WidgetRenderer regex hardening**: Combined two separate `preg_replace` calls for h2→h4 heading downgrade into a single regex that only matches `<h2>` elements with the `wp-block-heading` class. The previous approach replaced all `</h2>` tags unconditionally, risking mismatched tags if a widget contained non-block h2 elements.
|
||||
|
||||
### Performance
|
||||
|
||||
- **O(n) comment tree building** (`ContextBuilder`): Replaced O(n²) recursive scan with a parent-indexed lookup map built in a single pass. Each recursion level now iterates only direct children instead of all comments.
|
||||
- **Consolidated sidebar queries** (`ContextBuilder`): Merged three separate sidebar detection branches (`is_home`, `is_page`+sidebar, `is_singular` post) into a single boolean check with one `getSidebarData()` call, eliminating up to 2 redundant calls per request.
|
||||
- **Transient caching for sidebar data** (`ContextBuilder`): `getSidebarRecentPosts()` and `getSidebarTags()` results cached in WordPress transients (1 hour TTL). Invalidation hooks on `save_post` (recent posts) and `create/edit/delete_post_tag` (tags).
|
||||
|
||||
### Changed
|
||||
|
||||
- **Hex-to-RGB consolidation** (`functions.php`): `wp_bootstrap_hex_to_rgb()` now delegates to `wp_bootstrap_hex_to_rgb_array()` instead of duplicating hex parsing logic. Added `ctype_xdigit()` validation and return type hints to all color utility functions.
|
||||
|
||||
## [1.1.1] - 2026-02-28
|
||||
|
||||
### Added
|
||||
|
||||
Reference in New Issue
Block a user