Replies: 7 comments
-
Here's why I restricted this. In most cases, legacy Cartography modules have ingestion queries that use a keyword argument to identify the tenant. For example, here's AWS ECR identifying the owner account and here's GCP DNSZones identifying the owner project. I wrote the querybuilder code as an abstraction around this. For example the parameters supplied to and we tell the data model where to find that value here: Theoretically, we could remove I'm open to other thoughts and reconsidering but for the Gandi module and the Slack module, I don't think it's that much of a big lift to specify a kwarg to the tenant id in the call to |
Beta Was this translation helpful? Give feedback.
-
Oh, one more follow up on the examples you provided (those are very good call-outs):
When the data model refactor is done, I intend for all assets to have a relationship back to the owning tenant. Then automatic cleanups will work. |
Beta Was this translation helpful? Give feedback.
-
I'm catching myself going back and forth on whether this condition is too restrictive. @ramonpetgrave64 what do you think? |
Beta Was this translation helpful? Give feedback.
-
@achantavy, it's primarily a matter of defining the edge resource rather than restricting it or not. With the definition you provided (i.e., the edge resource is the link between the tenant and all the elements of that tenant) to represent a tenant, a zone within it, and a record, I need:
With a broader definition (i.e., the edge resource is any composition link between an element and a set of elements that compose it), we can limit it to:
However, having security that prevents a "Root node" like a tenant from being deleted seems like a good idea, but perhaps it needs to be implemented differently. |
Beta Was this translation helpful? Give feedback.
-
I agree that having every item tie back to a tenant feels verbose, but I like it for consistency and keeping things organized especially in environments where there are multiple zones in multiple tenants with similar names. |
Beta Was this translation helpful? Give feedback.
-
Also agree that the way we have it now requiring all nodes be directly attached to a Tenant node does unintuitive at first. But it lets us write the load and cleanup queries in a reliable way. Still, we'd appreciate help to make the query builders more flexible. Side note: As is, I have doubts if it will work well when a resource exists in multiple tenants, like with AWS IAM's foreign principals. |
Beta Was this translation helpful? Give feedback.
-
I don't know of any examples of a resource belonging to multiple tenants. With AWS principals, a principal belongs to one tenant but can have trust relationships to another. Therefore there will still only be one tenant relationship. |
Beta Was this translation helpful? Give feedback.
-
Ref: https://github.com/lyft/cartography/blob/ab04b205ee942700e352e5c8911d8a596c8c38d2/cartography/graph/cleanupbuilder.py#L148
Description:
Cleanup job requires that 'TargetNodeMatcher PropertyRefs in the sub_resource_relationship must have set_in_kwargs=True.'.
This condition is very restrictive and block cleanup for simple intel modules.
Ex:
To Reproduce:
You can test this issue on #1235
Logs:
Beta Was this translation helpful? Give feedback.
All reactions