Files
753a043946 MM-68754: Add silent post delivery for bots and integrations (#36771)
* MM-68754: Add silent post delivery for bots and integrations

  Bot, OAuth, incoming webhook, and plugin posts can request silent
  delivery via ?silent=true (REST), silent:true (webhook payload), or
  silent_notification:true (plugin Props). Silent posts are visible in
  the channel but produce no notifications, unread, or New Messages
  line. force_notification overrides silent. Non-integration senders
  requesting silent receive HTTP 403.

  Also tightens SanitizeProps to strip from_webhook, from_bot,
  from_oauth_app, from_plugin, force_notification, and
  silent_notification from client input. These props are now set
  server-side based on session and entry-point flags, preventing
  identity spoofing. Legitimate callers see no behavior change since
  the server already controlled these props at the response shape;
  the hardening only affects callers attempting to forge them.

* Drop redundant prop-bag silent_notification path from webhooks

* Address CodeRabbit feedback + rebase test fixup

* Update tests to use CreatePostFlags.FromIncomingWebhook instead of forging from_webhook prop

* update api documentation

* test fixes

* added additional tests

* review fixes, update comments

* code review changes, fix test

* fix formatting issues

* fix lint errors

* avoid backward compatibility issues, by no longer stripping the  Post properties.
will add them back in v12 when breaking changes are allowed

---------

Co-authored-by: Mattermost Build <[email protected]>
2026-07-09 17:02:22 -06:00

46 lines
2.8 KiB
Go

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
package model
type NotificationStatus string
type NotificationType string
type NotificationReason string
const (
NotificationStatusSuccess NotificationStatus = "success"
NotificationStatusError NotificationStatus = "error"
NotificationStatusNotSent NotificationStatus = "not_sent"
NotificationStatusUnsupported NotificationStatus = "unsupported"
NotificationTypeAll NotificationType = "all"
NotificationTypeEmail NotificationType = "email"
NotificationTypeWebsocket NotificationType = "websocket"
NotificationTypePush NotificationType = "push"
NotificationNoPlatform = "no_platform"
NotificationReasonFetchError NotificationReason = "fetch_error"
NotificationReasonParseError NotificationReason = "json_parse_error"
NotificationReasonMarshalError NotificationReason = "json_marshal_error"
NotificationReasonPushProxyError NotificationReason = "push_proxy_error"
NotificationReasonPushProxySendError NotificationReason = "push_proxy_send_error"
NotificationReasonPushProxyRemoveDevice NotificationReason = "push_proxy_remove_device"
NotificationReasonRejectedByPlugin NotificationReason = "rejected_by_plugin"
NotificationReasonSessionExpired NotificationReason = "session_expired"
NotificationReasonChannelMuted NotificationReason = "channel_muted"
NotificationReasonSystemMessage NotificationReason = "system_message"
NotificationReasonSilent NotificationReason = "silent_notification"
NotificationReasonLevelSetToNone NotificationReason = "notify_level_none"
NotificationReasonNotMentioned NotificationReason = "not_mentioned"
NotificationReasonUserStatus NotificationReason = "user_status"
NotificationReasonUserIsActive NotificationReason = "user_is_active"
NotificationReasonMissingProfile NotificationReason = "missing_profile"
NotificationReasonEmailNotVerified NotificationReason = "email_not_verified"
NotificationReasonEmailSendError NotificationReason = "email_send_error"
NotificationReasonTooManyUsersInChannel NotificationReason = "too_many_users_in_channel"
NotificationReasonResolvePersistentNotificationError NotificationReason = "resolve_persistent_notification_error"
NotificationReasonMissingThreadMembership NotificationReason = "missing_thread_membership"
NotificationReasonRecipientIsBot NotificationReason = "recipient_is_bot"
)