Skip to content

[PLGN-699] - Microsoft Teams- Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users#2298

Merged
rbowden-r7 merged 3 commits intodevelopfrom
PLGN-699
Feb 7, 2024
Merged

[PLGN-699] - Microsoft Teams- Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users#2298
rbowden-r7 merged 3 commits intodevelopfrom
PLGN-699

Conversation

@rbowden-r7
Copy link
Copy Markdown
Collaborator

@rbowden-r7 rbowden-r7 commented Feb 7, 2024

Proposed Changes

Description

Describe the proposed changes:

The users had notided when using a channel name such alerts as in input paramater, the messages were sometimes instead getting posted to a differenert channel high severity alerts. This was due to us getting all channel names, then using that list to find out the id of the chanel to post the message to. As we were using regex serach to determine a match, if the list of channels came back with high severity alerts first in the list the message would be posted there rather than to alerts.

  • I have updated this form search to match to ensure that we are always selecting the correct channel
  • Added in missing example to help.md

https://rapid7.atlassian.net/browse/PLGN-699

PR Requirements

Developers, verify you have completed the following items by checking them off:

Testing

Unit Tests

Review our documentation on generating and writing plugin unit tests

  • Unit tests written for any new or updated code

In-Product Tests

tests have been ran using docker and postman and the tests were now consitent of the correct channel being selected

If you are an InsightConnect customer or have access to an InsightConnect instance, the following in-product tests should be done:

  • Screenshot of job output with the plugin changes
  • Screenshot of the changed connection, actions, or triggers input within the InsightConnect workflow builder

Style

Review the style guide

  • For dependencies, pin OS package and Python package versions
  • For security, set least privileged account with USER nobody in the Dockerfile when possible
  • For size, use the slim SDK images when possible: rapid7/insightconnect-python-3-38-slim-plugin:{sdk-version-num} and rapid7/insightconnect-python-3-38-plugin:{sdk-version-num}
  • For error handling, use of PluginException and ConnectionTestException
  • For logging, use self.logger
  • For docs, use changelog style
  • For docs, validate markdown with insight-plugin validate which calls icon_validate to lint help.md

Functional Checklist

  • Work fully completed
  • Functional
    • Any new actions/triggers include JSON test files in the tests/ directory created with insight-plugin samples
    • Tests should all pass unless it's a negative test. Negative tests have a naming convention of tests/$action_bad.json
    • Unsuccessful tests should fail by raising an exception causing the plugin to die and an object should be returned on successful test
    • Add functioning test results to PR, sanitize any output if necessary
      • Single action/trigger insight-plugin run -T tests/example.json --debug --jq
      • All actions/triggers shortcut insight-plugin run -T all --debug --jq (use PR format at end)
    • Add functioning run results to PR, sanitize any output if necessary
      • Single action/trigger insight-plugin run -R tests/example.json --debug --jq
      • All actions/triggers shortcut insight-plugin run --debug --jq (use PR format at end)

Assessment

You must validate your work to reviewers:

  1. Run insight-plugin validate and make sure everything passes
  2. Run the assessment tool: insight-plugin run -A. For single action validation: insight-plugin run tests/{file}.json -A
  3. Copy (insight-plugin ... | pbcopy) and paste the output in a new post on this PR
  4. Add required screenshots from the In-Product Tests section

example of search, where if high severity alerts comes before alerts we get back not the correct id we want
image

example of match , where if high severity alerts comes before alerts we get back the correct id we want
image

…channel ids based on the channel names supplied by users
@rbowden-r7 rbowden-r7 self-assigned this Feb 7, 2024
@rbowden-r7 rbowden-r7 closed this Feb 7, 2024
@rbowden-r7 rbowden-r7 reopened this Feb 7, 2024
@rbowden-r7 rbowden-r7 changed the title PLGN-699-Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users [PLGN-699] - Microsoft Teams- Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users Feb 7, 2024
@rbowden-r7 rbowden-r7 merged commit fa96a85 into develop Feb 7, 2024
joneill-r7 pushed a commit that referenced this pull request Feb 7, 2024
…rch when getting the channel ids based on the channel names supplied by users (#2298)

* PLGN-699-Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users

* PLGN-699-Updating the help.md version message

* PLGN-699 - fix typo
rbowden-r7 added a commit that referenced this pull request Feb 7, 2024
…rch when getting the channel ids based on the channel names supplied by users (#2298)

* PLGN-699-Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users

* PLGN-699-Updating the help.md version message

* PLGN-699 - fix typo
rbowden-r7 added a commit that referenced this pull request Feb 7, 2024
* [PLGN-699] - Microsoft Teams- Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users (#2298)

* PLGN-699-Using regex match rather than regex search when getting the channel ids based on the channel names supplied by users

* PLGN-699-Updating the help.md version message

* PLGN-699 - fix typo

* PLGN-697 - Using urllib parse to ensure any symbols in the team name are parsed correctly (#2299)

PLGN-697-Adding the updates to help.md file

PLGN-697-making api capitalized in the help.md

PLGN-697-Updating unit test to reflect new url encoding
@joneill-r7 joneill-r7 deleted the PLGN-699 branch December 23, 2024 17:38
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

Successfully merging this pull request may close these issues.

4 participants