Skip to content

fix: copy the headers dict passed to client constructors - #2079

Open
Shriraj1901 wants to merge 2 commits into
slackapi:mainfrom
Shriraj1901:fix-client-headers-copy
Open

Shriraj1901 wants to merge 2 commits into
slackapi:mainfrom
Shriraj1901:fix-client-headers-copy

Conversation

@Shriraj1901

Copy link
Copy Markdown

…the client constructors

The clients stored the headers / default_headers dict they were given and then wrote the generated User-Agent into it. That changed the caller's dict, and two clients created from the same dict shared one headers object, so the second client's user_agent_prefix replaced the first client's.

Copy the dict in WebClient, AsyncWebClient, LegacyWebClient, WebhookClient, AsyncWebhookClient, AuditLogsClient, AsyncAuditLogsClient, SCIMClient and AsyncSCIMClient. Add a test that covers all of them.

Summary

Testing

Category

  • slack_sdk.web.WebClient (sync/async) (Web API client)
  • slack_sdk.webhook.WebhookClient (sync/async) (Incoming Webhook, response_url sender)
  • slack_sdk.socket_mode (Socket Mode client)
  • slack_sdk.signature (Request Signature Verifier)
  • slack_sdk.oauth (OAuth Flow Utilities)
  • slack_sdk.models (UI component builders)
  • slack_sdk.scim (SCIM API client)
  • slack_sdk.audit_logs (Audit Logs API client)
  • slack_sdk.rtm_v2 (RTM client)
  • /docs (Documents)
  • /tutorial (PythOnBoardingBot tutorial)
  • tests/integration_tests (Automated tests for this library)

Requirements

  • I've read and understood the Contributing Guidelines and have done my best effort to follow them.
  • I've read and agree to the Code of Conduct.
  • I have signed the Salesforce CLA (required before your PR can be reviewed or merged).
  • I've run python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh after making the changes.

…the client constructors

The clients stored the headers / default_headers dict they were given and
then wrote the generated User-Agent into it. That changed the caller's
dict, and two clients created from the same dict shared one headers object,
so the second client's user_agent_prefix replaced the first client's.

Copy the dict in WebClient, AsyncWebClient, LegacyWebClient, WebhookClient,
AsyncWebhookClient, AuditLogsClient, AsyncAuditLogsClient, SCIMClient and
AsyncSCIMClient. Add a test that covers all of them.
@Shriraj1901
Shriraj1901 requested a review from a team as a code owner November 21, 2026 14:44
@salesforce-cla

Copy link
Copy Markdown

Thanks for the contribution! Before we can merge this, we need @Shriraj1901 to sign the Salesforce Inc. Contributor License Agreement.

@hello-ashleyintech

Copy link
Copy Markdown
Contributor

Hi @Shriraj1901 , thanks so much for submitting this!

Could you sign the sign the Salesforce Inc. Contributor License Agreement and also update the branch to have the latest main?

@mwbrooks mwbrooks added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch labels Nov 23, 2026
@mwbrooks mwbrooks added this to the 3.48.1 milestone Nov 23, 2026
@mwbrooks mwbrooks changed the title fix(web, webhook, scim, audit_logs): copy the headers dict passed to … fix: copy the headers dict passed to client constructors Nov 23, 2026
@mwbrooks

Copy link
Copy Markdown
Member

@Shriraj1901 Could you sign the Salesforce CLA? We need it signed before we can continue with this PR. 🙏

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audit-logs-client bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented cla:missing scim-client semver:patch web-client

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants