Skip to content

fix: make password field optional when adding data source#601

Open
LordofAvernus wants to merge 1 commit intomainfrom
dms/fix-2738
Open

fix: make password field optional when adding data source#601
LordofAvernus wants to merge 1 commit intomainfrom
dms/fix-2738

Conversation

@LordofAvernus
Copy link
Copy Markdown
Collaborator

@LordofAvernus LordofAvernus commented Apr 23, 2026

User description

Summary

  • Remove validate:"required" from Password field in DBService API (v1 and v2) to support data sources that may not require password authentication

Fixes https://github.com/actiontech/sqle-ee/issues/2738


Description

  • 修改 v1 中密码字段校验设置

  • 修改 v2 中密码字段校验设置

  • 使密码字段变为可选


Diagram Walkthrough

flowchart LR
  v1["\"v1 接口密码字段修改\""]
  v2["\"v2 接口密码字段修改\""]
  v1 -- "移除 validate required" --> v2
Loading

File Walkthrough

Relevant files
Bug fix
db_service.go
v1 接口密码字段设置修改                                                                                       

api/dms/service/v1/db_service.go

  • 移除密码字段的 validate:"required"
  • 修改注释由 "Required: true" 为 "Required: false"
+2/-2     
db_service.go
v2 接口密码字段设置修改                                                                                       

api/dms/service/v2/db_service.go

  • 移除密码字段的 validate:"required"
  • 修改注释由 "Required: true" 为 "Required: false"
+2/-2     

@actiontech-bot actiontech-bot requested a review from iwanghc April 23, 2026 08:33
@github-actions
Copy link
Copy Markdown

PR Reviewer Guide 🔍

⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@github-actions
Copy link
Copy Markdown

PR Code Suggestions ✨

Explore these optional code suggestions:

CategorySuggestion                                                                                                                                    Impact
General
添加 omitempty 修饰符

建议在 JSON 标签中添加 omitempty 属性以在密码为空时省略该字段,防止因空字符串而误传敏感信息。此修改有助于数据传输时更加准确和安全。

api/dms/service/v1/db_service.go [32]

-Password string `json:"password"`
+Password string `json:"password,omitempty"`
Suggestion importance[1-10]: 5

__

Why: The suggestion correctly targets the Password field in the JSON tag and proposes adding omitempty to omit empty values, enhancing data security. However, it is a minor improvement, hence a moderate score.

Low

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.

1 participant