security: REST PoW parity, unified failure message, accurate auth docs and tests - #2
Merged
Merged
Conversation
…transport quirks, accurate REST docs
…fied excludes, shared e2e fixtures
This was referenced Sep 3, 2026
architecture: extract Cardea_Comment_Gate, single version source, unified excludes, shared e2e fixtures
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.
Fixes the security findings from the review in #1 (S1, S2, S3, S4, S6).
Changes
S2 — REST API parity (
includes/class-cardea-core.php): anonymous REST comment submissions were skipping the PoW gate.rest_pre_insert_commentnow enforces the identical pipeline (exempt comment types, nonce, challenge verification, replay check) as the comment form, with shared param extraction/sanitization (get_sanitized_rest_param).S3 — difficulty filter honored at verify time:
cardea_difficultyis now resolved through the filter in the verification path, so runtime overrides apply consistently.S4 — unified failure message: all verification failures surface the same generic message (
die_on_verification_failure()); per-cause codes are no longer leaked to the client.S1 + S6 — accurate documentation and verified tests: readme "Smart Pathway" and FAQ now state the actually-verified behavior for REST and XML-RPC. New/updated tests assert the real behavior:
/wp/v2/commentsare rejected by WordPress core with401 rest_comment_login_requiredbefore Cardea's filter runs (verified in e2e, with and without PoW fields) — Cardea's REST gate is defense-in-depth and is exercised directly in PHPUnit.wp.*comment methods are rejected by core; pingbacks trackbacks bypass PoW by design. Updated spec asserts the rejection/fault set (Playground's WASM transport is nondeterministic forxmlrpc.phptext/xml POSTs: it can returnXML-RPC server accepts POST requests only.or a fault body).Pushback (per #1)
wp.newCommentis rejected for anonymous callers), so there is nothing to block. Implementing a blanket XML-RPC block would instead break the intentional pingback bypass. Delivered: honest docs + a test that pins both behaviors.Test evidence
Full suite green (Docker,
make test+make lint):