Skip to content

[Security] Harden distributed database query result resolution - #15661

Merged
KomachiSion merged 1 commit into
alibaba:developfrom
KomachiSion:codex/validate-select-request-targets
Aug 6, 2026
Merged

KomachiSion merged 1 commit into
alibaba:developfrom
KomachiSion:codex/validate-select-request-targets

Conversation

@KomachiSion

Copy link
Copy Markdown
Collaborator

What is the purpose of the change

Distributed embedded database read requests carry a result className. The receiver previously resolved scalar result classes from the request through dynamic class loading and did not reject unknown row mapper names before JDBC execution.

This change constrains result resolution to known targets and makes every distributed row mapper available on receiving nodes before requests are served.

No public GitHub issue is linked because this is a security-hardening change, and the Nacos contribution guidance directs security reports away from public issues.

Brief changelog

  • Resolve scalar query results only from the exact supported basic types: Integer, Long, and String.
  • Accept mapper query results only when their class name is registered in RowMapperManager.
  • Replace the two AI resource lambda mappers with named implementations and register them eagerly.
  • Initialize the existing Auth row mapper registrations during embedded-storage startup.
  • Document the distributed embedded read-target validation contract in the English and Chinese persistence specs.

Verifying this change

  • mvn -B -pl core,ai,plugin-default-impl/nacos-default-auth-plugin clean compile apache-rat:check checkstyle:check spotbugs:check spotless:check -e -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn
  • mvn -pl core -Dtest=DistributedDatabaseOperateImplTest test (30 tests)
  • mvn -pl ai -Dtest=AiResourceRowMappersTest,EmbeddedAiResourcePersistServiceImplTest,EmbeddedAiResourceVersionPersistServiceImplTest test (15 tests)
  • mvn -pl plugin-default-impl/nacos-default-auth-plugin -Dtest=AuthRowMapperManagerTest,NacosAuthPluginPersistenceConfigTest test (7 tests)

Follow this checklist to help us incorporate your contribution quickly and easily:

  • Make sure there is a Github issue filed for the change. Not applicable: this PR is a security-hardening change and intentionally has no public issue.
  • Each commit in the pull request has a meaningful subject line and body.
  • The pull request description explains what the change does, how, and why.
  • Necessary unit tests cover valid registered targets and rejected unknown targets.
  • The affected-module compile, RAT, Checkstyle, SpotBugs, Spotless, and unit-test checks pass locally.

Validate SelectRequest result targets and eagerly register distributed row mappers.

Assisted-by: Claude Code
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Thanks for your this PR. 🙏
Please check again for your PR changes whether contains any usage/api/configuration change such as Add new API , Add new configuration, Change default value of configuration.
If so, please add or update documents(markdown type) in docs/next/ for repository nacos-group/nacos-group.github.io


感谢您提交的PR。 🙏
请再次查看您的PR内容,确认是否包含任何使用方式/API/配置参数的变更,如:新增API、新增配置参数、修改默认配置等操作。
如果是,请确保在提交之前,在仓库nacos-group/nacos-group.github.io中的docs/next/目录下添加或更新文档(markdown格式)。

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.83051% with 6 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...re/persistence/DistributedDatabaseOperateImpl.java 76.47% 3 Missing and 1 partial ⚠️
...os/ai/service/repository/AiResourceRowMappers.java 95.12% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@KomachiSion KomachiSion added area/A2A kind/enhancement Category issues or prs related to enhancement. area/plugin and removed area/A2A labels Aug 6, 2026
@KomachiSion KomachiSion added this to the 3.2.4 milestone Aug 6, 2026
@KomachiSion
KomachiSion merged commit e9b1b81 into alibaba:develop Aug 6, 2026
7 checks passed
@KomachiSion
KomachiSion deleted the codex/validate-select-request-targets branch August 10, 2026 02:06
KomachiSion added a commit that referenced this pull request Aug 10, 2026
Validate SelectRequest result targets and eagerly register distributed row mappers.

Assisted-by: Claude Code
(cherry picked from commit e9b1b81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/plugin kind/enhancement Category issues or prs related to enhancement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants