Skip to content

Conversation

@elianddb
Copy link
Contributor

@elianddb elianddb commented Aug 4, 2025

Fixes dolthub/dolt#9624
Fixed wildcard user authentication that was failing with "No authentication methods available for authentication" error for patterns like 'user'@'127.0.0.%'.

elianddb and others added 2 commits August 4, 2025 17:30
- Add matchesHostPattern function to handle MySQL wildcard patterns like '127.0.0.%'
- Modify GetUser to check both normalized host and original host against patterns
- Use regex matching where % is converted to .* for proper wildcard matching
- Fixes issue where users with wildcard hostnames (e.g., 'user'@'10.0.0.%')
  would fail authentication with 'No authentication methods available'

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- TestMatchesHostPattern: Tests the new matchesHostPattern function with various patterns
- TestGetUserWithWildcardAuthentication: Tests the GetUser function with wildcard patterns
- Covers IP wildcards, hostname wildcards, and edge cases
- All tests pass and verify the fix works correctly

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link
Contributor

@angelamayxie angelamayxie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just some minor changes in the test file

elianddb and others added 2 commits August 4, 2025 19:50
- Simplify error handling with single return statement
- Avoid redundant matchesHostPattern calls when originalHost == host
- Reduce verbose comments for cleaner code
- Maintain same functionality with better performance

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…uthentication

Enhanced the integration test with 17 additional test cases covering:
- IP wildcard patterns (127.0.0.%, 192.168.1.%)
- Hostname wildcard patterns (%.example.com)
- Global wildcard pattern (%)
- Customer scenario reproduction
- Both positive and negative test cases

Tests verify that wildcard user authentication works correctly for various
patterns that were previously failing with "No authentication methods available".

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@elianddb elianddb force-pushed the elianddb/9624-fix-wildcard-user-auth branch from 72d077f to 0e747f1 Compare August 4, 2025 19:51
@elianddb elianddb merged commit 466cdf1 into main Aug 4, 2025
8 checks passed
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.

Wildcard user authentication doesn't work

3 participants