Cartography Cartography Cartography
/

Basic Use

  • Quick start: Install and Run Cartography On Test Machine
  • Usage
    • Command Line Interface
    • Cartography Rules
    • Usage Tutorial
    • How to use Drift-Detection
    • Building around Cartography
    • Sample queries
    • Cartography Schema
      • Cartography metadata schema
    • AWS IAM Privilege Escalation Permission Candidates
  • Cartography Production Operations

Intel Modules

  • Intel Modules
    • AIBOM
      • AIBOM Configuration
      • AIBOM Schema
      • AIBOM Examples
    • Airbyte
      • Airbyte Configuration
      • Airbyte Schema
    • Anthropic
      • Anthropic Configuration
      • Anthropic Schema
    • Amazon Web Services (AWS)
      • AWS Configuration
      • Permissions Mapping
      • AWS Organizations
      • AWS Infrastructure Investigations
      • AWS Container Images
      • AWS Identity and Access Investigations
      • AWS Tagging and Labels
      • AWS Schema
    • Microsoft Azure
      • Azure Configuration
      • Permissions Mapping
      • Azure Modeling Notes
      • Azure Queries
      • Azure Network Security Analysis
      • Azure Schema
    • BBOT
      • BBOT Configuration
      • Bbot Schema
    • BigFix
      • BigFix Configuration
      • Bigfix Schema
    • CircleCI
      • CircleCI Configuration
      • Circleci Schema
    • Cloudflare
      • Cloudflare Configuration
      • Cloudflare Schema
    • Crowdstrike
      • CrowdStrike Configuration
      • Crowdstrike Schema
    • CVE
      • CVE Configuration
      • Cve Schema
    • CVE Metadata
      • CVE Metadata Configuration
      • Cve Metadata Schema
    • Databricks
      • Databricks Configuration
      • Databricks Queries
      • Databricks Schema
    • DigitalOcean
      • DigitalOcean Configuration
      • Digitalocean Schema
    • Docker Scout
      • Docker Scout Configuration
      • Docker Scout Schema
    • Duo
      • Duo Configuration
      • Duo Schema
    • Google Cloud Platform (GCP)
      • GCP Configuration
      • Artifact Registry
      • Cloud Run
      • Permissions Mapping
      • GCP Schema
    • GitHub
      • GitHub Configuration
      • Github Schema
    • GitLab
      • GitLab Configuration
      • GitLab Example Queries
      • Gitlab Schema
    • Google Workspace
      • Google Workspace Configuration
      • Googleworkspace Schema
    • Google GSuite
      • GSuite Configuration
      • Gsuite Schema
    • Jamf
      • Jamf Configuration
      • Jamf Schema
    • JumpCloud
      • JumpCloud Configuration
      • Jumpcloud Schema
    • Kandji
      • Kandji Configuration
      • Kandji Schema
    • Keycloak
      • Keycloak Configuration
      • Keycloak Schema
      • Keycloak Built-In Analysis
    • Kubernetes
      • Kubernetes Configuration
      • Kubernetes Queries
      • Kubernetes Schema
    • LastPass
      • LastPass Configuration
      • Lastpass Schema
    • Microsoft
      • Microsoft Configuration
      • Microsoft Schema
      • Microsoft Examples
      • Microsoft Analysis
    • Miradore
      • Miradore Configuration
      • Miradore Schema
    • Modal
      • Modal Configuration
      • Modal Schema
    • Netlify
      • Netlify Configuration
      • Netlify Schema
    • Oracle Cloud Infrastructure
      • OCI Configuration
      • OCI Schema
    • Okta
      • Okta Configuration
      • Okta Schema
    • Ontology in Cartography
      • Ontology Configuration
      • Ontology Schema
    • OpenAI
      • OpenAI Configuration
      • Openai Schema
    • PagerDuty
      • PagerDuty Configuration
      • Pagerduty Schema
    • Railway
      • Railway Configuration
      • Railway Schema
    • Salesforce
      • Salesforce Configuration
      • Salesforce Schema
    • Scaleway
      • Scaleway Configuration
      • Scaleway Schema
    • Semgrep
      • Semgrep Configuration
      • Semgrep Schema
      • Semgrep Analysis
    • SentinelOne
      • SentinelOne Configuration
      • SentinelOne Schema
    • Sentry
      • Sentry Configuration
      • Sentry Schema
    • Slack
      • Slack Configuration
      • Slack Schema
    • SnipeIT
      • SnipeIT Configuration
      • Snipeit Schema
    • Snowflake
      • Snowflake Configuration
      • Snowflake Schema
    • Socket.dev
      • Socket.dev Configuration
      • Socket.dev Schema
    • Spacelift
      • Spacelift Configuration
      • Spacelift Schema
    • SubImage
      • SubImage Configuration
      • Subimage Schema
    • Supabase
      • Supabase Configuration
      • Supabase Schema
    • Syft
      • Syft Configuration
      • Syft Schema
      • Syft Queries
    • Tailscale
      • Tailscale Configuration
      • Tailscale Schema
    • Tenable
      • Tenable Configuration
      • Tenable Schema
    • Trivy
      • Trivy Configuration
      • Trivy Schema
    • Ubuntu Security
      • Ubuntu Security Configuration
      • Ubuntu Schema
    • Vercel
      • Vercel Configuration
      • Vercel Schema
    • Wiz
      • Wiz Configuration
      • Wiz Schema
    • Workday
      • Workday Configuration
      • Workday Schema
      • Sample Cypher Queries
    • WorkOS
      • WorkOS Configuration
      • Workos Schema

