( channelId: string, )
| 425 | * #2735 |
| 426 | */ |
| 427 | export async function verifyChannelStillPrivate( |
| 428 | channelId: string, |
| 429 | ): Promise<ChannelPrivacyState> { |
| 430 | const info = await getChannelInfo(channelId); |
| 431 | if (!info) { |
| 432 | logger.warn( |
| 433 | { channelId, event: 'channel_privacy_verify_unavailable' }, |
| 434 | 'Could not verify Slack channel privacy state — caller must decide whether to proceed', |
| 435 | ); |
| 436 | return 'unknown'; |
| 437 | } |
| 438 | if (info.is_private !== true) { |
| 439 | // Drop the stale cache entry so a rapid re-privatize by an admin |
| 440 | // is picked up on the very next send rather than after the remaining |
| 441 | // TTL. `getChannelInfo`'s next call will re-fetch. |
| 442 | channelCache.delete(channelId); |
| 443 | logger.warn( |
| 444 | { |
| 445 | channelId, |
| 446 | channelName: info.name, |
| 447 | event: 'channel_privacy_drift', |
| 448 | }, |
| 449 | 'Configured Slack channel is no longer private — refusing to post sensitive content. Admin action required to re-privatize or unlink.', |
| 450 | ); |
| 451 | return 'public'; |
| 452 | } |
| 453 | return 'private'; |
| 454 | } |
| 455 | |
| 456 | /** |
| 457 | * Result of `verifyChannelPrivacyForWrite` — the write-time gate that |
no test coverage detected