Skip to content

fix(webhook): strip transport options from send() payloads - #2857

Merged
mwbrooks merged 1 commit into
mainfrom
zimeg/webhook-send-strip-options
Nov 17, 2026
Merged

mwbrooks merged 1 commit into
mainfrom
zimeg/webhook-send-strip-options

Conversation

@zimeg

@zimeg zimeg commented Nov 17, 2026

Copy link
Copy Markdown
Member

Summary

This pull request stops IncomingWebhook.send() from posting the timeout and retryConfig options in the message payload.

  • IncomingWebhookSendArguments extends the default arguments, so send({ text, timeout, retryConfig }) type-checks. The constructor removed these options from its defaults, but options given to send() were merged in afterward and posted as is, e.g. {"text":"hello","timeout":100,"retryConfig":{...}}.
  • The removal now happens in send(), after the merge, so options from both the constructor and send() are dropped.
  • Adds a test that sends both options and expects { text: 'hello' }, and a patch changeset.

This lands before #2688, which adds logger and logLevel to the same options and will add them to this list. Thanks to @mwbrooks for catching it!

Testing

  • The new test fails on main (the payload includes timeout and retryConfig) and passes with this change.
  • The existing does not leak retryConfig into the posted payload test still passes for options given to the constructor.

Requirements

🤖 Generated with Claude Code

Co-authored-by: Michael Brooks <21328+mwbrooks@users.noreply.github.com>
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@zimeg
zimeg requested a review from a team as a code owner November 17, 2026 01:34
@zimeg zimeg added this to the webhook@next milestone Nov 17, 2026
@zimeg zimeg added bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented semver:patch pkg:webhook applies to `@slack/webhook` labels Nov 17, 2026
@zimeg zimeg self-assigned this Nov 17, 2026
@changeset-bot

changeset-bot Bot commented Nov 17, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3b5239c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@slack/webhook Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

zimeg added a commit that referenced this pull request Nov 17, 2026
This reverts commit 21a2768. The strip for transport options lands first in #2857, then this branch adds logger and logLevel to it.

Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
@codecov

codecov Bot commented Nov 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.33%. Comparing base (fd8f6dd) to head (3b5239c).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2857      +/-   ##
==========================================
+ Coverage   94.25%   94.33%   +0.08%     
==========================================
  Files          67       67              
  Lines       10808    10809       +1     
  Branches      680      683       +3     
==========================================
+ Hits        10187    10197      +10     
+ Misses        590      580      -10     
- Partials       31       32       +1     
Flag Coverage Δ
cli-hooks 94.27% <100.00%> (+0.09%) ⬆️
cli-test 94.27% <100.00%> (+0.09%) ⬆️
logger 94.27% <100.00%> (+0.09%) ⬆️
oauth 94.27% <100.00%> (+0.09%) ⬆️
socket-mode 94.27% <100.00%> (+0.09%) ⬆️
web-api 94.27% <100.00%> (+0.09%) ⬆️
webhook 94.27% <100.00%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mwbrooks mwbrooks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Thanks @zimeg! Moving the strip into send() covers the constructor and per-call paths in one place and the new test pins it down nicely.

}

// Remove transport options so they don't leak into payloads
const { fetch: _fetch, timeout: _timeout, retryConfig: _retryConfig, ...messagePayload } = payload;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought (non-blocking): `send({ timeout })` still type-checks but quietly does nothing, since only the constructor's `timeout` and `retryConfig` are used. Could be worth a follow-up to drop these from `IncomingWebhookSendArguments` or honour them per call.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧭 Opened #2860 to honour them per call, since dropping them from IncomingWebhookSendArguments would break TypeScript code that passes them.

@mwbrooks
mwbrooks merged commit 8011e1d into main Nov 17, 2026
22 checks passed
@mwbrooks
mwbrooks deleted the zimeg/webhook-send-strip-options branch November 17, 2026 01:48
@zimeg

zimeg commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

🌟 Thanks for the kind review and merge @mwbrooks!

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

Labels

bug M-T: A confirmed bug report. Issues are confirmed when the reproduction steps are documented pkg:webhook applies to `@slack/webhook` semver:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants