Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
21 lines
671 B
TypeScript
21 lines
671 B
TypeScript
import { type SecretKeysConfig, secretKeysCheck } from '../../actions/checks/secretKeys';
|
|
|
|
describe('secretKeys guardrail', () => {
|
|
it('detects secrets', async () => {
|
|
const config: SecretKeysConfig = {
|
|
threshold: 'balanced',
|
|
customRegex: [],
|
|
};
|
|
const text =
|
|
'My API key is ADBCS-r-cEY7csbSwF123S8Nsdf3p2fknkSw12o\nMy ID is 7b9fcd0a-9188-4e36-8c65-bc915192b2375\n My email is john.doe@example.com';
|
|
|
|
const result = secretKeysCheck(text, config);
|
|
|
|
expect(result.tripwireTriggered).toBe(true);
|
|
expect(result.info?.maskEntities?.SECRET).toEqual([
|
|
'ADBCS-r-cEY7csbSwF123S8Nsdf3p2fknkSw12o',
|
|
'7b9fcd0a-9188-4e36-8c65-bc915192b2375',
|
|
]);
|
|
});
|
|
});
|