Convert Figma logo to code with AI

cartography-cncf logocartography

Cartography is a Python tool that pulls infrastructure assets and their relationships into a Neo4j graph database.

4,009
551
4,009
102

Top Related Projects

Cartography is a Python tool that pulls infrastructure assets and their relationships into a Neo4j graph database.

Six Degrees of Domain Admin

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.

Rules engine for cloud security, cost optimization, and governance, DSL in yaml for policies to query, filter, and take actions on resources

Quick Overview

Cartography is an open-source tool developed by Lyft that consolidates infrastructure assets and the relationships between them in an intuitive graph view. It helps security teams and engineers visualize and analyze their infrastructure, making it easier to understand complex systems and identify potential security risks.

Pros

  • Provides a comprehensive view of infrastructure assets and their relationships
  • Supports multiple cloud providers and services (AWS, GCP, Azure, etc.)
  • Easily extensible with custom data ingestion modules
  • Helps identify security risks and compliance issues

Cons

  • Requires significant setup and configuration for optimal use
  • Can be resource-intensive for large infrastructures
  • Learning curve for understanding and querying the graph database
  • Limited built-in visualization tools (relies on external tools for advanced visualizations)

Code Examples

# Example 1: Connecting to Neo4j database
from neo4j import GraphDatabase

driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password"))
session = driver.session()
# Example 2: Querying AWS EC2 instances
query = """
MATCH (i:EC2Instance)
RETURN i.instanceid, i.publicdnsname, i.privateipaddress
LIMIT 10
"""
result = session.run(query)
for record in result:
    print(record)
# Example 3: Finding unencrypted S3 buckets
query = """
MATCH (b:S3Bucket)
WHERE b.encrypted = false
RETURN b.name, b.region
"""
result = session.run(query)
for record in result:
    print(f"Unencrypted bucket: {record['b.name']} in {record['b.region']}")

Getting Started

  1. Install Cartography:

    pip install cartography
    
  2. Set up a Neo4j database and configure connection details.

  3. Run Cartography with your cloud provider credentials:

    cartography --neo4j-uri bolt://localhost:7687 --neo4j-username neo4j --neo4j-password password --aws-sync-all-profiles
    
  4. Query the graph database using Neo4j's Cypher query language or integrate with visualization tools like Gephi or Linkurious.

Competitor Comparisons

Cartography is a Python tool that pulls infrastructure assets and their relationships into a Neo4j graph database.

Pros of Cartography

  • Comprehensive cloud infrastructure visualization and analysis tool
  • Supports multiple cloud providers and services
  • Active development and regular updates

Cons of Cartography

  • Steeper learning curve for new users
  • Requires significant setup and configuration
  • May have higher resource requirements for large-scale deployments

Code Comparison

Unfortunately, I cannot provide a meaningful code comparison in this case. The repository "cartography-cncf/cartography" does not exist or is not publicly accessible. The only repository that exists is "cartography-cncf/cartography", which is the main Cartography project.

Cartography is an open-source tool for creating a graph database of your cloud infrastructure and analyzing it. It's designed to help security teams and engineers understand their infrastructure better and identify potential security risks.

Here's a sample code snippet from Cartography:

def load_aws_account_data(
    neo4j_session: neo4j.Session,
    account_id: str,
    update_tag: int,
    common_job_parameters: Dict,
) -> None:
    logger.info("Loading AWS Account %s", account_id)
    query = """
    MERGE (aa:AWSAccount{id: $AccountId})
    ON CREATE SET aa.firstseen = timestamp()
    SET aa.lastupdated = $update_tag
    """
    neo4j_session.run(
        query,
        AccountId=account_id,
        update_tag=update_tag,
    )

This code snippet demonstrates how Cartography interacts with a Neo4j database to store and update AWS account information.

Six Degrees of Domain Admin

Pros of BloodHound-Legacy

  • Specialized for Active Directory environments, providing deep insights into AD security
  • User-friendly GUI for visualizing attack paths and relationships
  • Extensive documentation and community support

Cons of BloodHound-Legacy

  • Limited to Windows/Active Directory environments
  • Requires more manual setup and data collection compared to Cartography
  • Less extensible for custom data sources or cloud environments

Code Comparison

BloodHound-Legacy (PowerShell):

$SearchBase = "DC=contoso,DC=com"
$Computers = Get-ADComputer -Filter * -SearchBase $SearchBase
foreach ($Computer in $Computers) {
    # Collect and process data
}

Cartography (Python):

def sync_ec2_instances(neo4j_session, region, account_id):
    instances = get_ec2_instances(region)
    load_ec2_instances(neo4j_session, instances, region, account_id)
    # Additional processing and relationship mapping

BloodHound-Legacy focuses on Active Directory data collection and analysis, while Cartography offers a more flexible approach for various cloud and on-premises assets. BloodHound-Legacy excels in AD environments, providing detailed attack path analysis, while Cartography offers broader infrastructure visibility and easier integration with diverse data sources.

CloudMapper helps you analyze your Amazon Web Services (AWS) environments.

Pros of CloudMapper

  • Focused specifically on AWS environments, providing detailed visualizations of AWS infrastructure
  • Includes a web-based user interface for easier exploration of generated maps
  • Offers additional security analysis features, such as identifying public-facing assets

Cons of CloudMapper

  • Limited to AWS, while Cartography supports multiple cloud providers and other data sources
  • Less extensible compared to Cartography's graph-based approach
  • Requires more manual configuration and data collection

Code Comparison

CloudMapper (Python):

def parse_arguments():
    parser = argparse.ArgumentParser(description="CloudMapper - AWS visualization tool")
    parser.add_argument("--config", help="Config file name", default="config.json")
    parser.add_argument("--account-name", help="Account name for the graph")
    return parser.parse_args()

Cartography (Python):

def parse_args():
    parser = argparse.ArgumentParser(description='Cartography CLI')
    parser.add_argument('--neo4j-uri', type=str, default='bolt://localhost:7687',
                        help='Neo4j URI to connect to')
    parser.add_argument('--neo4j-user', type=str, default='neo4j', help='Neo4j user to connect with')
    return parser.parse_args()

Both projects use argparse for command-line argument parsing, but Cartography's approach is more focused on Neo4j connection details, reflecting its graph-based architecture.

Rules engine for cloud security, cost optimization, and governance, DSL in yaml for policies to query, filter, and take actions on resources

Pros of Cloud Custodian

  • Multi-cloud support (AWS, Azure, GCP)
  • Extensive policy-as-code capabilities
  • Large community and active development

Cons of Cloud Custodian

  • Steeper learning curve
  • Focused primarily on policy enforcement and remediation
  • Less emphasis on visualization and relationship mapping

Code Comparison

Cloud Custodian (YAML policy):

policies:
  - name: ec2-tag-compliance
    resource: ec2
    filters:
      - "tag:Environment": absent
    actions:
      - type: tag
        key: Environment
        value: Production

Cartography (Python query):

MATCH (n:EC2Instance)
WHERE NOT EXISTS(n.environment)
SET n.environment = 'Production'
RETURN n

Both tools offer ways to manage cloud resources, but Cloud Custodian focuses on policy enforcement through YAML configurations, while Cartography uses graph database queries for analysis and visualization.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Cartography

Cartography is a Python tool that pulls infrastructure assets and their relationships into a Neo4j graph database.

What it connects: AWS, GCP, Azure, Kubernetes, GitHub, Okta, Entra ID, CrowdStrike, and 30+ more platforms.

Questions it answers:

  • Which identities have access to which datastores? How about across multiple tenants, or providers?
  • Am I affected by any critical vulnerabilities or compromised software packages?
  • What are the network paths in and out of my environment?
  • Which compute instances are exposed to the internet?
  • What AI agents are running in production, and what permissions do they have?

Visualization of RDS nodes and AWS nodes

Quick Start

Install Cartography

pip install cartography

Start Neo4j database

docker run -d --publish=7474:7474 --publish=7687:7687 -v data:/data --env=NEO4J_AUTH=none neo4j:5-community

Confirm that http://localhost:7474 is up.

Sync your first data source (AWS example)

Ensure your AWS credentials and default region are configured (e.g. via AWS_PROFILE, AWS_DEFAULT_REGION, or ~/.aws/config). See AWS credentials docs for reference.

Run Cartography:

cartography --neo4j-uri bolt://localhost:7687 --selected-modules aws

See the full install guide for other platforms.

Query the graph

Open http://localhost:7474 and try:

// Find unencrypted RDS instances by account
MATCH (a:AWSAccount)-[:RESOURCE]->(rds:AWSRDSInstance{storage_encrypted:false})
RETURN a.name, rds.id
// Find EC2 instances exposed to the internet
MATCH (instance:AWSEC2Instance{exposed_internet: true})
RETURN instance.instanceid, instance.publicdnsname

See the querying tutorial and data schema for more use-cases.

Run security rules

Once Cartography has populated the reachable Neo4j graph, list, inspect, and run security rules. This quickstart uses the no-auth Neo4j container started above, so no password is required:

cartography-rules list
cartography-rules list object_storage_public
cartography-rules run object_storage_public

For authenticated Neo4j, set NEO4J_PASSWORD or use one of the other secure password options in the rules docs.

Supported platforms

Click to expand full list of 30+ supported platforms
  • Airbyte - Organization, Workspace, User, Source, Destination, Connection, Tag, Stream
  • Amazon Web Services - ACM, API Gateway, Bedrock, CloudWatch, CodeBuild, Config, Cognito, EC2, ECS, ECR (including multi-arch images, image layers, and attestations), EFS, Elasticsearch, Elastic Kubernetes Service (EKS), DynamoDB, Glue, GuardDuty, IAM, Inspector, KMS, Lambda, RDS, Redshift, Route53, S3, SageMaker, Secrets Manager(Secret Versions), Security Hub, SNS, SQS, SSM, STS, Tags
  • AIBOM - AI component detections linked to ECR images
  • Anthropic - Organization, ApiKey, User, Workspace
  • BigFix - Computers
  • Cloudflare - Account, Role, Member, Zone, DNSRecord
  • Crowdstrike Falcon - Hosts, Spotlight vulnerabilities, CVEs
  • DigitalOcean
  • Duo - Users, Groups, Endpoints
  • GitHub - repos, branches, users, teams, dependency graph manifests, dependencies
  • Google Cloud Platform - Artifact Registry, Bigtable, Cloud Functions, Cloud Resource Manager, Cloud Run, Cloud SQL, Compute, DNS, IAM, KMS, Secret Manager, Storage, Google Kubernetes Engine, Vertex AI
  • Google Workspace - users, groups, devices, OAuth apps
  • Jumpcloud
  • Kandji - Devices
  • Keycloak - Realms, Users, Groups, Roles, Scopes, Clients, IdentityProviders, Authentication Flows, Authentication Executions, Organizations, Organization Domains
  • Kubernetes - Cluster, Namespace, Service, Pod, Container, ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding, OIDCProvider
  • Lastpass - users
  • Microsoft Azure - App Service, Container Instance, CosmosDB, Data Factory, Event Grid, Firewall, Firewall Policy, Functions, Key Vault, Azure Kubernetes Service (AKS), Load Balancer, Logic Apps, Management Groups, Resource Group, SQL, Storage, Virtual Machine, Virtual Networks
  • Microsoft Entra ID - Users, Groups, Applications, OUs, App Roles, federation to AWS Identity Center, Intune Managed Devices, Intune Detected Apps, Intune Compliance Policies
  • CVE Metadata - CVE enrichment with CVSS, EPSS scores, and CISA KEV data from NVD and FIRST.org
  • NIST CVE - Common Vulnerabilities and Exposures (CVE) data from NIST database (deprecated - use CVE Metadata instead)
  • Netlify - Accounts, Users, Invites, Sites, Deploys, Functions, Dev Servers, Agent Runners, Database Branches, Database Snapshots, Environment Variables, Build Hooks, Notification Hooks, Deploy Keys, Snippets, Service Instances, DNS Zones, DNS Records, Certificates, Forms
  • Okta - users, groups, organizations, roles, applications, factors, trusted origins, reply URIs, federation to AWS roles, federation to AWS Identity Center
  • OpenAI - Organization, AdminApiKey, User, Project, ServiceAccount, ApiKey
  • Oracle Cloud Infrastructure - IAM
  • PagerDuty - Users, teams, services, schedules, escalation policies, integrations, vendors
  • Railway - Workspaces, Projects, Environments, Services, Service Instances, Deployments, Domains, TCP Proxies, Volumes, Variables, Tokens
  • Scaleway - Projects, IAM, Local Storage, Instances
  • SentinelOne - Accounts, Agents, Applications, Application Versions, CVEs
  • Slack - Teams, Users, UserGroups, Channels
  • SnipeIT - Users, Assets
  • Snowflake - Accounts, Users, Service Users, Roles, Database Roles, Grants, Role Hierarchy, Ownership, Programmatic Access Tokens, Credentials, Warehouses, Compute Pools, Resource Monitors, Databases, Schemas, Tables, Views, Iceberg Tables, Dynamic Tables, Streams, Tasks, Pipes, Stages, External Volumes, Secrets, Network Policies, Network Rules, Policies, Integrations (Security, Storage, API, Catalog, Notification, External Access), Services, Image Repositories, Notebooks, Streamlits, Shares, Listings, Replication Groups
  • Socket.dev - Organizations, Repositories, Dependencies, Security Alerts (CVE, malware, supply chain risks), Fixes
  • Spacelift - Accounts, Spaces,Users, Stacks, WorkerPools, Workers, Runs, GitCommits
  • SubImage - Tenant, TeamMember, APIKey, Neo4jUser, Module, Framework
  • Tailscale - Tailnet, Users, Devices, Groups, Tags, PostureIntegrations, DevicePostures, DevicePostureConditions, device posture compliance relationships
  • Trivy Scanner - AWS ECR Images

Community

Contributing

Thank you for considering contributing to Cartography!

All contributors and participants must follow the CNCF Code of Conduct.

Submit a GitHub issue to report a bug or request a new feature. Larger discussions happen in GitHub Discussions.

Read CONTRIBUTING.md for the issue workflow, development setup, tests, DCO sign-off requirement, and pull request expectations. You do not need an issue assignment or maintainer permission before starting work.

Who uses Cartography?

  1. Lyft
  2. Thought Machine
  3. MessageBird
  4. Cloudanix
  5. Corelight
  6. SubImage
  7. Superhuman
  8. {Your company here} :-)

If your organization uses Cartography, please file a PR and update this list. Say hi on Slack too!

License

This project is licensed under the Apache 2.0 License.


Cartography is a Cloud Native Computing Foundation sandbox project.

CNCF Logo