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

Kandji device #1295

Merged
merged 29 commits into from
Apr 24, 2024
Merged

Kandji device #1295

merged 29 commits into from
Apr 24, 2024

Conversation

chandanchowdhury
Copy link
Collaborator

Add support for Kandji device.

#1293

@chandanchowdhury
Copy link
Collaborator Author

@achantavy Requesting review of this PR

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.

Thank you for the PR! Appreciate you taking the time and effort to adopt cartography patterns used in other modules.

For this PR, let's focus on introducing a Kandji device node and a Kandji account/tenant node. Having a tenant-like node is needed for cartography automatic cleanup jobs to work so that the data in the graph is always up to date. You can copy this PR as a good example: https://github.com/lyft/cartography/pull/1083/files

Let's also defer adding the crowdstrike relationship and the analysis jobs to separate PRs.

Basically just copy that example PR and tag me again when this is ready. @ me on Slack if you need faster answers to fast questions; this way we can be better at the back and forth needed sometimes in these reviews.

Thanks again.

cartography/models/kandji/device.py.backup Outdated Show resolved Hide resolved
tests/integration/cartography/intel/kandji/test_kandji.py Outdated Show resolved Hide resolved
cartography/intel/kandji/devices.py Outdated Show resolved Hide resolved
@chandanchowdhury chandanchowdhury marked this pull request as draft April 19, 2024 23:00
@chandanchowdhury chandanchowdhury marked this pull request as ready for review April 22, 2024 17:57
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.

Almost there, left a note about relationship direction convention. Once that is done, we can merge!

This is looking super clean btw



@dataclass(frozen=True)
# (:KandjiTenant)<-[:DEVICE]-(:KandjiDevice)
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the relationship label is called DEVICE, the convention is to point to the device. Like this:

(:KandjiTenant)-[:DEVICE]->(:KandjiDevice)

So you would do LinkDirection.INWARD.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apologies for the confusion Alex!
The correct relationship is

(:KandjiDevice)-[:ENROLLED_TO]->(:KandjiTenant)

I had updated the doc but forgot to update the comment (fixed now).

Does the relationship makes sense now?

docs/root/modules/kandji/schema.md Show resolved Hide resolved
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.

Thank you for your PR! Appreciate you taking the time to use the patterns and adjust

@achantavy achantavy merged commit 2e9519e into lyft:master Apr 24, 2024
5 checks passed
@chandanchowdhury
Copy link
Collaborator Author

Thank you @achantavy for reviewing the changes and walking me through the steps!

chandanchowdhury added a commit to juju4/cartography that referenced this pull request Jun 26, 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.

2 participants