generated from mintlify/starter
-
Notifications
You must be signed in to change notification settings - Fork 3
added secret scrubbing reference #109
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
sujaya-sys
wants to merge
1
commit into
main
Choose a base branch
from
susa/secrets
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+91
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,78 @@ | ||
| --- | ||
| title: 'Dynamic Secret Scrubbing' | ||
| sidebarTitle: 'Secret Scrubbing' | ||
| description: 'Automatically scrub sensitive data from check results' | ||
| --- | ||
|
|
||
| Dynamic secret scrubbing automatically removes sensitive values from logs, traces, screenshots with text, and report trees. Set environment variables with the `CHECKLY_SECRET_*` prefix and the runtime will scrub those values from all output. | ||
|
|
||
| ## How it works | ||
|
|
||
| Assign values to `process.env.CHECKLY_SECRET_*` in your check code: | ||
|
|
||
| ```javascript | ||
| // Direct assignment | ||
| process.env.CHECKLY_SECRET_API_KEY = 'your-secret-value' | ||
|
|
||
| // From external sources | ||
| process.env.CHECKLY_SECRET_PASSWORD = await getFromAzureKeyVault('db-password') | ||
| process.env.CHECKLY_SECRET_TOKEN = await fetchFromVault('auth-token') | ||
| ``` | ||
|
|
||
| The runtime automatically detects these variables and scrubs their values from: | ||
| - Check logs | ||
| - Trace files | ||
| - Screenshots containing text | ||
| - Report trees | ||
|
|
||
| ## Supported patterns | ||
|
|
||
| ```javascript | ||
| // Bracket notation | ||
| process.env['CHECKLY_SECRET_DATABASE_URL'] = connectionString | ||
|
|
||
| // Direct assignment | ||
| process.env.CHECKLY_SECRET_AUTH_TOKEN = token | ||
|
|
||
| // Dynamic retrieval | ||
| process.env.CHECKLY_SECRET_PAYMENT_KEY = await vault.get('payment-api-key') | ||
| ``` | ||
|
|
||
| ## Limitations | ||
|
|
||
| - **Check types**: Only works in browser checks and multistep checks | ||
| - **Value format**: Must be a string (empty strings, `null`, `undefined`, numbers, objects, and arrays are ignored) | ||
| - **Size limit**: Values cannot exceed 128KB (~128,000 characters) | ||
|
|
||
| ```javascript | ||
| // This works ✅ | ||
| const apiKey = process.env.CHECKLY_SECRET_API_KEY | ||
|
|
||
| // This doesn't work ❌ | ||
| const key = 'CHECKLY_SECRET_' + 'API_KEY' | ||
| const apiKey = process.env[key] | ||
| ``` | ||
|
|
||
| ## Example usage | ||
|
|
||
| ```javascript | ||
| import { test } from '@playwright/test' | ||
|
|
||
| test('API call with scrubbed credentials', async ({ page }) => { | ||
| // Set secrets at runtime | ||
| process.env.CHECKLY_SECRET_API_TOKEN = await getTokenFromVault() | ||
| process.env.CHECKLY_SECRET_USER_ID = await getCurrentUserId() | ||
|
|
||
| // Use in your test - values will be scrubbed from results | ||
| await page.request.post('/api/data', { | ||
| headers: { | ||
| 'Authorization': `Bearer ${process.env.CHECKLY_SECRET_API_TOKEN}`, | ||
| 'X-User-ID': process.env.CHECKLY_SECRET_USER_ID | ||
| } | ||
| }) | ||
| }) | ||
| ``` | ||
|
|
||
| ## Runtime compatibility | ||
|
|
||
| This feature is available from runtime `2024.09` onwards. For private locations running older agent versions, contact support for access. |
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Am not sure if we're already mentioning this in the docs, but I remember a discussion that secret scrubbing in general is best effort and not a 100% certainty that things will always in all cases be scrubbed, especially while using more obscure/less used PW patterns for example. Not sure if we want to mention it