Skip to content

Commit

Permalink
Merge pull request #325 from DataDog/zenithar/doc_path_for_traversal_dsl
Browse files Browse the repository at this point in the history
chore(doc): document traversal related dsl returning paths.
  • Loading branch information
Zenithar authored Jan 30, 2025
2 parents 4a4e377 + 3cc9aa0 commit 16e785d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,5 +137,5 @@ thirdparty-licenses: ## Generate the list of 3rd party dependencies and write to

.PHONY: local-wiki
local-wiki: ## Generate and serve the mkdocs wiki on localhost
poetry install || pip install mkdocs-material mkdocs-awesome-pages-plugin markdown-captions
poetry install --no-root || pip install mkdocs-material mkdocs-awesome-pages-plugin markdown-captions
poetry run mkdocs serve || mkdocs serve
23 changes: 19 additions & 4 deletions docs/queries/dsl.md
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,14 @@ GraphTraversal<S, Path> attacks()

Example usage:

!!!note
The `attacks()` step returns paths, which can be further processed with other steps. You can use
the `elementMap()` step to display the properties of the vertices and edges in the path.
Invoking the `attacks()` step alone will raise a query error.

```groovy
// All attacks possible from a specific container in the graph
kh.containers("pwned-container").attacks()
kh.containers("pwned-container").attacks().by(elementMap())
```

### Critical Step
Expand Down Expand Up @@ -432,12 +437,17 @@ GraphTraversal<S, Path> criticalPaths(int maxHops)

Example usage:

!!!note
The `criticalPaths()` step returns paths, which can be further processed with other steps. You can use
the `elementMap()` step to display the properties of the vertices and edges in the path.
Invoking the `criticalPaths()` step alone will raise a query error.

```groovy
// All attack paths from services to a critical asset
kh.services().criticalPaths()
kh.services().criticalPaths().by(elementMap())
// All attack paths (up to 5 hops) from a compromised credential to a critical asset
kh.group("engineering").criticalPaths(5)
kh.group("engineering").criticalPaths(5).by(elementMap())
```

### CriticalPathsFilter Step
Expand All @@ -450,9 +460,14 @@ GraphTraversal<S, Path> criticalPathsFilter(int maxHops, String... exclusions)

Example usage:

!!!note
The `criticalPathsFilter()` step returns paths, which can be further processed with other steps. You can use
the `elementMap()` step to display the properties of the vertices and edges in the path.
Invoking the `criticalPathsFilter()` step alone will raise a query error.

```groovy
// All attack paths (up to 10 hops) from services to a critical asset excluding the TOKEN_BRUTEFORCE and TOKEN_LIST attacks
kh.services().criticalPathsFilter(10, "TOKEN_BRUTEFORCE", "TOKEN_LIST")
kh.services().criticalPathsFilter(10, "TOKEN_BRUTEFORCE", "TOKEN_LIST").by(elementMap())
```

### HasCriticalPath Step
Expand Down

0 comments on commit 16e785d

Please sign in to comment.