> For the complete documentation index, see [llms.txt](https://developer.harness.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developer.harness.io/sast-and-sca/ocular/cpgql-reference/reference-card.md).

# Reference Card

### Node-Type Steps <a href="#node-type-steps" id="node-type-steps"></a>

| Step             | Description                                                                            |
| ---------------- | -------------------------------------------------------------------------------------- |
| `all`            | All nodes                                                                              |
| `argument`       | All arguments (actual parameters)                                                      |
| `call`           | All call sites                                                                         |
| `comment`        | All comments (only source-based CPGs)                                                  |
| `file`           | All source files                                                                       |
| `identifier`     | All identifiers, e.g. occurrences of local variables or class members in method bodies |
| `literal`        | All literals, e.g. numbers or strings                                                  |
| `local`          | All local variables                                                                    |
| `member`         | All members of complex types, e.g. classes, structs                                    |
| `metaData`       | The meta data node                                                                     |
| `method`         | All methods                                                                            |
| `methodRef`      | All method references                                                                  |
| `typeRef`        | All type references                                                                    |
| `methodReturn`   | All formal return paramters                                                            |
| `namespace`      | All namespaces                                                                         |
| `namespaceBlock` | All namespace blocks                                                                   |
| `parameter`      | All parameters                                                                         |
| `returns`        | All actual return parameters                                                           |
| `typeDecl`       | All declarations of types                                                              |
| `tag`            | All tags                                                                               |
| `types`          | All used types                                                                         |

### Core Steps <a href="#core-steps" id="core-steps"></a>

| Step         | Description                                                         |
| ------------ | ------------------------------------------------------------------- |
| `clone`      | Create a deep copy of the traversal                                 |
| `dedup`      | Deduplicate results in a traveral                                   |
| `map`        | Transform the traversal by a given function                         |
| `sideEffect` | Extend the traversal with a side-effect step by applying a function |

### Filter Steps <a href="#filter-steps" id="filter-steps"></a>

| Step        | Description                                                                      |
| ----------- | -------------------------------------------------------------------------------- |
| `and`       | The *and* step is a filter with multiple *and* related filter traversals.        |
| `filter`    | Keep nodes for which the provided `predicate` returns true                       |
| `filterNot` | Keep nodes for which the provided `predicate` returns false                      |
| `where`     | Traversal proceeds for steps with non-empty returns for the provided `predicate` |
| `whereNot`  | Traversal proceeds for steps with empty returns for the provided `predicate`     |
| `or`        | The *or* step is a filter with multiple *or* related filter traversals.          |

### Repeat Steps <a href="#repeat-steps" id="repeat-steps"></a>

| Step     | Description                                                                                                                                                           |
| -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `repeat` | Repeat the given traversal. This step can be combined with the until and emit steps to provide a termination and emit criteria.                                       |
| `until`  | Termination criteria for a repeat step. If used before the repeat step it as "while" characteristics. If used after the repeat step it as "do-while" characteristics. |
| `times`  | Modifier for repeat steps. Configure the amount of times the repeat traversal is executed.                                                                            |
| `emit`   | Emit is used with the repeat step to emit the elements of the repeatTraversal after each iteration of the repeat loop.                                                |

### Complex Steps <a href="#complex-steps" id="complex-steps"></a>

| Step              | Description                                                                                                                            |
| ----------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| `callee`          | List all nodes representing Call Graph callees of the traversed nodes                                                                  |
| `caller`          | List all nodes representing Call Graph callers of the traversed nodes                                                                  |
| `callIn`          | List all nodes representing Call Graph parent call-sites of the traversed nodes                                                        |
| `controlledBy`    | Returns only those dataflows that are wrapped by a given AST control condition (>, <, =, etc.)                                         |
| `dump`            | Execute the traversal and return the CODE property with syntax highlighting                                                            |
| `dumpRaw`         | Execute the traversal and return the CODE property without syntax highlighting                                                         |
| `inCall`          | Lists all nodes representing surrounding Call Graph call-sites of the traversed nodes                                                  |
| `locations`       | List of all locations nodes traversed in a given dataflow                                                                              |
| `notControlledBy` | Returns only those flows that are NOT wrapped by a given AST control condition (>, <, =, etc.)                                         |
| `passesNot`       | Returns only those dataflows that DO NOT pass through a given function/condition as defined in predicate                               |
| `passes`          | Returns only those dataflows that pass through a given function/condition as defined in predicate                                      |
| `reachableBy`     | Find if a given source node is reachable by a sink via a dataflow                                                                      |
| `sink`            | List of all nodes identified as potential sensitive sinks the natured of methods, literals, types etc. associated with them            |
| `source`          | List of all nodes identified as sensitive/attacker-controlled due to the natured of methods, literals, types etc. associated with them |
| `tagList`         | Execute the traversal and return TAG nodes connected to each of the nodes                                                              |

### Execution Directives <a href="#execution-directives" id="execution-directives"></a>

| Directive      | Description                                                     |
| -------------- | --------------------------------------------------------------- |
| `toList`       | Execute the traversal and convert the result to a list          |
| `l`            | Shorthand for `toList`                                          |
| `toJson`       | Execute the traversal and convert the result to JSON            |
| `toJsonPretty` | Execute the traversal and convert the result to prettified JSON |
| `p`            | Execute the traversal and pretty print the results              |
| `size`         | Execute the traversal and return the size of the array of nodes |

### Help Directive <a href="#help-directive" id="help-directive"></a>

| Directive | Description                                  |
| --------- | -------------------------------------------- |
| `help`    | Print help based on the current element type |

### Augmentation Directives <a href="#augmentation-directives" id="augmentation-directives"></a>

| Directive        | Description                             |
| ---------------- | --------------------------------------- |
| `newTagNode`     | Tag node with a specific name           |
| `newTagNodePair` | Tag node with a specific name and value |
| `store`          | Store changes in the current DiffGraph  |