Development Docs

  • Developer docs
    • Cartography Developer Guide
    • How to extend Cartography with Analysis Jobs
    • How to write a new intel module
    • MatchLinks

References

  • Model
  • ORM
  • Sync
  • AWS Client
  • DriftDetect
  • Rules

Get In Touch

  • Contact
  • Community Meeting

On this page

  • A note on token privilege
  • A note on the Modal API
  • A note on secrets
  • A note on web endpoint authentication
  • A note on function configuration
  • A note on scoping and completeness
cartography 0 0
Edit this page
  1. Cartography /
  2. Intel Modules /
  3. Modal /
  4. Modal Configuration
View as Markdown Open in ChatGPT Open in Claude

Modal Configuration#

Follow these steps to analyze a Modal workspace with Cartography.

  1. Create an API token in the Modal dashboard under Settings -> API Tokens, or with modal token new. You will get a token id (starting with ak-) and a token secret (starting with as-). The secret is shown only once.

  2. Populate an environment variable with the token secret. You can pass the environment variable name with the --modal-token-secret-env-var flag.

  3. Pass the token id with the --modal-token-id flag. The workspace to sync is derived from the token itself, so there is nothing else to identify.

  4. Optionally restrict which environments have their contents synced with --modal-environments, a comma-separated list of environment names.

A note on token privilege#

Modal has no read-only API token scope. A token carries every privilege of the identity it belongs to, so a personal token grants Cartography your full access to the workspace. Prefer creating a dedicated service user and granting it the viewer environment role on the environments you want inventoried. The workspace node records which credential performed the sync (synced_with_principal_type), so you can check this from the graph.

A note on the Modal API#

Modal publishes no REST management API: everything goes through gRPC behind the Python client. Only part of the inventory is reachable through Modal’s documented public helpers, so this module talks to Modal’s internal gRPC protocol for the rest. That protocol is unversioned and can change in any Modal release, which is why the dependency is pinned to modal>=1.5.3,<2. The lower bound matters too: the RPC used for per-environment RBAC only exists from 1.5.3. All of it is isolated in cartography/intel/modal/util.py, so a protocol break should require changes in that one file.

A note on secrets#

Modal never returns secret values through any read API, so Cartography cannot and does not store them. Only metadata (name, creation time, last-used time) is ingested.

More importantly, the mapping from an app or function to the secrets it consumes is write-only in Modal’s API: Function.secret_ids is sent when a function is deployed but is never returned when reading it back. Cartography therefore cannot produce (:ModalFunction)-[:USES_SECRET]->(:ModalSecret) edges. Secret consumption can only be determined from your source code.

A note on web endpoint authentication#

Whether a web endpoint requires proxy authentication (requires_proxy_auth) is also write-only and cannot be read back. Cartography records a function’s web_url but cannot tell you whether that URL is protected. Treat every non-null ModalFunction.web_url as potentially reachable without authentication, and confirm out of band.

A note on function configuration#

For the same reason, a deployed function’s GPU, CPU, memory, region, cloud, mounted volumes, block_network, untrusted, proxy and schedule/cron settings are not readable and are absent from ModalFunction. Sandboxes do expose their resources, regions and tunnels; functions do not.

A note on scoping and completeness#

  • When --modal-environments is set, every environment is still ingested as a ModalEnvironment node, but only the listed environments have their contents refreshed. Resources in the other environments keep their previous data with a stale lastupdated. This is deliberate: loading only the selected subset would let the workspace-scoped environment cleanup delete the other environment nodes while their children survived as orphans.

  • When an environment is deleted in Modal, its environment-scoped resources are removed from the graph along with it. This is a deliberate cascade: those resources are cleaned up by traversing their environment node, so deleting the environment first would leave them behind as orphans that still read as live.

  • Custom domains require a paid Modal add-on. On workspaces without it the API answers UNIMPLEMENTED. Cartography treats that as “we learned nothing”, not as “there are none”, so it skips both the load and the cleanup and leaves any previously-ingested domains untouched.

  • Only named images are enumerable. Anonymous build images, which is what an inline modal.Image.debian_slim() produces, are not returned by the API, so a sandbox’s HAS_IMAGE edge often has nothing to resolve to.

  • Both sandbox generations are ingested. Modal’s ordinary sandbox listing returns only v1, so Cartography additionally calls the v2 listing, which is per app. Each sandbox records which generation it is in sandbox_version.

  • Billing and cost data, and app deployment history, are out of scope for this module.

Previous
Modal
Next
Modal Schema

2021-2026, The Linux Foundation

Made with Sphinx and Shibuya theme.