-
Notifications
You must be signed in to change notification settings - Fork 344
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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
cleanup_job condition is too restrictive #1236
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 |
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. |
I'm catching myself going back and forth on whether this condition is too restrictive. @ramonpetgrave64 what do you think? |
@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. |
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. |
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. |
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. |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
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:
The text was updated successfully, but these errors were encountered: