From 83339c44b3457889a0ed8e667adff7da5758222a Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2020 20:59:42 +0200 Subject: [PATCH] Slack: moves to \S+ check instead of \w+-\w+ (#863) (#922) * Moves to \S+ check instead of \w+-\w+ * Adds changelog fragment * Update changelogs/fragments/892-slack-token-validation.yml Co-authored-by: Felix Fontein Co-authored-by: Josh VanDeraa Co-authored-by: Felix Fontein (cherry picked from commit 1eb3ab3b276a0fc8ef05d13ff5a70f09032878e1) Co-authored-by: Josh VanDeraa --- changelogs/fragments/892-slack-token-validation.yml | 3 +++ plugins/modules/notification/slack.py | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/892-slack-token-validation.yml diff --git a/changelogs/fragments/892-slack-token-validation.yml b/changelogs/fragments/892-slack-token-validation.yml new file mode 100644 index 0000000000..40eef1fdcc --- /dev/null +++ b/changelogs/fragments/892-slack-token-validation.yml @@ -0,0 +1,3 @@ +--- +bugfixes: + - slack - fix ``xox[abp]`` token identification to capture everything after ``xox[abp]``, as the token is the only thing that should be in this argument (https://github.com/ansible-collections/community.general/issues/862). diff --git a/plugins/modules/notification/slack.py b/plugins/modules/notification/slack.py index be569c4b95..b40937802c 100644 --- a/plugins/modules/notification/slack.py +++ b/plugins/modules/notification/slack.py @@ -314,7 +314,7 @@ def do_notify_slack(module, domain, token, payload): if token.count('/') >= 2: # New style webhook token slack_uri = SLACK_INCOMING_WEBHOOK % (token) - elif re.match(r'^xox[abp]-\w+-\w+$', token): + elif re.match(r'^xox[abp]-\S+$', token): slack_uri = SLACK_POSTMESSAGE_WEBAPI use_webapi = True else: