Skip to content

Commit e18d408

Browse files
authored
prevent users from seeing notification for their own access request (#50076)
1 parent a1cbc5d commit e18d408

File tree

5 files changed

+132
-84
lines changed

5 files changed

+132
-84
lines changed

api/gen/proto/go/teleport/notifications/v1/notifications.pb.go

Lines changed: 96 additions & 84 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/proto/teleport/notifications/v1/notifications.proto

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ message GlobalNotificationSpec {
8686
bool match_all_conditions = 4;
8787
// notification is the notification itself.
8888
Notification notification = 5;
89+
// exclude_users is a list of usernames of users who should never match this notification
90+
// under any circumstances.
91+
repeated string exclude_users = 6;
8992
}
9093

9194
// ByPermissions represents the RoleConditions needed for a user to receive this notification.

lib/auth/auth.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5219,6 +5219,8 @@ func (a *Server) CreateAccessRequestV2(ctx context.Context, req types.AccessRequ
52195219
},
52205220
},
52215221
},
5222+
// Prevent the requester from seeing the notification for their own access request.
5223+
ExcludeUsers: []string{req.GetUser()},
52225224
Notification: &notificationsv1.Notification{
52235225
Spec: &notificationsv1.NotificationSpec{},
52245226
SubKind: types.NotificationAccessRequestPendingSubKind,

0 commit comments

Comments
 (0)