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

chore(slack): change Slack channel name env variable #4080

Conversation

sergargar
Copy link
Member

Description

Change Slack channel name environment variable from SLACK_CHANNEL_ID to SLACK_CHANNEL_NAME to avoid confusions.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@sergargar sergargar requested review from a team as code owners May 23, 2024 17:24
Copy link
Contributor

You can check the documentation for this PR here -> SaaS Documentation

Copy link

codecov bot commented May 23, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 lines in your changes are missing coverage. Please review.

Project coverage is 86.26%. Comparing base (aa42507) to head (da9be99).

Files Patch % Lines
prowler/__main__.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4080      +/-   ##
==========================================
- Coverage   86.26%   86.26%   -0.01%     
==========================================
  Files         790      790              
  Lines       24729    24729              
==========================================
- Hits        21333    21332       -1     
- Misses       3396     3397       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

if "SLACK_API_TOKEN" in environ and "SLACK_CHANNEL_ID" in environ:
if "SLACK_API_TOKEN" in environ and (
"SLACK_CHANNEL_NAME" in environ or "SLACK_CHANNEL_ID" in environ
):
_ = send_slack_message(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are both values valid in the Slack API?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What API? Those values are parsed by Prowler and then used them as args to the send_slack_message function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean that you are now passing either SLACK_CHANNEL_NAME or SLACK_CHANNEL_ID to the send_slack_message function, and then is used in the following way:

response = client.chat_postMessage(
            username="Prowler",
            icon_url=square_logo_img,
            channel=f"#{channel}",
            blocks=create_message_blocks(identity, logo, stats),
        )

Are both valid when used in the Slack API as channel?

@sergargar sergargar requested a review from jfagoagas May 24, 2024 11:37
Copy link
Member

@jfagoagas jfagoagas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔝

@sergargar sergargar merged commit 4dc2070 into master May 24, 2024
10 of 12 checks passed
@sergargar sergargar deleted the PRWLR-3701-oss-add-slack-channel-name-as-environment-variable branch May 24, 2024 12:15
@sergargar sergargar added backport-v3 Pending to port to Prowler v3 branch and removed backport-v3 Pending to port to Prowler v3 branch labels May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants