Skip to content

fix: handle malformed user/view payloads in extract_team_id#1481

Open
saschabuehrle wants to merge 1 commit intoslackapi:mainfrom
saschabuehrle:fix/issue-1447
Open

fix: handle malformed user/view payloads in extract_team_id#1481
saschabuehrle wants to merge 1 commit intoslackapi:mainfrom
saschabuehrle:fix/issue-1447

Conversation

@saschabuehrle
Copy link
Copy Markdown

Summary

This prevents extract_team_id() from raising KeyError when malformed payloads contain user or view objects without a team_id key.

Changes

  • use .get("team_id") for payload["user"] and payload["view"] lookup in extract_team_id
  • extend invalid-payload coverage in test_extraction_functions_invalid_dict_keys

Why

Slack requests should still be rejected by request verification, but malformed traffic should not crash context extraction before middleware runs.

Testing

  • python3 -m compileall -q slack_bolt/request/internals.py tests/slack_bolt/request/test_internals.py

Fixes #1447

Greetings, saschabuehrle

@saschabuehrle saschabuehrle requested a review from a team as a code owner April 11, 2026 16:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

extract_team_id crashes with TypeError when payload["user"] is a string (e.g. member_joined_channel events)

1 participant