goto / guardian

Guardian is a tool for extensible and universal data access with automated access workflows and security controls across data stores, analytical systems, and cloud products.

Home Page:https://goto.github.io/guardian/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

error sending slack notifications

bsushmith opened this issue · comments

Description
With the new way of slack notifications being sent supporting enhanced message support - there can be failures in sending notifications if the notification message has special characters.

For example,

Scenario1:

Using the below as expiration reminder template, causes json parsing failures

[
  {
	"type":"section",
	"text":{
  	"type":"mrkdwn",
  	"text":"Access to {{.resource_name}} with role {{.role}} for account `{{.account_id}}` will *expire* at {{.expiration_date.Format \"Jan 02, 2006 15:04:05 UTC\"}}. Go to this link https://console.data.gtfdata.io/dataaccess/resources to reapply"
	}
  }
]

Error:

time="2023-04-10T09:00:27Z" level=error msg="failed to send notifications" error="template: notification_messages:6: unexpected \"\\\\\" in operand"

Scenario 2:

If the user supplied reason to a given appeal question contains \n characters like below -

{
  "questions": {
    "What is the purpose of accessing this data?": "This dataset is essential for our use cases.\nThe access to this dataset is important to granted at the latest\n"
  }
}

Error:

ERRO[46578] failed to send notifications                  error="error in parsing message block invalid character '\\n' in string literal"

@utsav14nov @rahmatrhd