Syntax
Reference documentation for Veza Query Language.
This document provides information about the VQL (Veza Query Language) query specification, which offers a SQL-like interface to the Assessment Query API. See the Quick Start Guide for detailed usage and examples.
Concepts
Early Access: VQL is subject to modifications as we add and improve functionality. Future updates will aim to preserve compatibility with earlier versions.
A VQL query is composed of the following components:
Source Nodes: Node types in VQL represent entity types within Veza's Identity Graph. Each node type can have many individual instances, returned as rows in the query output.
Path requirements: Graph nodes can be interrelated, forming complex graph structures. Specifying related nodes filters results with a matching relationship.
Filters and Modifiers: Filter expressions (
WHERE
clauses) to constrain results based on attributes or other criteria.
VQL Expression Syntax
A VQL query always includes a SHOW
statement describing the source node type. The general syntax is:
NodeSpec Syntax
A NodeSpec
describes a source or destination entity type. It can include attribute selection (which columns to return) and filters using a WHERE
clause. The full syntax is:
Basic Components:
NodeType: The type of node (e.g.,
AwsIamUser
,OktaGroup
)Attribute Selection: Optional curly braces
{ }
containing a comma-separated list of attributes to include in the resultsWHERE: Optional clause that applies attribute-based filters to the nodes using the selected operators
Usage Examples
Basic node specification (returns all attributes):
Select specific attributes to display:
Apply filters without attribute selection:
Combine attribute selection and filters:
In this more complex example, we select specific attributes for both the source (OktaUser) and destination (S3Bucket) nodes while also applying filters to the results:
Where Clause Operators
A range of operators can be used to filter results depending on node properties. Currently, VQL supports the comparison operators:
Comparison Operators
<
, >
, <=
, >=
, =
, !=
NUMERIC, TIMESTAMP, TIME FUNCTIONS
risk_score < 80
created_at >= '2023-10-05 14:30:00.123'
created_at < CURRENT_DATE - 30
STARTS_WITH
STRING
name STARTS_WITH 'S'
ENDS_WITH
STRING
name ENDS_WITH 'E'
LIST_CONTAINS
STRING
permissions LIST_CONTAINS 'iam:PassRole'
LIST_ALL_ELEMENTS_IN
STRING
accounts_assumed_by LIST_ALL_ELEMENTS_IN ('accountid1', 'accountid2')
REGEX
STRING
name REGEX 'TEst.*'
LIST_ANY_ELEMENT_EQ
STRING
permissions LIST_ANY_ELEMENT_EQ 'iam:SetDefaultPolicyVersion'
LIST_ANY_ELEMENT_STARTS_WITH
STRING
cai_tags LIST_ANY_ELEMENT_STARTS_WITH 'P'
LIST_ANY_ELEMENT_CONTAINS
STRING
cai_tags LIST_ANY_ELEMENT_CONTAINS 'policy'
LIST_ANY_ELEMENT_ENDS_WITH
STRING
cai_tags LIST_ANY_ELEMENT_ENDS_WITH 'admin'
LIST_ANY_ELEMENT_REGEX
STRING
cai_tags LIST_ANY_ELEMENT_REGEX '::'
IS NULL
STRING
show Key WHERE last_rotated_at IS NULL
IS NOT NULL
STRING
show Key WHERE last_rotated_at IS NOT NULL
Data Types and Restrictions
Data Types: VQL supports boolean, integer, string, and null data types.
Case Sensitivity: VQL is typically case-sensitive for:
Node Types: Must be written exactly as defined (e.g.,
AwsIamUser
, notawsiamuser
).Attribute Names: Must match the exact casing (e.g.,
is_active
, notIs_Active
).
Entity Attributes
Entity attributes in VQL are used to filter and select graph nodes. They consist solely of alphanumeric characters or underscores (e.g., last_login
, email_address
).
Permissions
In addition to attribute filters, VQL queries can use permission filters. Both system permissions and effective permissions are supported.
System Permissions
System permissions are raw, system-level permissions and vary depending on the specific integration and resource. The following query identifies users that specifically have the ability to create new S3 buckets:
ANY: Used to filter for any of the supplied permissions (logical OR).
ALL: Ensures that all permissions passed should be present on the resource (logical AND).
Effective Permissions
Veza supports nine different effective permissions. These are abstracted permissions that express system permissions in common groups:
METADATA_READ
METADATA_WRITE
METADATA_CREATE
METADATA_DELETE
DATA_READ
DATA_WRITE
DATA_CREATE
DATA_DELETE
NON_DATA
The following query shows all AWS IAM Roles that grant effective permissions to read or write S3 bucket metadata:
Effective permissions filters require a destination type (specified by the RELATED TO clause).
Intermediate Nodes
Intermediate node options include or exclude results based on certain node types within the path, for analyzing complex relationships that involve hierarchies of groups, roles, or entities. These queries are often used to find users whose access is (or is not) granted by group membership or role assignment:
Including Intermediate Nodes:
Excluding Intermediate Nodes:
Modifiers and Filters
Use the WHERE
clause to apply filters. You can combine multiple conditions with AND
or OR
statements:
Example:
Result Output
By default, queries return a list of source entity types and attributes. Use the RESULT INCLUDE
clause to specify how query results appear:
DESTINATION NODES: Includes information about related destination nodes.
DESTINATION NODE COUNT: Provides a count of related destination nodes.
PATH SUMMARY: Summarizes the paths between source and destination nodes.
Example:
Last updated