fluxcd / notification-controller

The GitOps Toolkit event forwarded and notification dispatcher

Home Page:https://fluxcd.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

notification controller does not strip new line and the end of URL

gecube opened this issue · comments

Hi!

  1. get the URL from Slack https://hooks.slack.com/services/*****/*****/*****
  2. convert it to base64:
echo https://hooks.slack.com/services/*****/*****/***** | base64 
aHR0c***********************************wCg==
  1. put it into secret.
  2. get the error in notification controller:
{"level":"error","ts":"2024-03-09T14:07:40.439Z","logger":"event-server","msg":"failed to dispatch notification","eventInvolvedObject":{"kind":"Kustomization","namespace":"flux-system","name":"databases","uid":"2023d4c3-d3f8-4f6f-8438-a090f8138cae","apiVersion":"kustomize.toolkit.fluxcd.io/v1","resourceVersion":"101895664"},"Alert":{"name":"slack-p1","namespace":"flux-system"},"error":"failed to initialize notifier for provider 'slack-p1': failed to initialize notifier: invalid Slack hook URL https://hooks.slack.com/services/*****/*****/*****\n: 'parse \"https://hooks.slack.com/services/*****/*****/*****\\n\": net/url: invalid control character in URL'"}

Expected behaviour:

if the URL with the trailing \n - then just strip it.