Skip to content

Commit

Permalink
Re-review.
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjeeter committed Dec 17, 2024
1 parent 3f23c4a commit 64c21eb
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/guides/components/findings.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,25 @@ await sdk.findings.create({
title: "Title", // Label your Finding.
description: "Description", // Add a description (optional).
reporter: "Reporter", // Specify which plugin discovered the Finding.
dedupe: `${request.getHost()}-${request.getPath()}`, // Prevents multiple alerts for request with matching characteristics (optional).
dedupeKey: `${request.getHost()}-${request.getPath()}`, // Prevents multiple alerts for request with matching characteristics (optional).
request, // The associated request.
});
```

::: tip
The `dedupeKey` can use any [request](https://developer.caido.io/reference/sdks/backend/#request) or [response](https://developer.caido.io/reference/sdks/backend/#response-3) object properties.

``` ts
// Dedupe based on request body data.
dedupeKey: request.getBody()
// Dedupe based on request path and method.
dedupeKey: `${request.getPath()}-${request.getMethod()}`
// Dedupe based on request path, response code and response header.
dedupeKey: `${request.getPath()}-${response.getCode()}-${response.getHeader("Content-Length")}`
```

:::

## Conditional Findings

You can then set conditions that must be met such as only creating a Finding if the request recieved a 200 response:
Expand Down Expand Up @@ -56,10 +70,6 @@ export function init(sdk: SDK<API>) {
}
```

::: tip
View all of the properties that can be accessed for [request](https://developer.caido.io/reference/sdks/backend/#request) and [response](https://developer.caido.io/reference/sdks/backend/#response-3) objects.
:::

## The Result

<img alt="Finding alert." src="/_images/findings.png" centered />

0 comments on commit 64c21eb

Please sign in to comment.