StackStorm / StackStorm/st2

Disable Rule show value of Secret Action Field

Open
#6,125 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
6.5k
Forks
787
PR merge metrics
No merged PRs in 30d

Description

SUMMARY

Provide a quick summary of your bug report.

STACKSTORM VERSION

Paste the output of st2 --version:
st2 3.8.1

OS, environment, install method

Post what OS you are running this on, along with any other relevant information/

Deploy with Ansible
RHEL8 VM

Description

If you create a rule and configure the webhook for the Teams channel (Secret field), the URL is masked and that's what it's supposed to be.
If you deactivate the rule and refresh the page, the webhook URL is displayed in plain text
And vice versa, i.e. if the rule is deactivated and you enter the page again, the url is masked, but is displayed in plain text again when activated (+refresh). And the URL is corrupted. You have to copy the webhook-url again, only then the rule works again.

Teams channel Action and YAML File:

YAML

---
name: "send_teams_message"
runner_type: "python-script"
description: "Send Message to Teams Channel."
enabled: true
entry_point: "send_teams_message.py"
parameters:
    webhook_url:
        type: "string"
        description: "Webhook Teamschannel Integration."
        required: true
        secret: true
        position: 0
    sectionTitle:
        type: "string"
        description: "Webhook Teamschannel Integration."
        required: true
        default: "Groot Agent: Groot have fix Test"
        position: 1
    activityTitle:
        type: "string"
        description: "Webhook Teamschannel Integration."
        default: "activityTitle"
        required: true
        position: 2
    activitySubtitle:
        type: "string"
        description: "Webhook Teamschannel Integration."
        required: true
        default: "activitySubtitle"
        position: 3
    activityText:
        type: "string"
        description: "Webhook Teamschannel Integration."
        required: true
        default: "activityText"
        position: 4
    text:
        type: "string"
        description: "Webhook Teamschannel Integration."
        required: true
        default: "Text"
        position: 5

Action:

import pymsteams
from lib.base import BaseActionMsTeams


class send_teams_message(BaseActionMsTeams):
    def getTeamsMessage(
        self, sectionTitle, activityTitle, activitySubtitle, activityText, text
    ):
        myMessageSection = pymsteams.cardsection()
        myMessageSection.title(sectionTitle)
        myMessageSection.activityTitle(activityTitle)
        myMessageSection.activitySubtitle(activitySubtitle)
        myMessageSection.activityImage(
            "https://avatars.githubusercontent.com/u/4969009?s=200&v=4"
        )
        myMessageSection.activityText(activityText)
        myMessageSection.text(text)
        myMessageSection.addImage(
            "https://avatars.githubusercontent.com/u/4969009?s=200&v=4",
            ititle="Stackstorm Logo",
        )
        return myMessageSection

    def sendTeamsMessage(self, webhook_url, myMessageSection):
        myTeamsMessage = pymsteams.connectorcard(webhook_url)

        myTeamsMessage.addSection(myMessageSection)
        myTeamsMessage.summary("I am GROOT!")
        myTeamsMessage.send()
        last_status_code = myTeamsMessage.last_http_response.status_code
        return last_status_code

    def run(
        self,
        webhook_url,
        sectionTitle,
        activityTitle,
        activitySubtitle,
        activityText,
        text,
    ):
        if webhook_url == "none":
            webhook_url = self.web_hook_global
        teams_section = self.getTeamsMessage(
            sectionTitle, activityTitle, activitySubtitle, activityText, text
        )
        teams_message = self.sendTeamsMessage(webhook_url, teams_section)

        if teams_message == 200:
            return (True, teams_message)
        else:
            print(teams_message)
            raise ValueError(f"Sending failes.")
```

Thanks!

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue provides a rule YAML definition and its Python Teams action, but names no repository files or tests. Start by reproducing the rule deactivation, activation, and refresh flow for the secret webhook field; done means the value stays masked, remains usable, and is not corrupted after either state change.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
frontend, security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.