Commit 1fc166c
authored
MS Teams: Auto-detect Power Automate and disable file attachments (#1995)
* Fix MS Teams sink to respect send_svg parameter
The MS Teams sink was embedding base64-encoded images in the Adaptive Card
payload, causing 'payload too large' errors with Power Automate webhooks
(which have a strict 28KB limit).
Other sinks (Slack, Discord, Jira, Zulip, etc.) already check the send_svg
parameter to filter out images, but MS Teams was missing this check.
Changes:
- Pass send_svg parameter from MsTeamsSink to MsTeamsSender
- Filter image FileBlocks when send_svg=False using is_image() helper
- Add documentation for the send_svg setting
Fixes #1994
* Add docstring to send_finding_to_ms_teams for CI coverage
* Add send_files parameter to MS Teams sink to handle 28KB limit
Replace the incorrectly used send_svg parameter with send_files:
- send_svg was designed only for SVG files (see commit e354c48)
- MS Teams 28KB limit affects all file types, not just SVGs
- Follow existing pattern from Telegram, Pushover, YaMessenger sinks
Changes:
- Add send_files: bool = True to MsTeamsSinkParams
- Update sender.py to filter all files when send_files is False
- Remove incorrect is_image import from sender.py
- Add docstring to write_finding for CodeRabbit coverage
- Update documentation with new parameter name
* Auto-detect Power Automate URLs and disable file attachments
- Change send_files from bool to Optional[bool] with None default
- Add _is_power_automate_url() helper to detect Power Automate webhooks
- Auto-disable files for Power Automate URLs (*.api.powerplatform.com)
- Keep files enabled for legacy webhooks (*.webhook.office.com)
- Explicit send_files: true/false always overrides auto-detection
- Update documentation with auto-detection behavior1 parent ccf0065 commit 1fc166c
4 files changed
Lines changed: 75 additions & 1 deletion
File tree
- docs/configuration/sinks
- src/robusta
- core/sinks/msteams
- integrations/msteams
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
93 | 93 | | |
94 | 94 | | |
95 | 95 | | |
96 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
15 | 21 | | |
16 | 22 | | |
17 | 23 | | |
| |||
20 | 26 | | |
21 | 27 | | |
22 | 28 | | |
| 29 | + | |
23 | 30 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
21 | 31 | | |
22 | 32 | | |
23 | 33 | | |
| |||
61 | 71 | | |
62 | 72 | | |
63 | 73 | | |
| 74 | + | |
64 | 75 | | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
65 | 90 | | |
66 | 91 | | |
67 | 92 | | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
68 | 98 | | |
69 | 99 | | |
70 | 100 | | |
71 | 101 | | |
72 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
73 | 108 | | |
74 | 109 | | |
75 | 110 | | |
| |||
0 commit comments