Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions hallpass.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,7 @@ type accessTypeConfig struct {
Attr string // e.g. "custom:jitToPII" (posture attribute key)
Max timeDurationString
Default timeDurationString
Silent bool // when true, skip Slack notifications for access requests
}

type accessTypes struct {
Expand Down Expand Up @@ -532,15 +533,17 @@ func (s *Server) authorize(ctx context.Context, li lookupInfo, req authorizeRequ
if err != nil {
return fmt.Errorf("SetPostureAttribute: %v", err)
}
if err := SendSlack(ctx, string(s.webhookURL()), SlackNotification{
Who: li.Who,
NodeID: li.NodeID,
NodeName: li.NodeName,
AccessType: at.Name,
AccessDuration: req.Duration.String(),
Reason: req.Reason,
}); err != nil {
return fmt.Errorf("SendSlack: %v", err)
if !at.Silent {
if err := SendSlack(ctx, string(s.webhookURL()), SlackNotification{
Who: li.Who,
NodeID: li.NodeID,
NodeName: li.NodeName,
AccessType: at.Name,
AccessDuration: req.Duration.String(),
Reason: req.Reason,
}); err != nil {
return fmt.Errorf("SendSlack: %v", err)
}
}
return nil
}
Expand Down