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

google_monitoring_notification_channel no longer obfuscating auth_token for Slack #4058

Closed
StephenWithPH opened this issue Jul 18, 2019 · 2 comments
Assignees
Labels

Comments

@StephenWithPH
Copy link

StephenWithPH commented Jul 18, 2019

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
  • If an issue is assigned to the "modular-magician" user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to "hashibot", a community member has claimed the issue already.

Terraform Version

Terraform v0.12.4
+ provider.google v2.11.0

Affected Resource(s)

  • google_monitoring_notification_channel

Terraform Configuration Files

resource "google_monitoring_notification_channel" "this" {
  provider     = google
  display_name = var.display_name
  enabled      = "true"
  project      = data.google_project.this.project_id
  type         = "slack"

  labels = {
    auth_token   = data.vault_generic_secret.slack_token.data["value"]
    channel_name = var.channel_name
  }
}

Expected Behavior

Per https://github.com/terraform-providers/terraform-provider-google/blob/v2.11.0/website/docs/r/monitoring_notification_channel.html.markdown...

Note: Some NotificationChannelDescriptor labels are sensitive and the API will return an partially-obfuscated value. For example, for "type": "slack" channels, an auth_token label with value "SECRET" will be obfuscated as "**CRET".

Actual Behavior

  • terraform apply:
Terraform will perform the following actions:

  # module.slack.google_monitoring_notification_channel.this will be created
  + resource "google_monitoring_notification_channel" "this" {
      + display_name        = "my-display-name"
      + enabled             = true
      + id                  = (known after apply)
      + labels              = {
          + "auth_token"   = "UN-OBFUSCATED TOKEN"          <---------- this is the problem
          + "channel_name" = "my-channel-name"
        }
      + name                = (known after apply)
      + project             = "my-project"
      + type                = "slack"
      + verification_status = (known after apply)
    }

  • terraform show:
# module.slack.google_monitoring_notification_channel.this:
resource "google_monitoring_notification_channel" "this" {
    display_name = "my-display-name"
    enabled      = true
    id           = "<redacted>"
    labels       = {
        "auth_token"   = "UN-OBFUSCATED TOKEN"       <------ also a problem here
        "channel_name" = "my-channel-name"
    }
    name         = "<redacted>"
    project      = "my-project"
    type         = "slack"
}
  • terraform destroy:
Terraform will perform the following actions:

  # module.slack.google_monitoring_notification_channel.this will be destroyed
  - resource "google_monitoring_notification_channel" "this" {
      - display_name = "my-display-name" -> null
      - enabled      = true -> null
      - id           = "<redacted>" -> null
      - labels       = {
          - "auth_token"   = "UN-OBFUSCATED TOKEN"      <------- also a problem here
          - "channel_name" = "my-channel-name"
        } -> null
      - name         = "<redacted>" -> null
      - project      = "my-project" -> null
      - type         = "slack" -> null
      - user_labels  = {} -> null
    }

Steps to Reproduce

  1. terraform apply or terraform show (having created the resource) or terraform destroy (having created the resource)
  2. see the unredacted token in the output
@ghost ghost added the bug label Jul 18, 2019
@slevenick slevenick self-assigned this Jul 19, 2019
@slevenick
Copy link
Collaborator

I believe this is working as intended.

The documentation mentions that the API will return an obfuscated value, which it does (see snippet below).

Terraform state, and the results of plan do not obfuscate the token, as they need the entire value to be able to send it to the API. See https://www.terraform.io/docs/state/sensitive-data.html

Result from API:

2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:   "type": "slack",
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:   "displayName": "displaythis",
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:   "labels": {
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:     "auth_token": "**************ALUE",
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:     "channel_name": "channel"
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:   },
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:   "name": "projects/project-name/notificationChannels/123123",
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4:   "enabled": true
2019-07-19T14:22:38.131-0700 [DEBUG] plugin.terraform-provider-google_v2.10.0_x4: }```

@ghost
Copy link

ghost commented Aug 19, 2019

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked and limited conversation to collaborators Aug 19, 2019
@github-actions github-actions bot added service/monitoring-alerting forward/review In review; remove label to forward labels Jan 15, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants