Skip to main content
The safedep query command runs SQL-like queries against SafeDep Cloud’s analytics surface. This surface holds the packages, projects, endpoints, events, and security findings collected across your tenant, enriched with global threat intelligence (vulnerabilities, EPSS, CISA KEV, OpenSSF Scorecard, and more).

Prerequisites

Install the safedep CLI and sign in. For the steps and a first query, see Query Your Tenant with SQL. SafeDep scopes every query to your tenant. You never write a tenant filter yourself.

How the data is organized

Tables come in two kinds:
  • Tenant tables hold your data. They are projects, project_versions, boms, packages, endpoints, the component_* finding tables, and the event tables (inventory_events, package_guard_events, package_guard_sandbox_violations).
  • Join-only enrichment tables hold global reference data shared across all tenants. They are vulnerabilities, epss, kev, licenses, malware_analysis, open_source_packages, open_source_projects, scorecards, scorecard_checks, terraform_providers.
The most important rule is that every query must reference at least one tenant table. You reach an enrichment table only by joining out from a tenant table. A typical query walks from a first-party project, through its bill of materials, to a package, to a finding, and out to global enrichment:

What SQL we support

Every query must filter on an indexed column or a bounded time range. The schema marks which columns are indexed. The query language does not support these features:
  • Subqueries
  • CTEs (WITH)
  • UNION and set operations
  • Window functions
  • Casts
  • Arbitrary functions
  • Multiple statements

Discovering the schema

You do not need to memorize tables or columns. The schema is self-describing, and this is the entry point for both humans and AI agents.
Each column carries capability flags that tell you what it can do: schema get also prints the join edges (which tables connect, and their cardinality) and the usage rules with example queries, so one call gives you everything needed to write a valid query.

Output modes

Select with -o / --output. When omitted, the CLI auto-detects the format. It renders a table for an interactive terminal and plain text when piped. JSON shape:
The JSON has next_page_token only when a next page exists. The last page has no token.

Pagination

Pagination is caller-driven. The CLI does not auto-iterate. Fetch the first page, then re-run the same query with the returned token:
If TOK is empty, the first page was the last page.

Troubleshooting

SafeDep Cloud Overview

See what SafeDep Cloud collects to build the data you query.

Authentication

Sign in with safedep auth login before running queries.

Vet Filtering

Filter findings locally with Vet’s CEL query language.

API & Automation

Get programmatic access to SafeDep’s APIs.