Skip to content

fix(naming): 添加分页参数验证#14616

Merged
KomachiSion merged 1 commit into
alibaba:developfrom
1lck:fix/input-parameter-validation
Mar 18, 2026
Merged

fix(naming): 添加分页参数验证#14616
KomachiSion merged 1 commit into
alibaba:developfrom
1lck:fix/input-parameter-validation

Conversation

@1lck

@1lck 1lck commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

What is the purpose of the change

在实例列表查询接口中补充分页参数校验,避免非法的 pageNopageSize 参数直接进入后续处理流程。

当前 ConsoleInstanceController#getInstanceList 中已经调用了 instanceForm.validate() 对实例查询相关参数进行校验,但没有调用 pageForm.validate() 对分页参数进行校验。项目中的其他分页查询接口通常都会在处理前执行该校验,因此这里存在一致性缺失的问题。

本次修改通过在实例列表查询接口中增加 pageForm.validate() 调用,使该接口能够在入口处提前拦截非法分页参数,保持与其他 controller 的处理方式一致,并提升接口参数校验的完整性。

Brief changelog

  • 在实例列表查询接口中增加 pageForm.validate() 验证调用
  • 确保分页参数在处理前进行有效性检查
  • 保持该接口与其他分页查询接口的参数校验逻辑一致

Verifying this change

  • 代码层面确认 ConsoleInstanceController#getInstanceList 在调用 instanceProxy.listInstances(...) 前新增了 pageForm.validate()
  • 校验逻辑复用 PageForm 现有实现,无新增行为分支,仅补齐遗漏的入口校验
  • 可通过传入非法分页参数(如 pageNo=0pageSize=0)验证接口会提前返回参数错误,而不是继续进入后续处理流程

- 在实例列表查询接口中增加 pageForm.validate() 验证调用
- 确保分页参数在处理前进行有效性检查
@github-actions

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格式)。

@KomachiSion
KomachiSion merged commit 4042231 into alibaba:develop Mar 18, 2026
4 checks passed
@KomachiSion KomachiSion added kind/bug Category issues or prs related to bug. area/Naming labels Mar 18, 2026
@KomachiSion KomachiSion added this to the 3.2.0 milestone Mar 18, 2026
@wuyfee

wuyfee commented Mar 18, 2026

Copy link
Copy Markdown

$\color{red}{FAILURE}$
DETAILS
✅ - docker: success
❌ - deploy (standalone & cluster & standalone_auth): failure
❌ - e2e-java-test (standalone & cluster & standalone_auth): skipped
❌ - e2e-go-test (standalone & cluster): skipped
❌ - e2e-cpp-test (standalone & cluster): skipped
❌ - e2e-csharp-test (standalone & cluster): skipped
❌ - e2e-nodejs-test (standalone & cluster): skipped
❌ - e2e-python-test (standalone & cluster): skipped
✅ - clean (standalone & cluster & standalone_auth): success

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

KomachiSion added a commit that referenced this pull request Mar 19, 2026
* Add core coverage (#14608)

* test(core-utils): remove unused method and add comprehensive unit tests.

* test(web): add unit tests for NacosCoreWebConfiguration and NacosWebServerListener。

* test(core): add unit tests for parts of remote package.

* add core unit test coverage (#14618)

* test(core): add unit tests for plugin forms and prompt request extractor.

* test(core): add unit tests for remote param check and connection ejector.

* fix(naming): 添加分页参数验证 (#14616)

- 在实例列表查询接口中增加 pageForm.validate() 验证调用
- 确保分页参数在处理前进行有效性检查

* test(auth): add and improve unit tests for auth module. (#14619)

* [ISSUE #14622] fix: exclude json-schema-validator 3.0.0 from agentscope-core to resolve NoClassDefFoundError (#14625)

agentscope-core:1.0.7 directly depends on json-schema-validator:3.0.0 (Jackson 3),
which overrides the 1.5.7 version required by mcp-json-jackson2:0.14.1 (Jackson 2).
This causes NoClassDefFoundError for SpecVersion$VersionFlag when using the
'Auto import from MCP Server' feature, since SpecVersion.VersionFlag was renamed
to SpecificationVersion in json-schema-validator 2.0.0+.

Excluding json-schema-validator from agentscope-core allows mcp's transitive
dependency (1.5.7) to take effect, resolving the conflict.

* test(consistency): add unit tests for serializers, processors and utils. (#14628)

* fix(health): update health status method to handle persistent instances correctly (#14635)

* Refactor database plugins and update CI report paths (#14640)

* refactor(plugin): Refactor default database plugin, split database plugins and move depend jdbc to plugins dir.

* fix(ci): update JaCoCo report paths for datasource plugins in CI workflow

* fix(pom): update maven-antrun-plugin version and correct task tags

* chore(db): remove derby and mysql schemas, add AI resource mappers.

---------

Co-authored-by: Lichenkang <2188718831@qq.com>
Co-authored-by: Sunrisea <1336317033@qq.com>
KomachiSion added a commit that referenced this pull request Mar 19, 2026
* Add core coverage (#14608)

* test(core-utils): remove unused method and add comprehensive unit tests.

* test(web): add unit tests for NacosCoreWebConfiguration and NacosWebServerListener。

* test(core): add unit tests for parts of remote package.

* add core unit test coverage (#14618)

* test(core): add unit tests for plugin forms and prompt request extractor.

* test(core): add unit tests for remote param check and connection ejector.

* fix(naming): 添加分页参数验证 (#14616)

- 在实例列表查询接口中增加 pageForm.validate() 验证调用
- 确保分页参数在处理前进行有效性检查

* test(auth): add and improve unit tests for auth module. (#14619)

* [ISSUE #14622] fix: exclude json-schema-validator 3.0.0 from agentscope-core to resolve NoClassDefFoundError (#14625)

agentscope-core:1.0.7 directly depends on json-schema-validator:3.0.0 (Jackson 3),
which overrides the 1.5.7 version required by mcp-json-jackson2:0.14.1 (Jackson 2).
This causes NoClassDefFoundError for SpecVersion$VersionFlag when using the
'Auto import from MCP Server' feature, since SpecVersion.VersionFlag was renamed
to SpecificationVersion in json-schema-validator 2.0.0+.

Excluding json-schema-validator from agentscope-core allows mcp's transitive
dependency (1.5.7) to take effect, resolving the conflict.

* test(consistency): add unit tests for serializers, processors and utils. (#14628)

* fix(health): update health status method to handle persistent instances correctly (#14635)

* Refactor database plugins and update CI report paths (#14640)

* refactor(plugin): Refactor default database plugin, split database plugins and move depend jdbc to plugins dir.

* fix(ci): update JaCoCo report paths for datasource plugins in CI workflow

* fix(pom): update maven-antrun-plugin version and correct task tags

* chore(db): remove derby and mysql schemas, add AI resource mappers.

---------

Co-authored-by: Lichenkang <2188718831@qq.com>
Co-authored-by: Sunrisea <1336317033@qq.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/Naming kind/bug Category issues or prs related to bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants