cartography 0.73.1__tar.gz → 0.75.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {cartography-0.73.1/cartography.egg-info → cartography-0.75.0}/PKG-INFO +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/client/core/tx.py +42 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/indexes.cypher +1 -3
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_ec2_asset_exposure.json +5 -5
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_ec2_keypair_analysis.json +2 -2
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_eks_asset_exposure.json +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_foreign_accounts.json +2 -2
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/gcp_compute_asset_inet_exposure.json +4 -4
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/gcp_gke_asset_exposure.json +1 -1
- cartography-0.75.0/cartography/data/jobs/analysis/gcp_gke_basic_auth.json +15 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_apigateway_details.json +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_kms_details.json +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_s3_details.json +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/graph/cleanupbuilder.py +18 -38
- {cartography-0.73.1 → cartography-0.75.0}/cartography/graph/job.py +1 -3
- {cartography-0.73.1 → cartography-0.75.0}/cartography/graph/querybuilder.py +80 -3
- {cartography-0.73.1 → cartography-0.75.0}/cartography/graph/statement.py +14 -3
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/apigateway.py +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ecs.py +26 -19
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/emr.py +17 -22
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/iam.py +15 -10
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/kms.py +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/rds.py +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/s3.py +3 -3
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/util/credentials.py +13 -3
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/oci/iam.py +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/cartography/models/aws/emr.py +1 -1
- cartography-0.75.0/cartography/models/core/common.py +58 -0
- {cartography-0.73.1 → cartography-0.75.0/cartography.egg-info}/PKG-INFO +1 -1
- {cartography-0.73.1 → cartography-0.75.0}/setup.py +1 -1
- cartography-0.73.1/cartography/data/jobs/analysis/gcp_gke_basic_auth.json +0 -15
- cartography-0.73.1/cartography/models/core/common.py +0 -38
- {cartography-0.73.1 → cartography-0.75.0}/LICENSE +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/NOTICE +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/README.md +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/__main__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/cli.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/client/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/client/aws/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/client/aws/iam.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/client/core/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/config.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_ec2_iaminstance.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_ec2_iaminstanceprofile.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_lambda_ecr.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_s3acl_analysis.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/gsuite_human_link.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_account_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_dns_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_account_access_key_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_apigateway_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_config_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_dynamodb_tables_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ec2_images_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ec2_instances_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ec2_key_pairs_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ec2_launch_configurations_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ec2_launch_templates_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ec2_security_groupinfo_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ecr_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ecs_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_eks_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_elastic_ip_addresses_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_elasticache_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_es_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_groups_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_groups_membership_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_groups_policy_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_inspector_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_internet_gateways_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_kms_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_lambda_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_principals_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_rds_clusters_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_rds_instances_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_rds_snapshots_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_redshift_clusters_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_reserved_instances_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_roles_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_roles_policy_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_s3_acl_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_s3_buckets_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_secrets_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_securityhub_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_snapshots_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_sqs_queues_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_ssm_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_tags_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_tgw_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_users_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_volumes_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_vpc_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_import_vpc_peering_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_ingest_ec2_auto_scaling_groups_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_ingest_load_balancers_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_ingest_load_balancers_v2_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_ingest_network_interfaces_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_ingest_subnets_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_post_ingestion_principals_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_cosmosdb_cassandra_keyspace_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_cosmosdb_cors_details.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_cosmosdb_mongodb_database_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_cosmosdb_sql_database_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_cosmosdb_table_resources_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_database_account_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_import_disks_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_import_snapshots_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_import_virtual_machines_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_sql_server_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_storage_account_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_subscriptions_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/azure_tenant_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/crowdstrike_import_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/crxcavator_import_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/digitalocean_droplet_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/digitalocean_project_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_compute_firewall_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_compute_forwarding_rules_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_compute_instance_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_compute_vpc_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_compute_vpc_subnet_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_crm_folder_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_crm_organization_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_crm_project_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_dns_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_gke_cluster_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gcp_storage_bucket_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/github_repos_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/github_users_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gsuite_ingest_groups_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/gsuite_ingest_users_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/jamf_import_computers_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/oci_import_compartments_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/oci_import_groups_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/oci_import_groups_membership_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/oci_import_policies_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/oci_import_users_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/oci_tenancy_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/okta_groups_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/okta_import_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/pagerduty_import_cleanup.json +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/data/permission_relationships.yaml +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/__main__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/add_shortcut.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/cli.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/config.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/detect_deviations.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/get_states.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/model.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/reporter.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/serializers.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/shortcut.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/storage.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/driftdetect/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/graph/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/graph/context.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/analysis.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/config.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/dynamodb.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/auto_scaling_groups.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/elastic_ip_addresses.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/images.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/instances.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/internet_gateways.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/key_pairs.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/launch_templates.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/load_balancer_v2s.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/load_balancers.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/network_interfaces.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/reserved_instances.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/security_groups.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/snapshots.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/subnets.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/tgw.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/volumes.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/vpc.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ec2/vpc_peerings.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ecr.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/eks.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/elasticache.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/elasticsearch.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/inspector.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/lambda_function.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/organizations.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/permission_relationships.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/redshift.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/resourcegroupstaggingapi.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/resources.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/route53.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/secretsmanager.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/securityhub.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/sqs.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/ssm.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/util/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/aws/util/common.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/compute.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/cosmosdb.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/sql.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/storage.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/subscription.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/tenant.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/azure/util/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/create_indexes.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/crowdstrike/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/crowdstrike/endpoints.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/crowdstrike/spotlight.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/crowdstrike/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/crxcavator/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/crxcavator/crxcavator.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/cve/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/cve/feed.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/digitalocean/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/digitalocean/compute.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/digitalocean/management.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/digitalocean/platform.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/dns.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gcp/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gcp/compute.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gcp/crm.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gcp/dns.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gcp/gke.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gcp/storage.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/github/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/github/repos.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/github/users.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/github/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gsuite/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/gsuite/api.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/jamf/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/jamf/computers.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/jamf/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/kubernetes/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/kubernetes/namespaces.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/kubernetes/pods.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/kubernetes/secrets.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/kubernetes/services.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/kubernetes/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/oci/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/oci/organizations.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/oci/utils.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/applications.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/awssaml.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/factors.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/groups.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/organization.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/origins.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/roles.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/sync_state.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/users.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/okta/utils.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/escalation_policies.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/schedules.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/services.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/teams.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/users.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/intel/pagerduty/vendors.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/models/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/models/aws/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/models/core/__init__.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/models/core/nodes.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/models/core/relationships.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/py.typed +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/stats.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/sync.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography/util.py +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography.egg-info/SOURCES.txt +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography.egg-info/dependency_links.txt +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography.egg-info/entry_points.txt +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography.egg-info/requires.txt +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/cartography.egg-info/top_level.txt +0 -0
- {cartography-0.73.1 → cartography-0.75.0}/setup.cfg +0 -0
|
@@ -7,6 +7,9 @@ from typing import Union
|
|
|
7
7
|
|
|
8
8
|
import neo4j
|
|
9
9
|
|
|
10
|
+
from cartography.graph.querybuilder import build_create_index_queries
|
|
11
|
+
from cartography.graph.querybuilder import build_ingestion_query
|
|
12
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
10
13
|
from cartography.util import batch
|
|
11
14
|
|
|
12
15
|
|
|
@@ -210,3 +213,42 @@ def load_graph_data(
|
|
|
210
213
|
DictList=data_batch,
|
|
211
214
|
**kwargs,
|
|
212
215
|
)
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
def ensure_indexes(neo4j_session: neo4j.Session, node_schema: CartographyNodeSchema) -> None:
|
|
219
|
+
"""
|
|
220
|
+
Creates indexes if they don't exist for the given CartographyNodeSchema object, as well as for all of the
|
|
221
|
+
relationships defined on its `other_relationships` and `sub_resource_relationship` fields. This operation is
|
|
222
|
+
idempotent.
|
|
223
|
+
|
|
224
|
+
This ensures that every time we need to MATCH on a node to draw a relationship to it, the field used for the MATCH
|
|
225
|
+
will be indexed, making the operation fast.
|
|
226
|
+
:param neo4j_session: The neo4j session
|
|
227
|
+
:param node_schema: The node_schema object to create indexes for.
|
|
228
|
+
"""
|
|
229
|
+
queries = build_create_index_queries(node_schema)
|
|
230
|
+
|
|
231
|
+
for query in queries:
|
|
232
|
+
if not query.startswith('CREATE INDEX IF NOT EXISTS'):
|
|
233
|
+
raise ValueError('Query provided to `ensure_indexes()` does not start with "CREATE INDEX IF NOT EXISTS".')
|
|
234
|
+
neo4j_session.run(query)
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def load(
|
|
238
|
+
neo4j_session: neo4j.Session,
|
|
239
|
+
node_schema: CartographyNodeSchema,
|
|
240
|
+
dict_list: List[Dict[str, Any]],
|
|
241
|
+
**kwargs,
|
|
242
|
+
) -> None:
|
|
243
|
+
"""
|
|
244
|
+
Main entrypoint for intel modules to write data to the graph. Ensures that indexes exist for the datatypes loaded
|
|
245
|
+
to the graph and then performs the load operation.
|
|
246
|
+
:param neo4j_session: The Neo4j session
|
|
247
|
+
:param node_schema: The CartographyNodeSchema object to create indexes for and generate a query.
|
|
248
|
+
:param dict_list: The data to load to the graph represented as a list of dicts.
|
|
249
|
+
:param kwargs: Allows additional keyword args to be supplied to the Neo4j query.
|
|
250
|
+
:return: None
|
|
251
|
+
"""
|
|
252
|
+
ensure_indexes(neo4j_session, node_schema)
|
|
253
|
+
ingestion_query = build_ingestion_query(node_schema)
|
|
254
|
+
load_graph_data(neo4j_session, ingestion_query, dict_list, **kwargs)
|
|
@@ -140,6 +140,7 @@ CREATE INDEX IF NOT EXISTS FOR (n:ECSContainerInstance) ON (n.lastupdated);
|
|
|
140
140
|
CREATE INDEX IF NOT EXISTS FOR (n:ECSService) ON (n.id);
|
|
141
141
|
CREATE INDEX IF NOT EXISTS FOR (n:ECSService) ON (n.lastupdated);
|
|
142
142
|
CREATE INDEX IF NOT EXISTS FOR (n:ECSTaskDefinition) ON (n.id);
|
|
143
|
+
CREATE INDEX IF NOT EXISTS FOR (n:ECSTaskDefinition) ON (n.arn);
|
|
143
144
|
CREATE INDEX IF NOT EXISTS FOR (n:ECSTaskDefinition) ON (n.lastupdated);
|
|
144
145
|
CREATE INDEX IF NOT EXISTS FOR (n:ECSTask) ON (n.id);
|
|
145
146
|
CREATE INDEX IF NOT EXISTS FOR (n:ECSTask) ON (n.lastupdated);
|
|
@@ -158,9 +159,6 @@ CREATE INDEX IF NOT EXISTS FOR (n:ELBListener) ON (n.id);
|
|
|
158
159
|
CREATE INDEX IF NOT EXISTS FOR (n:ELBListener) ON (n.lastupdated);
|
|
159
160
|
CREATE INDEX IF NOT EXISTS FOR (n:ELBV2Listener) ON (n.id);
|
|
160
161
|
CREATE INDEX IF NOT EXISTS FOR (n:ELBV2Listener) ON (n.lastupdated);
|
|
161
|
-
CREATE INDEX IF NOT EXISTS FOR (n:EMRCluster) ON (n.id);
|
|
162
|
-
CREATE INDEX IF NOT EXISTS FOR (n:EMRCluster) ON (n.arn);
|
|
163
|
-
CREATE INDEX IF NOT EXISTS FOR (n:EMRCluster) ON (n.lastupdated);
|
|
164
162
|
CREATE INDEX IF NOT EXISTS FOR (n:Endpoint) ON (n.id);
|
|
165
163
|
CREATE INDEX IF NOT EXISTS FOR (n:Endpoint) ON (n.lastupdated);
|
|
166
164
|
CREATE INDEX IF NOT EXISTS FOR (n:ESDomain) ON (n.arn);
|
{cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_ec2_asset_exposure.json
RENAMED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
|
-
"query": "MATCH (n) where
|
|
4
|
+
"query": "MATCH (n) where n.exposed_internet IS NOT NULL AND labels(n) IN ['AutoScalingGroup', 'EC2Instance', 'LoadBalancer', 'LoadBalancerV2'] WITH n LIMIT $LIMIT_SIZE REMOVE n.exposed_internet, n.exposed_internet_type return COUNT(*) as TotalCompleted",
|
|
5
5
|
"iterative": true,
|
|
6
6
|
"iterationsize": 1000
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
|
-
"query": "MATCH (:IpRange{id: '0.0.0.0/0'})-[:MEMBER_OF_IP_RULE]->(:IpPermissionInbound)-[:MEMBER_OF_EC2_SECURITY_GROUP]->(group:EC2SecurityGroup)<-[:MEMBER_OF_EC2_SECURITY_GROUP|NETWORK_INTERFACE*..2]-(instance:EC2Instance)\nWITH instance\nWHERE (
|
|
9
|
+
"query": "MATCH (:IpRange{id: '0.0.0.0/0'})-[:MEMBER_OF_IP_RULE]->(:IpPermissionInbound)-[:MEMBER_OF_EC2_SECURITY_GROUP]->(group:EC2SecurityGroup)<-[:MEMBER_OF_EC2_SECURITY_GROUP|NETWORK_INTERFACE*..2]-(instance:EC2Instance)\nWITH instance\nWHERE (instance.publicipaddress IS NOT NULL) AND (instance.exposed_internet_type IS NULL) OR (NOT 'direct' IN instance.exposed_internet_type)\nSET instance.exposed_internet = true, instance.exposed_internet_type = coalesce(instance.exposed_internet_type , []) + 'direct';",
|
|
10
10
|
"iterative": false
|
|
11
11
|
},
|
|
12
12
|
{
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
"iterative": false
|
|
19
19
|
},
|
|
20
20
|
{
|
|
21
|
-
"query": "MATCH (elb:LoadBalancer{exposed_internet: true})-[:EXPOSE]->(e:EC2Instance)\nWITH e\nWHERE (
|
|
21
|
+
"query": "MATCH (elb:LoadBalancer{exposed_internet: true})-[:EXPOSE]->(e:EC2Instance)\nWITH e\nWHERE (e.exposed_internet_type IS NULL) OR (NOT 'elb' IN e.exposed_internet_type)\nSET e.exposed_internet = true, e.exposed_internet_type = coalesce(e.exposed_internet_type, []) + 'elb'",
|
|
22
22
|
"iterative": false
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
"query": "MATCH (elbv2:LoadBalancerV2{exposed_internet: true})-[:EXPOSE]->(e:EC2Instance)\nWITH e\nWHERE (
|
|
25
|
+
"query": "MATCH (elbv2:LoadBalancerV2{exposed_internet: true})-[:EXPOSE]->(e:EC2Instance)\nWITH e\nWHERE (e.exposed_internet_type IS NULL) OR (NOT 'elbv2' IN e.exposed_internet_type)\nSET e.exposed_internet = true, e.exposed_internet_type = coalesce(e.exposed_internet_type, []) + 'elbv2'",
|
|
26
26
|
"iterative": false
|
|
27
27
|
},
|
|
28
28
|
{
|
|
29
|
-
"query": "MATCH (instance:EC2Instance{exposed_internet: true})-[:MEMBER_AUTO_SCALE_GROUP]->(asg:AutoScalingGroup)\nWITH distinct instance.exposed_internet_type as types, asg\nUNWIND types as type\nWITH type, asg\nWHERE
|
|
29
|
+
"query": "MATCH (instance:EC2Instance{exposed_internet: true})-[:MEMBER_AUTO_SCALE_GROUP]->(asg:AutoScalingGroup)\nWITH distinct instance.exposed_internet_type as types, asg\nUNWIND types as type\nWITH type, asg\nWHERE asg.exposed_internet_type IS NULL OR (NOT type IN asg.exposed_internet_type)\nSET asg.exposed_internet = true, asg.exposed_internet_type = coalesce(asg.exposed_internet_type, []) + type;",
|
|
30
30
|
"iterative": false
|
|
31
31
|
}
|
|
32
32
|
],
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
"statements": [
|
|
4
4
|
{
|
|
5
5
|
"__comment__": "Delete the attribute user_uploaded",
|
|
6
|
-
"query": "MATCH (k:EC2KeyPair) WHERE
|
|
6
|
+
"query": "MATCH (k:EC2KeyPair) WHERE k.user_uploaded IS NOT NULL REMOVE k.user_uploaded return COUNT(*) as TotalCompleted",
|
|
7
7
|
"iterative": false
|
|
8
8
|
},
|
|
9
9
|
{
|
|
10
10
|
"__comment__": "Delete the attribute duplicate_keyfingerprint",
|
|
11
|
-
"query": "MATCH (k:EC2KeyPair) WHERE
|
|
11
|
+
"query": "MATCH (k:EC2KeyPair) WHERE k.duplicate_keyfingerprint IS NOT NULL REMOVE k.duplicate_keyfingerprint return COUNT(*) as TotalCompleted",
|
|
12
12
|
"iterative": false
|
|
13
13
|
},
|
|
14
14
|
{
|
{cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_eks_asset_exposure.json
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
4
|
"__comment": "This is a clean-up statement to remove custom attributes",
|
|
5
|
-
"query": "MATCH (cluster:EKSCluster) WHERE
|
|
5
|
+
"query": "MATCH (cluster:EKSCluster) WHERE cluster.exposed_internet IS NOT NULL REMOVE cluster.exposed_internet return COUNT(*) as TotalCompleted",
|
|
6
6
|
"iterative": false
|
|
7
7
|
},
|
|
8
8
|
{
|
{cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/aws_foreign_accounts.json
RENAMED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
4
|
"__comment": "This analyze AWS accounts we created and tag the ones that are foreign. Foreign accounts are ones that were not in the sync scope",
|
|
5
|
-
"query": "MATCH (foreign:AWSAccount) where
|
|
5
|
+
"query": "MATCH (foreign:AWSAccount) where foreign.inscope IS NULL SET foreign.foreign = true",
|
|
6
6
|
"iterative": false
|
|
7
7
|
},
|
|
8
8
|
{
|
|
9
9
|
"__comment": "Remove accounts that were set with foreign and inscope. This can happen as we finish the list of sync accounts through assume role mapping and vpc peering",
|
|
10
|
-
"query": "MATCH (a:AWSAccount) where
|
|
10
|
+
"query": "MATCH (a:AWSAccount) where a.inscope IS NOT NULL AND a.foreign IS NOT NULL REMOVE a.foreign",
|
|
11
11
|
"iterative": false
|
|
12
12
|
}
|
|
13
13
|
],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
|
-
"query": "MATCH (n) where
|
|
4
|
+
"query": "MATCH (n) where n.exposed_internet IS NOT NULL AND labels(n) IN ['GCPInstance'] WITH n LIMIT $LIMIT_SIZE REMOVE n.exposed_internet, n.exposed_internet_type return COUNT(*) as TotalCompleted",
|
|
5
5
|
"iterative": true,
|
|
6
6
|
"iterationsize": 1000,
|
|
7
7
|
"__comment__": "Delete exposed_internet off nodes so we can start fresh"
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"__comment__": "Delete stale firewall ingress relationships"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
|
-
"query": "MATCH (ac:GCPNicAccessConfig)<-[:RESOURCE]-(:GCPNetworkInterface)<-[:NETWORK_INTERFACE]-(n:GCPInstance)<-[:FIREWALL_INGRESS]-(firewall_a:GCPFirewall)<-[:ALLOWED_BY]-(allow_rule:GCPIpRule{protocol:'tcp'})<-[:MEMBER_OF_IP_RULE]-(:IpRange{id:\"0.0.0.0/0\"})\nOPTIONAL MATCH (n)<-[:FIREWALL_INGRESS]-(firewall_b:GCPFirewall)<-[:DENIED_BY]-(deny_rule:GCPIpRule{protocol:'tcp'})\nWHERE
|
|
25
|
+
"query": "MATCH (ac:GCPNicAccessConfig)<-[:RESOURCE]-(:GCPNetworkInterface)<-[:NETWORK_INTERFACE]-(n:GCPInstance)<-[:FIREWALL_INGRESS]-(firewall_a:GCPFirewall)<-[:ALLOWED_BY]-(allow_rule:GCPIpRule{protocol:'tcp'})<-[:MEMBER_OF_IP_RULE]-(:IpRange{id:\"0.0.0.0/0\"})\nOPTIONAL MATCH (n)<-[:FIREWALL_INGRESS]-(firewall_b:GCPFirewall)<-[:DENIED_BY]-(deny_rule:GCPIpRule{protocol:'tcp'})\nWHERE ac.public_ip IS NOT NULL and (\n\tdeny_rule is NULL\n\tOR firewall_b.priority > firewall_a.priority\n\tOR NOT allow_rule.fromport IN RANGE(deny_rule.fromport, deny_rule.toport)\n\tOR NOT allow_rule.toport IN RANGE(deny_rule.fromport, deny_rule.toport)\n)\nSET n.exposed_internet = True, n.exposed_internet_type='direct'\nRETURN count(*) as TotalCompleted",
|
|
26
26
|
"iterative": false,
|
|
27
27
|
"__comment__": "Mark a GCP instance with exposed_internet = True and exposed_internet_type = 'direct' if its attached firewalls and TCP rules expose it to the internet."
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
|
-
"query": "MATCH (ac:GCPNicAccessConfig)<-[:RESOURCE]-(:GCPNetworkInterface)<-[:NETWORK_INTERFACE]-(n:GCPInstance)<-[:FIREWALL_INGRESS]-(firewall_a:GCPFirewall)<-[:ALLOWED_BY]-(allow_rule:GCPIpRule{protocol:'udp'})<-[:MEMBER_OF_IP_RULE]-(:IpRange{id:\"0.0.0.0/0\"})\nOPTIONAL MATCH (n)<-[:FIREWALL_INGRESS]-(firewall_b:GCPFirewall)<-[:DENIED_BY]-(deny_rule:GCPIpRule{protocol:'udp'})\nWHERE
|
|
30
|
+
"query": "MATCH (ac:GCPNicAccessConfig)<-[:RESOURCE]-(:GCPNetworkInterface)<-[:NETWORK_INTERFACE]-(n:GCPInstance)<-[:FIREWALL_INGRESS]-(firewall_a:GCPFirewall)<-[:ALLOWED_BY]-(allow_rule:GCPIpRule{protocol:'udp'})<-[:MEMBER_OF_IP_RULE]-(:IpRange{id:\"0.0.0.0/0\"})\nOPTIONAL MATCH (n)<-[:FIREWALL_INGRESS]-(firewall_b:GCPFirewall)<-[:DENIED_BY]-(deny_rule:GCPIpRule{protocol:'udp'})\nWHERE ac.public_ip IS NOT NULL and (\n\tdeny_rule is NULL\n\tOR firewall_b.priority > firewall_a.priority\n\tOR NOT allow_rule.fromport IN RANGE(deny_rule.fromport, deny_rule.toport)\n\tOR NOT allow_rule.toport IN RANGE(deny_rule.fromport, deny_rule.toport)\n)\nSET n.exposed_internet = True, n.exposed_internet_type='direct'\nRETURN count(*) as TotalCompleted",
|
|
31
31
|
"iterative": false,
|
|
32
32
|
"__comment__": "Mark a GCP instance with exposed_internet = True and exposed_internet_type = 'direct' if its attached firewalls and UDP rules expose it to the internet."
|
|
33
33
|
},
|
|
34
34
|
{
|
|
35
|
-
"query": "MATCH (ac:GCPNicAccessConfig)<-[:RESOURCE]-(:GCPNetworkInterface)<-[:NETWORK_INTERFACE]-(n:GCPInstance)<-[:FIREWALL_INGRESS]-(firewall_a:GCPFirewall)<-[:ALLOWED_BY]-(allow_rule:GCPIpRule{protocol:'all'})<-[:MEMBER_OF_IP_RULE]-(:IpRange{id:\"0.0.0.0/0\"})\nOPTIONAL MATCH (n)<-[:FIREWALL_INGRESS]-(firewall_b:GCPFirewall)<-[:DENIED_BY]-(deny_rule:GCPIpRule{protocol:'all'})\nWHERE
|
|
35
|
+
"query": "MATCH (ac:GCPNicAccessConfig)<-[:RESOURCE]-(:GCPNetworkInterface)<-[:NETWORK_INTERFACE]-(n:GCPInstance)<-[:FIREWALL_INGRESS]-(firewall_a:GCPFirewall)<-[:ALLOWED_BY]-(allow_rule:GCPIpRule{protocol:'all'})<-[:MEMBER_OF_IP_RULE]-(:IpRange{id:\"0.0.0.0/0\"})\nOPTIONAL MATCH (n)<-[:FIREWALL_INGRESS]-(firewall_b:GCPFirewall)<-[:DENIED_BY]-(deny_rule:GCPIpRule{protocol:'all'})\nWHERE ac.public_ip IS NOT NULL and allow_rule.fromport IS NOT NULL and allow_rule.toport IS NOT NULL and (\n\tdeny_rule is NULL\n\tOR firewall_b.priority > firewall_a.priority\n\tOR NOT allow_rule.fromport IN RANGE(deny_rule.fromport, deny_rule.toport)\n\tOR NOT allow_rule.toport IN RANGE(deny_rule.fromport, deny_rule.toport)\n)\nSET n.exposed_internet = True, n.exposed_internet_type='direct'\nRETURN count(*) as TotalCompleted",
|
|
36
36
|
"iterative": false,
|
|
37
37
|
"__comment__": "Mark a GCP instance with exposed_internet = True and exposed_internet_type = 'direct' if its attached firewalls and ALL rules expose it to the internet."
|
|
38
38
|
}
|
{cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/analysis/gcp_gke_asset_exposure.json
RENAMED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
4
|
"__comment": "This is a clean-up statement to remove custom attributes",
|
|
5
|
-
"query": "MATCH (cluster:GKECluster) WHERE
|
|
5
|
+
"query": "MATCH (cluster:GKECluster) WHERE cluster.exposed_internet IS NOT NULL REMOVE cluster.exposed_internet return COUNT(*) as TotalCompleted",
|
|
6
6
|
"iterative": false
|
|
7
7
|
},
|
|
8
8
|
{
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"statements": [
|
|
3
|
+
{
|
|
4
|
+
"__comment": "This is a clean-up statement to remove custom attributes",
|
|
5
|
+
"query": "MATCH (cluster:GKECluster) WHERE cluster.basic_auth IS NOT NULL REMOVE cluster.basic_auth return COUNT(*) as TotalCompleted",
|
|
6
|
+
"iterative": false
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
"__comment": "This sets the basic_auth attribute",
|
|
10
|
+
"query": "MATCH (cluster:GKECluster) WHERE (cluster.masterauth_username IS NOT NULL AND NOT cluster.masterauth_username = '') AND (cluster.masterauth_password IS NOT NULL AND NOT cluster.masterauth.password = '') SET cluster.basic_auth = true",
|
|
11
|
+
"iterative": false
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"name": "GCP GKE basic authentication exposure"
|
|
15
|
+
}
|
{cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_apigateway_details.json
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
|
-
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(s:RestAPI) WHERE
|
|
4
|
+
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(s:RestAPI) WHERE s.anonymous_access IS NOT NULL\n WITH s LIMIT $LIMIT_SIZE\nREMOVE s.anonymous_access, s.anonymous_actions",
|
|
5
5
|
"iterative": true,
|
|
6
6
|
"iterationsize": 100
|
|
7
7
|
}
|
{cartography-0.73.1 → cartography-0.75.0}/cartography/data/jobs/cleanup/aws_kms_details.json
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
|
-
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(s:KMSKey) WHERE
|
|
4
|
+
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(s:KMSKey) WHERE s.anonymous_access IS NOT NULL\n WITH s LIMIT $LIMIT_SIZE\nREMOVE s.anonymous_access, s.anonymous_actions",
|
|
5
5
|
"iterative": true,
|
|
6
6
|
"iterationsize": 100
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"statements": [
|
|
3
3
|
{
|
|
4
|
-
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(s:S3Bucket) WHERE
|
|
4
|
+
"query": "MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(s:S3Bucket) WHERE s.anonymous_access IS NOT NULL\n WITH s LIMIT $LIMIT_SIZE\nREMOVE s.anonymous_access, s.anonymous_actions",
|
|
5
5
|
"iterative": true,
|
|
6
6
|
"iterationsize": 100
|
|
7
7
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
from dataclasses import asdict
|
|
2
2
|
from string import Template
|
|
3
3
|
from typing import List
|
|
4
|
-
from typing import Optional
|
|
5
|
-
from typing import Set
|
|
6
4
|
|
|
7
5
|
from cartography.graph.querybuilder import _build_match_clause
|
|
8
|
-
from cartography.graph.querybuilder import filter_selected_relationships
|
|
9
6
|
from cartography.graph.querybuilder import rel_present_on_node_schema
|
|
10
7
|
from cartography.models.core.nodes import CartographyNodeSchema
|
|
11
8
|
from cartography.models.core.relationships import CartographyRelSchema
|
|
@@ -13,49 +10,32 @@ from cartography.models.core.relationships import LinkDirection
|
|
|
13
10
|
from cartography.models.core.relationships import TargetNodeMatcher
|
|
14
11
|
|
|
15
12
|
|
|
16
|
-
def build_cleanup_queries(
|
|
17
|
-
node_schema: CartographyNodeSchema,
|
|
18
|
-
selected_rels: Optional[Set[CartographyRelSchema]] = None,
|
|
19
|
-
) -> List[str]:
|
|
13
|
+
def build_cleanup_queries(node_schema: CartographyNodeSchema) -> List[str]:
|
|
20
14
|
"""
|
|
21
15
|
Generates queries to clean up stale nodes and relationships from the given CartographyNodeSchema.
|
|
22
|
-
|
|
23
|
-
:
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
leaving orphaned objects behind.
|
|
32
|
-
Note also that we return the empty list if the node_schema has no relationships. Doing cleanups of nodes without
|
|
33
|
-
relationships can be resource expensive for a large graph, and you might risk deleting unintended objects. Please
|
|
34
|
-
write a manual cleanup job if you wish to do this.
|
|
16
|
+
Note that auto-cleanups for a node with no relationships is not currently supported.
|
|
17
|
+
Algorithm:
|
|
18
|
+
1. First delete all stale nodes attached to the node_schema's sub resource
|
|
19
|
+
2. Delete all stale node to sub resource relationships
|
|
20
|
+
- We don't expect this to be very common (never for AWS resources, at least), but in case it is possible for an
|
|
21
|
+
asset to change sub resources, we want to handle it properly.
|
|
22
|
+
3. For all relationships defined on the node schema, delete all stale ones.
|
|
23
|
+
:param node_schema: The given CartographyNodeSchema
|
|
24
|
+
:return: A list of Neo4j queries to clean up nodes and relationships.
|
|
35
25
|
"""
|
|
36
|
-
|
|
37
|
-
sub_resource_rel = node_schema.sub_resource_relationship
|
|
38
|
-
|
|
39
|
-
if selected_rels:
|
|
40
|
-
# Ensure that the selected rels actually exist on the node_schema
|
|
41
|
-
sub_resource_rel, other_rels = filter_selected_relationships(node_schema, selected_rels)
|
|
42
|
-
|
|
43
|
-
if not sub_resource_rel:
|
|
26
|
+
if not node_schema.sub_resource_relationship:
|
|
44
27
|
raise ValueError(
|
|
45
28
|
"Auto-creating a cleanup job for a node_schema without a sub resource relationship is not supported. "
|
|
46
|
-
f'Please check the class definition of "{node_schema.__class__.__name__}".
|
|
47
|
-
'param was specified to build_cleanup_queries(), then ensure that the sub resource relationship is '
|
|
48
|
-
'present.',
|
|
29
|
+
f'Please check the class definition of "{node_schema.__class__.__name__}".',
|
|
49
30
|
)
|
|
50
31
|
|
|
51
|
-
result =
|
|
52
|
-
if
|
|
53
|
-
for rel in
|
|
54
|
-
|
|
32
|
+
result = _build_cleanup_node_and_rel_queries(node_schema, node_schema.sub_resource_relationship)
|
|
33
|
+
if node_schema.other_relationships:
|
|
34
|
+
for rel in node_schema.other_relationships.rels:
|
|
35
|
+
# [0] is the delete node query, [1] is the delete relationship query. We only want the latter.
|
|
36
|
+
_, rel_query = _build_cleanup_node_and_rel_queries(node_schema, rel)
|
|
37
|
+
result.append(rel_query)
|
|
55
38
|
|
|
56
|
-
# Make sure that the sub resource cleanup job is last in the list; order matters.
|
|
57
|
-
result.extend(_build_cleanup_node_and_rel_queries(node_schema, sub_resource_rel))
|
|
58
|
-
# Note that auto-cleanups for a node with no relationships does not happen at all - we don't support it.
|
|
59
39
|
return result
|
|
60
40
|
|
|
61
41
|
|
|
@@ -16,7 +16,6 @@ from cartography.graph.cleanupbuilder import build_cleanup_queries
|
|
|
16
16
|
from cartography.graph.statement import get_job_shortname
|
|
17
17
|
from cartography.graph.statement import GraphStatement
|
|
18
18
|
from cartography.models.core.nodes import CartographyNodeSchema
|
|
19
|
-
from cartography.models.core.relationships import CartographyRelSchema
|
|
20
19
|
|
|
21
20
|
logger = logging.getLogger(__name__)
|
|
22
21
|
|
|
@@ -129,14 +128,13 @@ class GraphJob:
|
|
|
129
128
|
cls,
|
|
130
129
|
node_schema: CartographyNodeSchema,
|
|
131
130
|
parameters: Dict[str, Any],
|
|
132
|
-
selected_rels: Optional[Set[CartographyRelSchema]] = None,
|
|
133
131
|
) -> 'GraphJob':
|
|
134
132
|
"""
|
|
135
133
|
Create a cleanup job from a CartographyNodeSchema object.
|
|
136
134
|
For a given node, the fields used in the node_schema.sub_resource_relationship.target_node_node_matcher.keys()
|
|
137
135
|
must be provided as keys and values in the params dict.
|
|
138
136
|
"""
|
|
139
|
-
queries: List[str] = build_cleanup_queries(node_schema
|
|
137
|
+
queries: List[str] = build_cleanup_queries(node_schema)
|
|
140
138
|
|
|
141
139
|
expected_param_keys: Set[str] = get_parameters(queries)
|
|
142
140
|
actual_param_keys: Set[str] = set(parameters.keys())
|
|
@@ -2,6 +2,7 @@ import logging
|
|
|
2
2
|
from dataclasses import asdict
|
|
3
3
|
from string import Template
|
|
4
4
|
from typing import Dict
|
|
5
|
+
from typing import List
|
|
5
6
|
from typing import Optional
|
|
6
7
|
from typing import Set
|
|
7
8
|
from typing import Tuple
|
|
@@ -108,6 +109,28 @@ def _build_match_clause(matcher: TargetNodeMatcher) -> str:
|
|
|
108
109
|
return ', '.join(match.safe_substitute(Key=key, PropRef=prop_ref) for key, prop_ref in matcher_asdict.items())
|
|
109
110
|
|
|
110
111
|
|
|
112
|
+
def _build_where_clause_for_rel_match(node_var: str, matcher: TargetNodeMatcher) -> str:
|
|
113
|
+
"""
|
|
114
|
+
Same as _build_match_clause, but puts the matching logic in a WHERE clause.
|
|
115
|
+
This is intended specifically to use for joining with relationships where we need a case-insensitive match.
|
|
116
|
+
:param matcher: A TargetNodeMatcher object
|
|
117
|
+
:return: a Neo4j where clause
|
|
118
|
+
"""
|
|
119
|
+
match = Template("$node_var.$key = $prop_ref")
|
|
120
|
+
case_insensitive_match = Template("toLower($node_var.$key) = toLower($prop_ref)")
|
|
121
|
+
|
|
122
|
+
matcher_asdict = asdict(matcher)
|
|
123
|
+
|
|
124
|
+
result = []
|
|
125
|
+
for key, prop_ref in matcher_asdict.items():
|
|
126
|
+
if prop_ref.ignore_case:
|
|
127
|
+
prop_line = case_insensitive_match.safe_substitute(node_var=node_var, key=key, prop_ref=prop_ref)
|
|
128
|
+
else:
|
|
129
|
+
prop_line = match.safe_substitute(node_var=node_var, key=key, prop_ref=prop_ref)
|
|
130
|
+
result.append(prop_line)
|
|
131
|
+
return ' AND\n'.join(result)
|
|
132
|
+
|
|
133
|
+
|
|
111
134
|
def _asdict_with_validate_relprops(link: CartographyRelSchema) -> Dict[str, PropertyRef]:
|
|
112
135
|
"""
|
|
113
136
|
Give a helpful error message when forgetting to put `()` when instantiating a CartographyRelSchema, as this
|
|
@@ -145,6 +168,7 @@ def _build_attach_sub_resource_statement(sub_resource_link: Optional[Cartography
|
|
|
145
168
|
|
|
146
169
|
sub_resource_attach_template = Template(
|
|
147
170
|
"""
|
|
171
|
+
WITH i, item
|
|
148
172
|
OPTIONAL MATCH (j:$SubResourceLabel{$MatchClause})
|
|
149
173
|
WITH i, item, j WHERE j IS NOT NULL
|
|
150
174
|
$RelMergeClause
|
|
@@ -191,7 +215,9 @@ def _build_attach_additional_links_statement(
|
|
|
191
215
|
additional_links_template = Template(
|
|
192
216
|
"""
|
|
193
217
|
WITH i, item
|
|
194
|
-
OPTIONAL MATCH ($node_var:$AddlLabel
|
|
218
|
+
OPTIONAL MATCH ($node_var:$AddlLabel)
|
|
219
|
+
WHERE
|
|
220
|
+
$WhereClause
|
|
195
221
|
WITH i, item, $node_var WHERE $node_var IS NOT NULL
|
|
196
222
|
$RelMerge
|
|
197
223
|
ON CREATE SET $rel_var.firstseen = timestamp()
|
|
@@ -219,7 +245,7 @@ def _build_attach_additional_links_statement(
|
|
|
219
245
|
|
|
220
246
|
additional_ref = additional_links_template.safe_substitute(
|
|
221
247
|
AddlLabel=link.target_node_label,
|
|
222
|
-
|
|
248
|
+
WhereClause=_build_where_clause_for_rel_match(node_var, link.target_node_matcher),
|
|
223
249
|
node_var=node_var,
|
|
224
250
|
rel_var=rel_var,
|
|
225
251
|
RelMerge=rel_merge,
|
|
@@ -258,7 +284,6 @@ def _build_attach_relationships_statement(
|
|
|
258
284
|
"""
|
|
259
285
|
WITH i, item
|
|
260
286
|
CALL {
|
|
261
|
-
WITH i, item
|
|
262
287
|
$attach_relationships_statement
|
|
263
288
|
}
|
|
264
289
|
""",
|
|
@@ -374,3 +399,55 @@ def build_ingestion_query(
|
|
|
374
399
|
attach_relationships_statement=_build_attach_relationships_statement(sub_resource_rel, other_rels),
|
|
375
400
|
)
|
|
376
401
|
return ingest_query
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
def build_create_index_queries(node_schema: CartographyNodeSchema) -> List[str]:
|
|
405
|
+
"""
|
|
406
|
+
Generate queries to create indexes for the given CartographyNodeSchema and all node types attached to it via its
|
|
407
|
+
relationships.
|
|
408
|
+
:param node_schema: The Cartography node_schema object
|
|
409
|
+
:return: A list of queries of the form `CREATE INDEX IF NOT EXISTS FOR (n:$TargetNodeLabel) ON (n.$TargetAttribute)`
|
|
410
|
+
"""
|
|
411
|
+
index_template = Template('CREATE INDEX IF NOT EXISTS FOR (n:$TargetNodeLabel) ON (n.$TargetAttribute);')
|
|
412
|
+
|
|
413
|
+
# First ensure an index exists for the node_schema and all extra labels on the `id` and `lastupdated` fields
|
|
414
|
+
result = [
|
|
415
|
+
index_template.safe_substitute(
|
|
416
|
+
TargetNodeLabel=node_schema.label,
|
|
417
|
+
TargetAttribute='id',
|
|
418
|
+
),
|
|
419
|
+
index_template.safe_substitute(
|
|
420
|
+
TargetNodeLabel=node_schema.label,
|
|
421
|
+
TargetAttribute='lastupdated',
|
|
422
|
+
),
|
|
423
|
+
]
|
|
424
|
+
if node_schema.extra_node_labels:
|
|
425
|
+
result.extend([
|
|
426
|
+
index_template.safe_substitute(
|
|
427
|
+
TargetNodeLabel=label,
|
|
428
|
+
TargetAttribute='id', # Precondition: 'id' is defined on all cartography node_schema objects.
|
|
429
|
+
) for label in node_schema.extra_node_labels.labels
|
|
430
|
+
])
|
|
431
|
+
|
|
432
|
+
# Next, for all relationships possible out of this node, ensure that indexes exist for all target nodes' properties
|
|
433
|
+
# as specified in their TargetNodeMatchers.
|
|
434
|
+
rel_schemas = []
|
|
435
|
+
if node_schema.sub_resource_relationship:
|
|
436
|
+
rel_schemas.extend([node_schema.sub_resource_relationship])
|
|
437
|
+
if node_schema.other_relationships:
|
|
438
|
+
rel_schemas.extend(node_schema.other_relationships.rels)
|
|
439
|
+
for rs in rel_schemas:
|
|
440
|
+
for target_key in asdict(rs.target_node_matcher).keys():
|
|
441
|
+
result.append(
|
|
442
|
+
index_template.safe_substitute(TargetNodeLabel=rs.target_node_label, TargetAttribute=target_key),
|
|
443
|
+
)
|
|
444
|
+
|
|
445
|
+
# Now, include extra indexes defined by the module author on the node schema's property refs.
|
|
446
|
+
node_props_as_dict: Dict[str, PropertyRef] = asdict(node_schema.properties)
|
|
447
|
+
result.extend([
|
|
448
|
+
index_template.safe_substitute(
|
|
449
|
+
TargetNodeLabel=node_schema.label,
|
|
450
|
+
TargetAttribute=prop_name,
|
|
451
|
+
) for prop_name, prop_ref in node_props_as_dict.items() if prop_ref.extra_index
|
|
452
|
+
])
|
|
453
|
+
return result
|
|
@@ -4,6 +4,7 @@ import os
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
from typing import Any
|
|
6
6
|
from typing import Dict
|
|
7
|
+
from typing import Optional
|
|
7
8
|
from typing import Union
|
|
8
9
|
|
|
9
10
|
import neo4j
|
|
@@ -40,8 +41,13 @@ class GraphStatement:
|
|
|
40
41
|
"""
|
|
41
42
|
|
|
42
43
|
def __init__(
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
self,
|
|
45
|
+
query: str,
|
|
46
|
+
parameters: Optional[Dict[Any, Any]] = None,
|
|
47
|
+
iterative: bool = False,
|
|
48
|
+
iterationsize: int = 0,
|
|
49
|
+
parent_job_name: Optional[str] = None,
|
|
50
|
+
parent_job_sequence_num: Optional[int] = None,
|
|
45
51
|
):
|
|
46
52
|
self.query = query
|
|
47
53
|
self.parameters = parameters or {}
|
|
@@ -122,7 +128,12 @@ class GraphStatement:
|
|
|
122
128
|
result.consume()
|
|
123
129
|
|
|
124
130
|
@classmethod
|
|
125
|
-
def create_from_json(
|
|
131
|
+
def create_from_json(
|
|
132
|
+
cls,
|
|
133
|
+
json_obj: Dict[str, Any],
|
|
134
|
+
short_job_name: Optional[str] = None,
|
|
135
|
+
job_sequence_num: Optional[int] = None,
|
|
136
|
+
):
|
|
126
137
|
"""
|
|
127
138
|
Create a statement from a JSON blob.
|
|
128
139
|
"""
|
|
@@ -171,7 +171,7 @@ def _load_apigateway_policies(
|
|
|
171
171
|
def _set_default_values(neo4j_session: neo4j.Session, aws_account_id: str) -> None:
|
|
172
172
|
set_defaults = """
|
|
173
173
|
MATCH (:AWSAccount{id: $AWS_ID})-[:RESOURCE]->(restApi:APIGatewayRestAPI)
|
|
174
|
-
where
|
|
174
|
+
where restApi.anonymous_actions IS NULL
|
|
175
175
|
SET restApi.anonymous_access = false, restApi.anonymous_actions = []
|
|
176
176
|
"""
|
|
177
177
|
|
|
@@ -91,16 +91,16 @@ def get_ecs_services(cluster_arn: str, boto3_session: boto3.session.Session, reg
|
|
|
91
91
|
|
|
92
92
|
@timeit
|
|
93
93
|
@aws_handle_regions
|
|
94
|
-
def get_ecs_task_definitions(
|
|
94
|
+
def get_ecs_task_definitions(
|
|
95
|
+
boto3_session: boto3.session.Session,
|
|
96
|
+
region: str,
|
|
97
|
+
tasks: List[Dict[str, Any]],
|
|
98
|
+
) -> List[Dict[str, Any]]:
|
|
95
99
|
client = boto3_session.client('ecs', region_name=region)
|
|
96
|
-
paginator = client.get_paginator('list_task_definitions')
|
|
97
100
|
task_definitions: List[Dict[str, Any]] = []
|
|
98
|
-
|
|
99
|
-
for page in paginator.paginate():
|
|
100
|
-
task_definition_arns.extend(page.get('taskDefinitionArns', []))
|
|
101
|
-
for arn in task_definition_arns:
|
|
101
|
+
for task in tasks:
|
|
102
102
|
task_definition = client.describe_task_definition(
|
|
103
|
-
taskDefinition=
|
|
103
|
+
taskDefinition=task['taskDefinitionArn'],
|
|
104
104
|
)
|
|
105
105
|
task_definitions.append(task_definition['taskDefinition'])
|
|
106
106
|
return task_definitions
|
|
@@ -294,7 +294,8 @@ def load_ecs_task_definitions(
|
|
|
294
294
|
UNWIND $Definitions AS def
|
|
295
295
|
MERGE (d:ECSTaskDefinition{id: def.taskDefinitionArn})
|
|
296
296
|
ON CREATE SET d.firstseen = timestamp()
|
|
297
|
-
SET d.arn = def.taskDefinitionArn,
|
|
297
|
+
SET d.arn = def.taskDefinitionArn,
|
|
298
|
+
d.region = $Region,
|
|
298
299
|
d.family = def.family,
|
|
299
300
|
d.task_role_arn = def.taskRoleArn,
|
|
300
301
|
d.execution_role_arn = def.executionRoleArn,
|
|
@@ -317,6 +318,11 @@ def load_ecs_task_definitions(
|
|
|
317
318
|
d.ephemeral_storage_size_in_gib = def.ephemeralStorage.sizeInGiB,
|
|
318
319
|
d.lastupdated = $aws_update_tag
|
|
319
320
|
WITH d
|
|
321
|
+
MATCH (task:ECSTask{task_definition_arn: d.arn})
|
|
322
|
+
MERGE (task)-[r:HAS_TASK_DEFINITION]->(d)
|
|
323
|
+
ON CREATE SET r.firstseen = timestamp()
|
|
324
|
+
SET r.lastupdated = $aws_update_tag
|
|
325
|
+
WITH d
|
|
320
326
|
MATCH (owner:AWSAccount{id: $AWS_ACCOUNT_ID})
|
|
321
327
|
MERGE (owner)-[r:RESOURCE]->(d)
|
|
322
328
|
ON CREATE SET r.firstseen = timestamp()
|
|
@@ -565,17 +571,6 @@ def sync(
|
|
|
565
571
|
current_aws_account_id,
|
|
566
572
|
update_tag,
|
|
567
573
|
)
|
|
568
|
-
task_definitions = get_ecs_task_definitions(
|
|
569
|
-
boto3_session,
|
|
570
|
-
region,
|
|
571
|
-
)
|
|
572
|
-
load_ecs_task_definitions(
|
|
573
|
-
neo4j_session,
|
|
574
|
-
task_definitions,
|
|
575
|
-
region,
|
|
576
|
-
current_aws_account_id,
|
|
577
|
-
update_tag,
|
|
578
|
-
)
|
|
579
574
|
services = get_ecs_services(
|
|
580
575
|
cluster_arn,
|
|
581
576
|
boto3_session,
|
|
@@ -602,4 +597,16 @@ def sync(
|
|
|
602
597
|
current_aws_account_id,
|
|
603
598
|
update_tag,
|
|
604
599
|
)
|
|
600
|
+
task_definitions = get_ecs_task_definitions(
|
|
601
|
+
boto3_session,
|
|
602
|
+
region,
|
|
603
|
+
tasks,
|
|
604
|
+
)
|
|
605
|
+
load_ecs_task_definitions(
|
|
606
|
+
neo4j_session,
|
|
607
|
+
task_definitions,
|
|
608
|
+
region,
|
|
609
|
+
current_aws_account_id,
|
|
610
|
+
update_tag,
|
|
611
|
+
)
|
|
605
612
|
cleanup_ecs(neo4j_session, common_job_parameters)
|