Enhancement: Assistant should inherit global middleware for security and consistency
@hello-ashleyintech 已经在做这个了。
开始于 2025年8月6日。
评估
这个 Issue 还没有评估数据。
描述
Problem
Assistant handlers bypass global middleware entirely, creating a significant security gap and architectural inconsistency. Assistant events, assistant.user_message, assistant.thread_started etc. skip critical middleware that regular events receive, including:
- SSL certificate verification
- Request signature verification
- Authorization middleware
- URL verification
- Custom middleware
This forces developers to manually implement security checks in each assistant handler, which is error-prone and violates the principle of secure-by-default design.
# These handlers get full middleware protection:
@app.event("app_mention")
async def handle_mention(event, say, context):
# Already authenticated via middleware
pass
# These handlers bypass ALL middleware (security vulnerability):
@assistant.user_message
async def handle_message(event, say, context):
# No authentication, no SSL check, no signature verification!
pass
Developer Experience: Developers must remember to add security manually to every assistant handler:
# Current: Manual security in every handler (error-prone)
@assistant.user_message(middleware=[auth_middleware, ssl_middleware])
async def handle_message(event, say, context):
pass
Category
- slack_bolt.App and/or its core components
- slack_bolt.async_app.AsyncApp and/or its core components
- Adapters in slack_bolt.adapter
- Others
Requirements
Proposed Solution
Enhance Assistant/AsyncAssistant to automatically inherit the app's global middleware when handlers are registered. This would:
- Maintain backwards compatibility - existing explicit middleware still works
- Provide opt-in enhancement - controlled via auto_inherit_app_middleware=True parameter
- Apply middleware in correct order - app middleware first, then handler-specific middleware
Benefits
- Security by default - Assistant events get same protection as regular events
- Architectural consistency - All Slack events treated uniformly
- Developer productivity - No more manual security boilerplate
- Backwards compatible - Existing code continues working unchanged
- Performance neutral - Middleware already exists, just applied consistently
- 主要语言
- Python
- 星标
- 1.3k
- 派生
- 288
- 平均合并
- 1 天 8 小时
- 30 天内合并 PR
- 10
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
slackapi/bolt-python 的其他 Issue
-
docs enhancement server-side
难度 1/5 1 小时以内 新手友好度 88/100
slackapi/bolt-python#1576 · 1 条评论 ·
-
auto-triage-skip bug security semver:major
难度 2/5 1-3 小时 新手友好度 72/100
slackapi/bolt-python#1447 · 9 条评论 ·
-
难度 3/5 1-2 天 新手友好度 65/100
slackapi/bolt-python#1577 ·
-
area:async auto-triage-skip dependencies
难度 3/5 1-2 天 新手友好度 65/100
slackapi/bolt-python#1472 · 1 条评论 · 1 个 reaction ·
-
auto-triage-skip discussion
难度 4/5 3-5 天 新手友好度 45/100
slackapi/bolt-python#1332 · 2 条评论 · 1 个 reaction ·
查看 slackapi/bolt-python 的全部 Issue
相似的 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 82/100
-
难度 2/5 1-3 小时 新手友好度 88/100
use-agent-os/agent-os#3314 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
BasedHardware/omi#15662 · 1 条评论 ·
-
documentation help wanted
难度 2/5 1-3 小时 新手友好度 90/100
-
难度 2/5 1-3 小时 新手友好度 62/100
AiursoftWeb/AnduinOS-2#19 ·