Skip to content

refactor(api): remove middleware from AI Hub banner endpoint#3222

Merged
BugsGuru merged 1 commit intomainfrom
fix/aihubbanner
Mar 24, 2026
Merged

refactor(api): remove middleware from AI Hub banner endpoint#3222
BugsGuru merged 1 commit intomainfrom
fix/aihubbanner

Conversation

@winfredLIN
Copy link
Copy Markdown
Collaborator

@winfredLIN winfredLIN commented Mar 24, 2026

User description

allow all user to get banner data

关联的 issue

https://github.com/actiontech/dms-ee/issues/724

link https://github.com/actiontech/sqle-ee/pull/2669

描述你的变更

  1. 允许普通用户访问AI能效中心的Banner数据
image

测试

image

确认项(pr提交后操作)

Tip

请在指定复审人之前,确认并完成以下事项,完成后✅


  • 我已完成自测
  • 我已记录完整日志方便进行诊断
  • 我已在关联的issue里补充了实现方案
  • 我已在关联的issue里补充了测试影响面
  • 我已确认了变更的兼容性,如果不兼容则在issue里标记 not_compatible
  • 我已确认了是否要更新文档,如果要更新则在issue里标记 need_update_doc


Description

  • 删除 AI Hub banner 路由中调用的 ViewGlobalAllowed 中间件

  • 允许所有用户访问 AI 能效中心的 Banner 数据


Diagram Walkthrough

flowchart LR
  A["修改 sqle/api/app.go 文件"]
  B["删除 banner 路由的中间件"]
  C["允许普通用户访问 Banner 数据"]
  A -- "更新路由配置" --> B
  B -- "移除中间件" --> C
Loading

File Walkthrough

Relevant files
Enhancement
app.go
移除 banner 路由访问控制中间件                                                                           

sqle/api/app.go

  • 删除 banner 接口中调用的 sqleMiddleware.ViewGlobalAllowed 中间件
  • 其他 AI Hub 接口保持原有中间件设置
+1/-1     

@actiontech-bot actiontech-bot requested a review from BugsGuru March 24, 2026 07:22
@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
Security
恢复授权中间件

取消 sqleMiddleware.ViewGlobalAllowed()
授权中间件可能导致未授权访问风险。建议确认是否有其他安全措施保证访问控制,如果没有,请恢复添加该中间件以确保端点安全。

sqle/api/app.go [123]

-v1Router.GET("/ai_hub/banner", v1.GetAIHubBanner)
+v1Router.GET("/ai_hub/banner", v1.GetAIHubBanner, sqleMiddleware.ViewGlobalAllowed())
Suggestion importance[1-10]: 8

__

Why: The suggestion addresses a security risk by restoring the sqleMiddleware.ViewGlobalAllowed() middleware that was removed in the PR, ensuring that unauthorized access is prevented. The suggested change accurately targets the existing code on line 123 and reflects the intended improvement.

Medium

@BugsGuru BugsGuru merged commit 64da472 into main Mar 24, 2026
4 checks passed
@BugsGuru BugsGuru deleted the fix/aihubbanner branch March 24, 2026 07:27
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.

2 participants