apache / apache/fluss

Fix SASL client special characters escaping

Open
#2,698 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.1k
Forks
625
Avg merge
3d 14h
Merged PRs (30d)
97

Description

### Search before asking

- [x] I searched in the [issues](https://github.com/apache/fluss/issues) and found nothing similar.

### Fluss version

main (development)

### Please describe the bug 🐞

When using special characters (e.g, `"`) in the SASL authentication mechanism, the client SASL parser fails.

For example, a failing test for [`SaslClientAuthenticator`](https://github.com/apache/fluss/blob/main/fluss-common/src/main/java/org/apache/fluss/security/auth/sasl/authenticator/SaslClientAuthenticator.java):

```java
@Test
void testSpecialCharactersForPassword() throws Exception {
final String specialPassword = "pa$$wo\\rd!@#%&\"";
final Configuration clientConfig = new Configuration();
clientConfig.setString("client.security.protocol", "sasl");
clientConfig.setString("client.security.sasl.username", "admin");
clientConfig.setString("client.security.sasl.password", specialPassword);
testAuthentication(clientConfig, getDefaultServerConfig());
}
```

### Solution

The first solution would be to properly escape username and password on here: [`SaslClientAuthenticator.java#L64`](https://github.com/apache/fluss/blob/main/fluss-common/src/main/java/org/apache/fluss/security/auth/sasl/authenticator/SaslClientAuthenticator.java#L64)

In general it would be nice to have utility to escape special characters.

We should check for similar issues on the server side. The fix should introduce proper failing tests for special characters.

### Are you willing to submit a PR?

- [x] I'm willing to submit a PR!

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with fluss-common/src/main/java/org/apache/fluss/security/auth/sasl/authenticator/SaslClientAuthenticator.java around the username and password handling. Add or run the special-character authentication test described in the issue, then check whether equivalent server-side handling needs coverage. Done means authentication succeeds with the supplied special characters and the relevant tests pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authentication, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.