Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DLP Templates that have a variable in them like ${NAME} need to be properly escaped in the TF Files #208

Open
2 tasks done
eReyesZscaler opened this issue Jun 26, 2024 · 0 comments

Comments

@eReyesZscaler
Copy link

eReyesZscaler commented Jun 26, 2024

Confirmation

  • My issue isn't already found on the issue tracker.
  • I have replicated my issue using the latest version of the library and it is still present.

zscaler-terraformer version

zscaler-terraformer v1.2.2 Terraform version: Terraform v1.5.7

Expected outcome

Running terraform plan when there's variables as text in the notification templates errors, since they aren't escaped.

Actual outcome

Terraform commands fail:
 on zia_dlp_notification_templates.tf line 4, in resource "zia_dlp_notification_templates" "resource_zia_dlp_notification_templates_3671":
│    4:   html_message       = "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<style>\n\t\t\t.user {color: rgb(1, 81, 152);}\n\t\t\t.url {color: rgb(1, 81, 152);}\n\t\t\t.postingtype {color: rgb(1, 81, 152);}\n\t\t\t.engines {color: rgb(1, 81, 152);}\n\t\t\t.dictionaries {color: rgb(1, 81, 152);}\n\t\t</style>\n\t</head>\n\t<body>\n\t\tThe attached content triggered a Web DLP rule for your organization.\n\t\t<br/><br/>\n\t\tTransaction ID: <span class=\"transaction_id\">${TRANSACTION_ID}</span>\n\t\t<br/>\n\t\tUser Accessing the URL: <span class=\"user\">${USER}</span>\n\t\t<br/>\n\t\tURL Accessed: <span class=\"url\">${URL}</span>\n\t\t<br/>\n\t\tPosting Type: <span class=\"postingtype\">${TYPE}</span>\n\t\t<br/>\n\t\tDLP MD5: <span class=\"dlpmd5\">${DLPMD5}</span>\n\t\t<br/>\n\t\tTriggered DLP Violation Engines (assigned to the hit rule): <span class=\"engines\">${ENGINES_IN_RULE}</span>\n\t\t<br/>\n\t\tTriggered DLP Violation Dictionaries (assigned to the hit rule): <span class=\"dictionaries\">${DICTIONARIES}</span>\n\t\t<br/><br/>\n\t\tNo action is required on your part.\n\t\t<br/><br/>\n\t</body>\n</html>"
│
│ A reference to a resource type must be followed by at least one attribute access, specifying the resource name.
╵
╷
│ Error: Invalid reference

Steps to reproduce

TF Files like this:


# __generated__ by Zscaler Terraformer from Default DLP
resource "zia_dlp_notification_templates" "resource_zia_dlp_notification_templates_3671" {
  attach_content     = true
  html_message       = "<!DOCTYPE html>\n<html>\n\t<head>\n\t\t<style>\n\t\t\t.user {color: rgb(1, 81, 152);}\n\t\t\t.url {color: rgb(1, 81, 152);}\n\t\t\t.postingtype {color: rgb(1, 81, 152);}\n\t\t\t.engines {color: rgb(1, 81, 152);}\n\t\t\t.dictionaries {color: rgb(1, 81, 152);}\n\t\t</style>\n\t</head>\n\t<body>\n\t\tThe attached content triggered a Web DLP rule for your organization.\n\t\t<br/><br/>\n\t\tTransaction ID: <span class=\"transaction_id\">$${TRANSACTION_ID}</span>\n\t\t<br/>\n\t\tUser Accessing the URL: <span class=\"user\">$${USER}</span>\n\t\t<br/>\n\t\tURL Accessed: <span class=\"url\">$${URL}</span>\n\t\t<br/>\n\t\tPosting Type: <span class=\"postingtype\">$${TYPE}</span>\n\t\t<br/>\n\t\tDLP MD5: <span class=\"dlpmd5\">$${DLPMD5}</span>\n\t\t<br/>\n\t\tTriggered DLP Violation Engines (assigned to the hit rule): <span class=\"engines\">${ENGINES_IN_RULE}</span>\n\t\t<br/>\n\t\tTriggered DLP Violation Dictionaries (assigned to the hit rule): <span class=\"dictionaries\">${DICTIONARIES}</span>\n\t\t<br/><br/>\n\t\tNo action is required on your part.\n\t\t<br/><br/>\n\t</body>\n</html>"
  name               = "Default DLP"
  plain_text_message = "The attached content triggered a Web DLP rule for your organization.\n\nTransaction ID: $${TRANSACTION_ID}\nUser Accessing the URL: $${USER}\nURL Accessed: $${URL}\nPosting Type: $${TYPE}\nDLP MD5: $${DLPMD5}\nTriggered DLP Violation Engines (assigned to the hit rule): $${ENGINES_IN_RULE}\nTriggered DLP Violation Dictionaries (assigned to the hit rule): $${DICTIONARIES}\n\nNo action is required on your part."
  subject            = "DLP Violation: $${TRANSACTION_ID} $${RULENAME}"
  tls_enabled        = true
}

Fail, the ${VARIABLES} need to be escaped $${VARIABLES} or terraform errors on them.

References

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant