Skip to content

fix(msteams): sanitize error messages sent to users (CWE-209)#33343

Merged
BradGroux merged 1 commit intoopenclaw:mainfrom
lewiswigmore:security/sanitize-error-messages
Apr 1, 2026
Merged

fix(msteams): sanitize error messages sent to users (CWE-209)#33343
BradGroux merged 1 commit intoopenclaw:mainfrom
lewiswigmore:security/sanitize-error-messages

Conversation

@lewiswigmore
Copy link
Copy Markdown
Contributor

Summary

Replaces raw error propagation with generic user-facing messages to prevent internal stack traces, file paths, and Graph API error details from leaking to Teams users (CWE-209 information disclosure).

Changes

  • monitor-handler.ts: Replace File upload failed: ${String(err)} with generic "File upload failed. Please try again." and upgrade log level from debug to error
  • message-handler.ts: Replace ⚠️ Agent failed: ${err.message} with generic "⚠️ Something went wrong. Please try again."

Error details are preserved in server-side logs for debugging.

Supersedes #23629 (closed by stale bot during rebase).

Replace raw err.message in user-facing sendActivity calls with generic
messages. Internal details (URLs, tenant IDs, API errors) are kept in
server-side logs only.

- message-handler.ts: 'Agent failed: ${err.message}' → generic message
- monitor-handler.ts: 'File upload failed: ${err}' → generic message
- Upgrade file upload error from debug to error log level
@openclaw-barnacle openclaw-barnacle bot added channel: msteams Channel integration: msteams size: XS labels Mar 3, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Mar 3, 2026

Greptile Summary

This PR patches two CWE-209 (Information Exposure Through an Error Message) vulnerabilities in the MS Teams integration by replacing raw error strings sent to users with generic, non-disclosing messages. Full error details are preserved in server-side logs for debugging.

Changes:

  • monitor-handler.ts: User-facing file upload error message is now generic ("File upload failed. Please try again."). Log level upgraded from debug to error, which is appropriate for an actual failure. Full error details logged server-side.
  • message-handler.ts: User-facing agent failure message is now generic ("⚠️ Something went wrong. Please try again."). Full error details already logged server-side via existing log.error call.

The fix is minimal, targeted, and safe — no functional behavior beyond user-visible messages is affected.

Confidence Score: 5/5

  • This PR is safe to merge — a straightforward, minimal security hardening change with no risk of regressions.
  • Both changes are small, isolated substitutions of user-facing error strings. Error details remain fully preserved in existing server-side log.error calls. No new code paths, data flows, or dependencies are introduced. The log-level upgrade from debug to error in monitor-handler.ts is appropriate and consistent with error handling elsewhere in the file. Zero functional regressions possible.
  • No files require special attention.

Last reviewed commit: 085d74c

Copy link
Copy Markdown

@WinnCook WinnCook left a comment

Choose a reason for hiding this comment

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

Clean fix. Upgrading log level to error on the upload path is a good call too — debug was swallowing failures silently in production.

@lewiswigmore
Copy link
Copy Markdown
Contributor Author

CI is blocked by a pre-existing test failure on mainsrc/plugins/commands.test.ts doesn't expect the acceptsArgs field added to getPluginCommandSpecs(). Fix submitted in #33362.

@BradGroux BradGroux self-assigned this Mar 10, 2026
@BradGroux
Copy link
Copy Markdown
Contributor

Hi @lewiswigmore — thanks for the submission. I’m the new Microsoft Teams maintainer for OpenClaw. Please give me a day or two to work through the open Teams backlog. Also, join the Twitter community for daily MS Teams feedback + updates: https://x.com/i/communities/2031170403607974228

1 similar comment
@BradGroux
Copy link
Copy Markdown
Contributor

Hi @lewiswigmore — thanks for the submission. I’m the new Microsoft Teams maintainer for OpenClaw. Please give me a day or two to work through the open Teams backlog. Also, join the Twitter community for daily MS Teams feedback + updates: https://x.com/i/communities/2031170403607974228

@johnsonshi
Copy link
Copy Markdown
Contributor

This looks like a clean, low-risk security hardening change for the Teams integration. It removes raw error details from the two user-facing sendActivity(...) failure paths while preserving detailed server-side diagnostics, and changing the upload failure log from debug to error also looks appropriate.

I don’t see scope creep or an obvious missing follow-up in the code changed here.

@lewiswigmore
Copy link
Copy Markdown
Contributor Author

Thanks @BradGroux, no rush! Happy to rebase once the test fix lands on main. Will check out the community too ���

@BradGroux BradGroux merged commit e881e96 into openclaw:main Apr 1, 2026
67 of 73 checks passed
steipete pushed a commit to duncanita/openclaw that referenced this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: msteams Channel integration: msteams size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants