LuanaMihailescu opened a new pull request, #4568:
URL: https://github.com/apache/flink-cdc/pull/4568

   <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements.  See the NOTICE file
   distributed with this work for additional information
   regarding copyright ownership.  The ASF licenses this file
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
   
     http://www.apache.org/licenses/LICENSE-2.0
   
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
   -->
   
   ## What is the purpose of this pull request?
   
   This PR fixes the encoding of MongoDB credentials containing spaces.
   
   `MongoDBEnvelope.encodeValue()` currently relies on `URLEncoder`, which 
encodes spaces as `+` according to `application/x-www-form-urlencoded` 
semantics. However, MongoDB connection URIs expect spaces to be percent-encoded 
as `%20`.
   
   This change ensures that spaces are encoded as `%20`, preventing 
authentication issues when usernames or passwords contain spaces.
   
   JIRA: FLINK-40957
   
   ## Brief change log
   
   - Updated `MongoDBEnvelope.encodeValue()` to encode spaces as `%20` instead 
of `+`
   - Added a unit test covering values that contain spaces
   
   ---
   
   ## Verifying this change
   
   This change added tests and can be verified as follows:
   
   - Added unit tests in `MongoDBEnvelopeTest`
   - Verified that `MongoDBEnvelope.encodeValue("my pass")` returned `my+pass` 
before the fix
   - Verified that `MongoDBEnvelope.encodeValue("my pass")` returns `my%20pass` 
after the fix
   
   ## Documentation
   
   - Does this pull request introduce a new feature? **No**
   
   ---
   
   ##### Was generative AI tooling used to co-author this PR?
   
   <!--
   If generative AI tooling has been used in the process of authoring this PR, 
please
   change the checkbox below to `[X]` followed by the name of the tool, and 
uncomment the
   "Generated-by" line. See the ASF Generative Tooling Guidance for details:
   https://www.apache.org/legal/generative-tooling.html
   
   You are responsible for the quality and correctness of every change in this 
PR
   regardless of the tooling used. Low-effort AI-generated PRs will be closed.
   -->
   
   - [ ] Yes (please specify the tool below)
   
   <!--
   Generated-by: [Tool Name and Version]
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to