Skip to content

Commit df186fc

Browse files
committed
test[faustwp]: clarify 'bad patterns' comment in hash_equals source guard
Per Copilot review: the comment said 'three bad patterns' but only two assertStringNotContainsString calls follow. The original #2312 fix replaced ===/!== at three call sites (rest_authorize_permission_callback, wpac_authorize_permission_callback, filter_introspection), but the two REST sites share the literal '=== $header_key' shape, so a single substring check covers both. Reword to match what's actually asserted.
1 parent 435fe57 commit df186fc

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

plugins/faustwp/tests/integration/RestCallbacksTests.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ public function test_secret_comparisons_use_constant_time_hash_equals(): void {
150150
$this->assertNotFalse( $rest_callbacks, 'Failed to read includes/rest/callbacks.php for regression guard.' );
151151
$this->assertNotFalse( $graphql_callbacks, 'Failed to read includes/graphql/callbacks.php for regression guard.' );
152152

153-
// The three bad patterns this PR replaces:
153+
// The bad comparison shapes this PR replaces (two distinct patterns, three
154+
// call sites: '=== $header_key' covers both rest_authorize_permission_callback
155+
// and wpac_authorize_permission_callback; '!== $_SERVER[...]' covers
156+
// filter_introspection):
154157
$this->assertStringNotContainsString( '=== $header_key', $rest_callbacks,
155158
'rest_authorize_permission_callback must use hash_equals(), not ===.' );
156159
$this->assertStringNotContainsString( "!== \$_SERVER['HTTP_X_FAUST_SECRET']", $graphql_callbacks,

0 commit comments

Comments
 (0)