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

[Slack] Add slack integration #3278

Merged
merged 11 commits into from
Aug 14, 2022
Merged

Conversation

legoguy1000
Copy link
Contributor

@legoguy1000 legoguy1000 commented May 4, 2022

What does this PR do?

Create an initial Slack integration to view audit logs

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Screenshots

@elasticmachine
Copy link

elasticmachine commented May 4, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-08-09T00:20:44.956+0000

  • Duration: 15 min 19 sec

Test stats 🧪

Test Results
Failed 0
Passed 5
Skipped 0
Total 5

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@andrewkroh andrewkroh added the Integration:slack Slack Logs label May 5, 2022
@andrewkroh
Copy link
Member

/test

packages/slack/manifest.yml Show resolved Hide resolved
packages/slack/_dev/build/docs/README.md Outdated Show resolved Hide resolved
packages/slack/_dev/build/docs/README.md Outdated Show resolved Hide resolved
packages/slack/_dev/deploy/docker/docker-compose.yml Outdated Show resolved Hide resolved
packages/slack/_dev/deploy/docker/files/config.yml Outdated Show resolved Hide resolved
packages/slack/_dev/deploy/docker/files/config.yml Outdated Show resolved Hide resolved
@elasticmachine
Copy link

Pinging @elastic/security-external-integrations (Team:Security-External Integrations)

@andrewkroh andrewkroh requested a review from a team May 5, 2022 17:05
@jamiehynds
Copy link

jamiehynds commented May 6, 2022

@legoguy1000 Thanks for the PR. Do you know how the outh2 authentication works for this Slack integration? @P1llus and I had some discussions with Slack in the past and it seemed each Slack user would have to approve it, rather than an admin approving for the entire organization. I think this was the case for the Events API, but looks like you're hitting the Alerts API with this integration so hopefully it just requires admin approval.

@legoguy1000
Copy link
Contributor Author

So there are different kinds of apps that can be made with different oauth scopes. For things like Google drive/mail/calendar... Each user can enable the app to connect their account to their slack account. But for something like this, the scopes are org/enterprise wide. Slack got rid of the legacy method to create API keys to manage the workspace, so an "app" is the only way to create a key with scopes like that. I think the misleading thing is it's not really an "app" in the traditional way when thinking of slack integrations.

@legoguy1000
Copy link
Contributor Author

While I'm limited in my ability to test the audit logs because of the enterprise plan requirement, I did test the concept on the access logs API and a few others and was able to pull the data without issue.

@jamiehynds jamiehynds mentioned this pull request May 11, 2022
15 tasks
@andrewkroh
Copy link
Member

/test

@legoguy1000 legoguy1000 force-pushed the slack-audit branch 2 times, most recently from c6deef6 to c684bbb Compare May 27, 2022 23:44
@legoguy1000
Copy link
Contributor Author

fixed errors, ready to retest

@legoguy1000
Copy link
Contributor Author

@andrewkroh can we rerun the tests?

@andrewkroh
Copy link
Member

/test

@elasticmachine
Copy link

elasticmachine commented Jun 21, 2022

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (1/1) 💚 2.863
Classes 100.0% (1/1) 💚 2.863
Methods 100.0% (14/14) 💚 10.738
Lines 98.588% (349/354) 👍 7.951
Conditionals 100.0% (0/0) 💚

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM with the exception of the rate limit behavior; I think that needs a manual verification that it's working.

@andrewkroh
Copy link
Member

/test

@andrewkroh
Copy link
Member

/test

@legoguy1000
Copy link
Contributor Author

@andrewkroh I was able to mock the API and the Rate Limiting works as expected. When a 429 is returned the agent waits the set amount of seconds.
image

@efd6
Copy link
Contributor

efd6 commented Aug 9, 2022

/test

Copy link
Member

@andrewkroh andrewkroh left a comment

Choose a reason for hiding this comment

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

LGTM. Once elastic/elastic-package#821 is implemented we should revisit the testing to make the assertion automated.

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.

Slack
6 participants