Skip to content

Conversation

@Zjianru
Copy link
Contributor

@Zjianru Zjianru commented Feb 9, 2026

Description

This PR removes the unnecessary pattern check for password in ConfigValidationUtils.checkParameterName.

Problem:
Previously, checkParameterName validated all parameters (except backup) using PATTERN_NAME_HAS_SYMBOL, which disallowed many special characters commonly used in passwords (e.g., @, !, #). This caused issues when using Nacos with complex passwords configured via parameters.

Fix:
Added PASSWORD_KEY to the ignoreCheckKeys list in checkParameterName, ensuring passwords are exempted from pattern validation (length check in validateRegistryConfig remains).

Fixes: #16073

描述 (Chinese)

修复 ConfigValidationUtils 中对 password 参数进行不必要的正则校验问题。

问题:
此前 checkParameterName 会对所有参数(除 backup 外)使用 PATTERN_NAME_HAS_SYMBOL 进行校验,该正则不支持密码中常见的特殊字符(如 @!#),导致 Nacos 等注册中心使用复杂密码时校验失败。

修复:
PASSWORD_KEY 加入 checkParameterName 的忽略列表,跳过正则检查(长度检查仍保留)。

修复: #16073

@Zjianru
Copy link
Contributor Author

Zjianru commented Feb 9, 2026

Reasoning for the fix

I've added PASSWORD_KEY to the ignore list to align with how password is handled in validateRegistryConfig.

In validateRegistryConfig, the password field is only checked for length (checkLength), not for pattern (checkProperty with null pattern). However, checkParameterName enforces PATTERN_NAME_HAS_SYMBOL on all parameters, which unintentionally forbids special characters (like @, !) in passwords when they are passed via the parameters map.

By ignoring it here, we allow complex passwords to pass.

Note: This effectively skips the length check for password in parameters as well (similar to how BACKUP_KEY is handled). Given that password usually originates from RegistryConfig (where it is checked for length) or is a raw string, prioritizing usability (allowing special chars) over strict length validation in this utility method seems appropriate.


修复逻辑说明

我将 PASSWORD_KEY 加入了忽略列表,以对齐 validateRegistryConfig 中对密码的处理逻辑。

validateRegistryConfig 中,password 字段仅检查长度 (checkLength),而不检查正则模式。然而,checkParameterName 强制对所有参数使用 PATTERN_NAME_HAS_SYMBOL 进行校验,这导致通过 parameters map 传递密码时,包含特殊字符(如 @, !)的复杂密码会被拒绝。

通过在此处忽略校验,可以支持复杂密码。

:这样做同时也跳过了参数中密码的长度检查(类似于 BACKUP_KEY 的处理方式)。考虑到密码通常来自 RegistryConfig(那里已有长度检查),或者作为原始字符串传递,在此工具方法中优先保证可用性(允许特殊字符)比严格的长度校验更重要。

@codecov-commenter
Copy link

codecov-commenter commented Feb 9, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.78%. Comparing base (678d2a7) to head (846def8).

Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16082      +/-   ##
============================================
+ Coverage     60.74%   60.78%   +0.04%     
+ Complexity    11751       15   -11736     
============================================
  Files          1953     1953              
  Lines         89120    89121       +1     
  Branches      13443    13443              
============================================
+ Hits          54132    54176      +44     
+ Misses        29420    29379      -41     
+ Partials       5568     5566       -2     
Flag Coverage Δ
integration-tests-java21 32.17% <100.00%> (+0.05%) ⬆️
integration-tests-java8 32.25% <100.00%> (+<0.01%) ⬆️
samples-tests-java21 32.17% <100.00%> (+<0.01%) ⬆️
samples-tests-java8 29.75% <100.00%> (+0.02%) ⬆️
unit-tests-java11 59.07% <100.00%> (+0.07%) ⬆️
unit-tests-java17 58.56% <100.00%> (+0.08%) ⬆️
unit-tests-java21 58.56% <100.00%> (+0.07%) ⬆️
unit-tests-java25 58.51% <100.00%> (+0.04%) ⬆️
unit-tests-java8 59.06% <100.00%> (+0.07%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Contributor

@zrlw zrlw left a comment

Choose a reason for hiding this comment

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

LGTM

@RainYuY RainYuY merged commit 06334a5 into apache:3.3 Feb 10, 2026
33 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.

4 participants