Commit 407f7ac
authored
feat(seer-slack): Check channel type for correct history scope before API call (#112371)
### Motivation
Right now, we require every Sentry Slack app integration to require
every scope that we request. However, with Seer Explorer requiring
`channels:history` and `groups:history` (public and private channels
history read scopes), some organization may not want to allow us to have
access to those kinds of data.
Therefore we must check whether the bot mention happened in a public or
a private channel, and whether we have the appropriate scopes to read
the history from those channels.
### Details
Use Slack's `conversations.info` API to determine channel type (public
vs private) and check the appropriate OAuth scope (`channels:history` vs
`groups:history`) before calling `conversations.replies`. Previously we
only checked `channels:history` regardless of channel type, which meant
private channel threads were always blocked.
Also adds a missing-scope footer to the **first** Seer Explorer response
in a thread when the integration lacks the required history scope.
Subsequent responses in the same thread do not repeat the warning.
If an installation does not have the correct permissions and is not able
to fetch the whole thread context and pass it onto Seer, this footer
will appear on the first response:
<img width="557" height="416" alt="image"
src="https://github.com/user-attachments/assets/74de7b25-0e45-4cb5-b45d-95de1c5e4b5f"
/>
If the installation has the correct scopes and is able to grab the
thread context, it won't show the footer:
<img width="546" height="387" alt="image"
src="https://github.com/user-attachments/assets/6b099570-b464-4e66-8c9b-73765f2e7d6a"
/>
Refs ISWF-23531 parent 3d880ff commit 407f7ac
File tree
7 files changed
+315
-8
lines changed- src/sentry
- integrations/slack
- notifications/platform
- slack/renderers
- templates
- seer/entrypoints/slack
- tests/sentry
- integrations/slack
- notifications/platform/slack/renderers
- seer/entrypoints/slack
7 files changed
+315
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
261 | 261 | | |
262 | 262 | | |
263 | 263 | | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
264 | 329 | | |
265 | 330 | | |
266 | 331 | | |
| |||
271 | 336 | | |
272 | 337 | | |
273 | 338 | | |
274 | | - | |
| 339 | + | |
275 | 340 | | |
276 | 341 | | |
277 | 342 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
220 | 223 | | |
221 | 224 | | |
222 | 225 | | |
| |||
271 | 274 | | |
272 | 275 | | |
273 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
274 | 286 | | |
275 | 287 | | |
276 | 288 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
| 192 | + | |
192 | 193 | | |
193 | 194 | | |
194 | 195 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
| 37 | + | |
36 | 38 | | |
37 | 39 | | |
38 | 40 | | |
| |||
68 | 70 | | |
69 | 71 | | |
70 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
71 | 113 | | |
72 | 114 | | |
73 | 115 | | |
| |||
410 | 452 | | |
411 | 453 | | |
412 | 454 | | |
| 455 | + | |
| 456 | + | |
413 | 457 | | |
414 | 458 | | |
415 | 459 | | |
416 | 460 | | |
417 | 461 | | |
418 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
419 | 469 | | |
420 | 470 | | |
421 | 471 | | |
422 | 472 | | |
| 473 | + | |
423 | 474 | | |
424 | 475 | | |
425 | | - | |
426 | | - | |
| 476 | + | |
| 477 | + | |
427 | 478 | | |
428 | 479 | | |
429 | 480 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
624 | 624 | | |
625 | 625 | | |
626 | 626 | | |
627 | | - | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
628 | 634 | | |
629 | 635 | | |
630 | 636 | | |
631 | 637 | | |
632 | 638 | | |
633 | 639 | | |
634 | 640 | | |
635 | | - | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
636 | 645 | | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
637 | 649 | | |
638 | 650 | | |
639 | 651 | | |
| |||
653 | 665 | | |
654 | 666 | | |
655 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
656 | 720 | | |
| 721 | + | |
657 | 722 | | |
658 | | - | |
| 723 | + | |
659 | 724 | | |
660 | 725 | | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
661 | 729 | | |
662 | 730 | | |
663 | 731 | | |
| |||
Lines changed: 29 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
272 | 301 | | |
273 | 302 | | |
274 | 303 | | |
| |||
0 commit comments