Skip to content

E2E test: SASL mechanism validation — unsupported mechanism rejection#313

Closed
s2x wants to merge 1 commit intomainfrom
oda-148-e2e-test-sasl-mechanism-validation-unsup
Closed

E2E test: SASL mechanism validation — unsupported mechanism rejection#313
s2x wants to merge 1 commit intomainfrom
oda-148-e2e-test-sasl-mechanism-validation-unsup

Conversation

@s2x
Copy link
Copy Markdown
Contributor

@s2x s2x commented Mar 30, 2026

Closes #148

Problem

No E2E test verifies that the server correctly rejects an unsupported SASL mechanism. The ConnectionHandshakeTest only tests PLAIN authentication. If a client sends a mechanism name the server doesn't support (e.g. "SCRAM-SHA-256", "EXTERNAL", or an empty string ""), the server should respond with SASL_MECHANISM_NOT_SUPPORTED (0x07).

Expected test

public function testUnsupportedSaslMechanismThrows(): void
{
    $connection = $this->createConnection();
    $connection->sendMessage(new PeerPropertiesToStreamBufferV1());
    $connection->readMessage();
    $connection->sendMessage(new SaslHandshakeRequestV1());
    $connection->readMessage();

    $this->expectException(\Exception::class);
    $connection->sendMessage(new SaslAuthenticateRequestV1('SCRAM-SHA-256', 'guest', 'guest'));
    $connection->readMessage(timeout: 2.0);
}

Why it matters

  • Validates that the client library correctly propagates SASL errors
  • Ensures ResponseCodeEnum::SASL_MECHANISM_NOT_SUPPORTED path is exercised
  • Security: confirms the server enforces mechanism restrictions

Acceptance criteria

  • Test with a non-existent SASL mechanism name → exception thrown
  • Test with empty string mechanism → exception thrown
  • Verify the exception message contains meaningful error info

Add tests to verify server correctly rejects unsupported SASL mechanisms:
- testUnsupportedSaslMechanismThrows: tests with SCRAM-SHA-256
- testEmptySaslMechanismThrows: tests with empty string

Both tests verify the exception message contains SASL_MECHANISM_NOT_SUPPORTED.
@s2x s2x closed this Mar 30, 2026
@s2x s2x deleted the oda-148-e2e-test-sasl-mechanism-validation-unsup branch March 30, 2026 14:28
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.

E2E test: SASL mechanism validation — unsupported mechanism rejection

1 participant