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

New Intel: Slack #1184

Closed
wants to merge 18 commits into from
Closed

New Intel: Slack #1184

wants to merge 18 commits into from

Conversation

jychp
Copy link
Collaborator

@jychp jychp commented May 29, 2023

Summary

Add intel to sync Slack Teams, Groups, Users and Channels

If you are modifying or implementing a new intel module

  • Update the schema and readme
  • Use our NodeSchema data model
  • Use specialized functions get_, transform_, load_, and cleanup_ functions
  • Add tests
    • Unit tests: Test your transform_ function with sample data
    • Integration tests

@jychp jychp marked this pull request as ready for review May 31, 2023 16:06
Copy link
Collaborator

@ramonpetgrave64 ramonpetgrave64 left a comment

Choose a reason for hiding this comment

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

This is awesome!
Just a few small things to change

slack_client = WebClient(token=config.slack_token)
slack_client.retry_handlers.append(rate_limit_handler)

for team_id in config.slack_teams.split(','):
Copy link
Collaborator

Choose a reason for hiding this comment

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

I know there are different types of slack tokens, and they work a bit differently at the Team and Enterprise levels. But but have you considered using the auth.teams.list method for discovery?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will explore this.

cartography/intel/slack/team.py Outdated Show resolved Hide resolved
cartography/intel/slack/users.py Outdated Show resolved Hide resolved
cartography/intel/slack/users.py Outdated Show resolved Hide resolved
cartography/models/slack/user.py Show resolved Hide resolved
cartography/models/slack/group.py Show resolved Hide resolved
cartography/models/slack/group.py Outdated Show resolved Hide resolved
cartography/models/slack/channels.py Outdated Show resolved Hide resolved
cartography/models/slack/user.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@ramonpetgrave64 ramonpetgrave64 left a comment

Choose a reason for hiding this comment

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

This is awesome!
Just a few small things to change

Copy link
Contributor

@achantavy achantavy left a comment

Choose a reason for hiding this comment

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

Overall it looks good to me, left comments about relationship direction for RESOURCE

cartography/intel/slack/channels.py Show resolved Hide resolved
) -> None:
team = get(slack_client, team_id)
load_team(neo4j_session, team, update_tag)

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, since Team is the sub resource for Slack, I think we can get away with not having an automatic cleanup.

docs/root/modules/slack/schema.md Outdated Show resolved Hide resolved
docs/root/modules/slack/schema.md Outdated Show resolved Hide resolved
docs/root/modules/slack/schema.md Outdated Show resolved Hide resolved
cartography/models/slack/channels.py Outdated Show resolved Hide resolved
cartography/models/slack/group.py Outdated Show resolved Hide resolved
cartography/models/slack/group.py Outdated Show resolved Hide resolved
cartography/models/slack/user.py Outdated Show resolved Hide resolved
cartography/models/slack/user.py Outdated Show resolved Hide resolved
@jychp
Copy link
Collaborator Author

jychp commented Aug 25, 2023

@achantavy @ramonpetgrave64 Two remaining points before we can proceed:

  1. Regarding dynamic team pulling, I suggest using teams IDs provided as arguments. This is because we cannot cleanup sub-resource links on dynamically added items (see cleanup_job condition is too restrictive #1236 )

  2. Regarding manual cleanup, do you have any guidance on how to perform it?

@jychp jychp closed this by deleting the head repository Jan 6, 2024
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.

3 participants