-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/microsoft/genaiscript
- Loading branch information
Showing
38 changed files
with
465 additions
and
501 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
docs/src/content/docs/reference/scripts/secret-scanning.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
--- | ||
title: Secret Scanning | ||
sidebar: | ||
order: 10 | ||
--- | ||
|
||
One should not have secrets lying around in their codebase, but sometimes it happens. | ||
To help you avoid this, we have a secret scanning feature that will scan your codebase for secrets | ||
and warn you if any are found. | ||
|
||
:::note | ||
|
||
The secret scanning feature is by no means exhaustive and should not be relied upon as the sole | ||
method of securing your codebase. It is a best-effort feature that will help you avoid common mistakes. | ||
|
||
::: | ||
|
||
## Supported patterns | ||
|
||
By default set of secret patterns | ||
are defined at https://github.com/microsoft/genaiscript/tree/main/packages/core/src/config.json. | ||
|
||
:::cautio | ||
|
||
\is is not a complete list by design, and needs to be updated to match your needs. | ||
|
||
::: | ||
|
||
You can find examples of patterns at https://github.com/mazen160/secrets-patterns-db/. | ||
|
||
## Scanning messages | ||
|
||
By default, all messages sent to LLMs are scanned and redacted if they contain secrets. | ||
|
||
You can disable secret scanning alltogher by setting the `secretScanning` option to `false` in your script. | ||
|
||
```js | ||
script({ | ||
secretScanning: false, | ||
}) | ||
``` | ||
|
||
## Configuring patterns | ||
|
||
If you have a specific pattern that you want to scan for, you can configure it in your | ||
[configuration file](/genaiscript/reference/configuration-files). | ||
|
||
```json title="genaiscript.config.json" | ||
{ | ||
"secretPatterns": { | ||
..., | ||
"my secret pattern": "my-secret-pattern-regex" | ||
} | ||
} | ||
``` | ||
|
||
- do not use `^` or `$` in your regex pattern | ||
|
||
### Disabling patterns | ||
|
||
Set the pattern key to `null` or `false` to disable it. | ||
|
||
```json title="genaiscript.config.json" | ||
{ | ||
"secretPatterns": { | ||
"OpenAI API Key": null | ||
} | ||
} | ||
``` | ||
|
||
## CLI | ||
|
||
You can test your patterns against files using the CLI. | ||
|
||
```sh | ||
npx --yes genaiscript parse secrets * | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.