Secret scanning
Find leaked API keys, tokens and private keys in text from SQL, offline and with redacted output
- Connector software
- Free and open source
- Service credentials
- Not needed
- Query Farm hosting
- Available · $10/month organization minimum
Use with an agent
Install the Orchard skill in your project to help your agent find connectors, configure them, and verify SQL results.
npx skills add Query-farm/vgi-skills --skill orchard
Copy this request into your coding agent to get started.
Use https://query.farm/products/orchard/connectors/secretscan/index.md to help me query Secret scanning with DuckDB or Haybarn 2.0.1 and VGI protocol 3.4. Ask only for missing details about the result I need or whether I want local execution, self-hosting or Query Farm hosting. Check the connector's actual hosting availability, credentials and input requirements. Read one format of each needed reference and the exact object declarations before writing SQL. Use a released connector, and distinguish a saved example result from anything you actually execute. If you cannot run the query, tell me what remains to verify.
Find and identify exposed secrets in text
Uses deliberately fake keys to demonstrate detection and redaction.
Example output · captured
- Connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
SELECT f.rule_id, f.match_redacted, f.start_offset, d.provider, d.category
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f
LEFT JOIN secretscan.main.secret_detectors AS d USING (rule_id)
ORDER BY f.start_offset;
| rule_id | match_redacted | start_offset | provider | category |
|---|---|---|---|---|
| aws-access-token | AKIA********4Q2T | 18 | AWS | Cloud Keys |
| slack-bot-token | xoxb********UvWx | 51 | Slack | Chat Tokens |
| npm-access-token | npm_********8eRt | 116 | NULL | NULL |
Quick start
Choose where to run Secret scanning, then follow the steps below.
The connector runs alongside DuckDB or Haybarn. No Query Farm account is needed.
1. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
2. Attach the connector
Attach the release directly
Downloads the latest release for your platform and caches it locally.
ATTACH 'secretscan' AS secretscan (
TYPE vgi,
LOCATION 'github-auto://Query-farm/vgi-secretscan'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'secretscan' AS secretscan (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-secretscan:0.5.0'
);
3. Run a query
SELECT f.rule_id, f.match_redacted, f.start_offset, d.provider, d.category
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f
LEFT JOIN secretscan.main.secret_detectors AS d USING (rule_id)
ORDER BY f.start_offset;
Run the connector on a server you manage. You operate the service and choose who can connect.
1. Deploy the connector on your server
Follow the connector’s deployment instructions. Use its supported HTTP transport, or launch it remotely over SSH. The connection guide explains both options.
2. Install the vgi extension
Run this in your SQL client. On DuckDB, keep FROM query_farm on LOAD in later sessions.
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach the connector
For an HTTP deployment, replace the example URL with your endpoint. Add the authentication options your deployment requires. For SSH, use the SSH connection instructions.
ATTACH 'secretscan' AS secretscan
(TYPE vgi, LOCATION 'https://your-connector.example.com');
4. Run a query
SELECT f.rule_id, f.match_redacted, f.start_offset, d.provider, d.category
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f
LEFT JOIN secretscan.main.secret_detectors AS d USING (rule_id)
ORDER BY f.start_offset;
Query Farm operates Secret scanning for your team. Hosting has a $10 monthly minimum per organization; usage counts toward it. From $2.97 per instance-month ($10 monthly minimum).
1. Create your hosted connector
Open the console, choose your organization and deployment size, and add any service credentials there.
2. Install the vgi extension
SET allow_extension_repositories = 'allowed';
CREATE EXTENSION REPOSITORY IF NOT EXISTS query_farm
WITH PREFIX 'https://duckdb-extensions.query.farm';
INSTALL vgi FROM query_farm;
LOAD vgi FROM query_farm;
INSTALL vgi FROM community;
LOAD vgi;
3. Attach your deployment
Copy the ATTACH statement from your deployment in the console and run it in DuckDB or Haybarn. Use secretscan as the catalog alias for the query below.
4. Run a query
SELECT f.rule_id, f.match_redacted, f.start_offset, d.provider, d.category
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f
LEFT JOIN secretscan.main.secret_detectors AS d USING (rule_id)
ORDER BY f.start_offset;
Technical details
- Verified connector release
- v0.5.0
- Engine
- 2.0.1
- VGI protocol
- 3.4.0
- Verified on
- December 1, 2026
Pin a version for production
When running the connector yourself, keep a specific release until you’re ready to upgrade. Replace the ATTACH statement above with this one and follow the same extension and credential setup.
Attach the release directly
Uses the verified release each time you attach the connector.
ATTACH 'secretscan' AS secretscan (
TYPE vgi,
LOCATION 'github-auto://Query-farm/[email protected]'
);
Attach the signed image
Needs Docker, Podman or another OCI runtime. The extension runs the container and talks to it over stdio.
ATTACH 'secretscan' AS secretscan (
TYPE vgi,
LOCATION 'oci://ghcr.io/query-farm/vgi-secretscan:0.5.0'
);
Overview
Scan text/code for leaked secrets (gitleaks ruleset + entropy); redacted output, no verification

Find leaked secrets in text and source code directly from SQL: scan strings for AWS, GCP, and Azure cloud keys, GitHub, GitLab, Slack, and Stripe tokens, RSA/SSH private keys, JWTs, and high-entropy credentials — powered by the embedded gitleaks detection engine and delivered over Apache Arrow to DuckDB.
This extension is built for security, DevSecOps, and data engineers who need fast, in-database secret detection and credential-leak scanning without shipping sensitive data to an external service. Point it at a column of commit messages, log lines, config blobs, support tickets, or any free text, and it flags rows that contain leaked secrets so you can audit, redact, and remediate at the speed of a SQL query. Detection is pure and fully offline — it makes no network calls and never verifies whether a credential is live, so every finding is a candidate leak that is safe to surface in untrusted pipelines.
Under the hood the worker runs the gitleaks secret-scanning engine with its default ruleset of 200+ regular-expression detectors, embedded straight into the binary so there is nothing to download or configure. For generic and entropy-gated rules it layers a Shannon-entropy heuristic to score how random a candidate string looks, and it assigns each hit a confidence value so structurally-distinctive matches (a real-looking AWS access key) rank above noisy generic ones. Crucially, the raw credential never leaves the process: every reported match is redacted to a fixed-width mask that also hides the secret's true length. See the gitleaks documentation and the default ruleset for the full detector catalog.
The extension exposes two scalar/table functions plus a browsable secret_detectors registry view. Use the scalar secret_contains(text) → BOOLEAN as a cheap predicate — ideal in a WHERE clause to keep only the rows worth a deeper look. Then call the table function secret_scan(text) to enumerate findings: it emits one row per detected secret with rule_id, description, match_redacted, start_offset (a byte offset), entropy, and confidence (in [0,1]). NULL or empty input yields no findings, so the functions compose cleanly across large columns. For whole-repository or git-history scanning, reach for the gitleaks CLI; this worker scans the text you pass it.
Catalog
Everything secretscan exposes once attached — read straight from the worker's
released build.
main 1 view · 2 functions
Offline secret-detection functions (gitleaks ruleset + entropy); redacted output, no verification.
Schema examples (6)
Predicate: does this string hold any detectable secret? (Returns TRUE for the AWS-style key.)
SELECT secretscan.main.secret_contains('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T') AS leaked;
Enumerate each finding with its rule, redacted match, and confidence.
SELECT rule_id, match_redacted, confidence
FROM secretscan.main.secret_scan('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T');
Browse the detector registry, highest-confidence first.
SELECT rule_id, provider, confidence
FROM secretscan.main.secret_detectors
ORDER BY confidence DESC, rule_id;
Enrich each finding in a .env-style string with its provider and category from the secret_detectors registry: AWS / Cloud Keys and Slack / Chat Tokens; the npm token's rule (npm-access-token) is outside the curated registry, so its provider and category are NULL.
SELECT f.rule_id, f.match_redacted, f.start_offset, d.provider, d.category
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f
LEFT JOIN secretscan.main.secret_detectors AS d USING (rule_id)
ORDER BY f.start_offset;
| rule_id | match_redacted | start_offset | provider | category |
|---|---|---|---|---|
| aws-access-token | AKIA********4Q2T | 18 | AWS | Cloud Keys |
| slack-bot-token | xoxb********UvWx | 51 | Slack | Chat Tokens |
| npm-access-token | npm_********8eRt | 116 | NULL | NULL |
2 more examples
Confirm the redacted output is safe to log: re-check every finding's match_redacted with secret_contains (3 findings; leaks_after_redaction is FALSE, so no redacted match still trips a detector).
SELECT count(*) AS findings,
bool_or(secretscan.main.secret_contains(f.match_redacted)) AS leaks_after_redaction
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f;
Coverage check: for each high-confidence (>= 0.9) detector in the registry, report whether it fired on a .env-style string (aws-access-token and slack-bot-token are TRUE; the other eight are FALSE).
SELECT d.rule_id, d.provider, count(f.rule_id) > 0 AS detected
FROM secretscan.main.secret_detectors AS d
LEFT JOIN secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f USING (rule_id)
WHERE d.confidence >= 0.9
GROUP BY d.rule_id, d.provider
ORDER BY detected DESC, d.rule_id;
secret_detectors
Curated registry of the notable gitleaks detector rules this worker flags (rule_id, provider, category, confidence, description) — browse it to see the detection surface before scanning with secret_contains / secret_scan.
Browse every detector this worker recognises, highest-confidence first.
SELECT rule_id, provider, category, confidence
FROM secretscan.main.secret_detectors
ORDER BY confidence DESC, rule_id;
List only the high-confidence structural detectors (confidence >= 0.9).
SELECT rule_id, provider
FROM secretscan.main.secret_detectors
WHERE confidence >= 0.9
ORDER BY rule_id;
Count the recognised detectors grouped by the provider family they cover.
SELECT category, count(*) AS detectors
FROM secretscan.main.secret_detectors
GROUP BY category
ORDER BY detectors DESC, category;
1 more example
Coverage check: for each high-confidence (>= 0.9) detector in the registry, report whether it fired on a .env-style string (aws-access-token and slack-bot-token are TRUE; the other eight are FALSE).
SELECT d.rule_id, d.provider, count(f.rule_id) > 0 AS detected
FROM secretscan.main.secret_detectors AS d
LEFT JOIN secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f USING (rule_id)
WHERE d.confidence >= 0.9
GROUP BY d.rule_id, d.provider
ORDER BY detected DESC, d.rule_id;
secret_contains (text VARCHAR)
Report whether a text/code value contains at least one detectable leaked secret (gitleaks ruleset + entropy). Offline; no verification.
Check whether a single string holds any detectable secret (returns TRUE here for the AWS-style key).
SELECT secretscan.main.secret_contains('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T') AS leaked;
Check a benign string with no secret (returns FALSE).
SELECT secretscan.main.secret_contains('just a harmless note, nothing to see here') AS leaked;
SELECT secretscan.main.secret_contains('the quick brown fox jumps over the lazy dog') AS leaked;
secret_scan (text VARCHAR)
Scan text/code for leaked secrets; emit one row per finding (rule_id, description, match_redacted, start_offset, entropy, confidence). Redacted output only; no verification.
List each secret found in a string, with its rule, redacted match, and confidence.
SELECT rule_id, match_redacted, confidence
FROM secretscan.main.secret_scan('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T');
List only the high-confidence findings (confidence >= 0.9) in a string, with each finding's byte offset.
SELECT rule_id, start_offset
FROM secretscan.main.secret_scan('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T')
WHERE confidence >= 0.9;
Enrich each finding in a .env-style string with its provider and category from the secret_detectors registry: AWS / Cloud Keys and Slack / Chat Tokens; the npm token's rule (npm-access-token) is outside the curated registry, so its provider and category are NULL.
SELECT f.rule_id, f.match_redacted, f.start_offset, d.provider, d.category
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f
LEFT JOIN secretscan.main.secret_detectors AS d USING (rule_id)
ORDER BY f.start_offset;
| rule_id | match_redacted | start_offset | provider | category |
|---|---|---|---|---|
| aws-access-token | AKIA********4Q2T | 18 | AWS | Cloud Keys |
| slack-bot-token | xoxb********UvWx | 51 | Slack | Chat Tokens |
| npm-access-token | npm_********8eRt | 116 | NULL | NULL |
1 more example
Confirm the redacted output is safe to log: re-check every finding's match_redacted with secret_contains (3 findings; leaks_after_redaction is FALSE, so no redacted match still trips a detector).
SELECT count(*) AS findings,
bool_or(secretscan.main.secret_contains(f.match_redacted)) AS leaks_after_redaction
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f;
Try these queries
Predicate: does this string hold any detectable secret? (Returns TRUE for the AWS-style key.)
SELECT secretscan.main.secret_contains('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T') AS leaked;
Uses secret_contains
Enumerate each finding with its rule, redacted match, and confidence.
SELECT rule_id, match_redacted, confidence
FROM secretscan.main.secret_scan('aws_secret = AKIAZ3MZ7EXAMPLE4Q2T');
Uses secret_scan
Browse the detector registry, highest-confidence first.
SELECT rule_id, provider, confidence
FROM secretscan.main.secret_detectors
ORDER BY confidence DESC, rule_id;
Uses secret_detectors
Confirm the redacted output is safe to log: re-check every finding's match_redacted with secret_contains (3 findings; leaks_after_redaction is FALSE, so no redacted match still trips a detector).
SELECT count(*) AS findings,
bool_or(secretscan.main.secret_contains(f.match_redacted)) AS leaks_after_redaction
FROM secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f;
Coverage check: for each high-confidence (>= 0.9) detector in the registry, report whether it fired on a .env-style string (aws-access-token and slack-bot-token are TRUE; the other eight are FALSE).
SELECT d.rule_id, d.provider, count(f.rule_id) > 0 AS detected
FROM secretscan.main.secret_detectors AS d
LEFT JOIN secretscan.main.secret_scan('AWS_ACCESS_KEY_ID=AKIAZ3MZ7EXAMPLE4Q2T SLACK_TOKEN=xoxb-1234567890-1234567890123-AbCdEfGhIjKlMnOpQrStUvWx NPM_TOKEN=npm_Zq8xK2vN7rT4mW9pL3sY6bH1cJ5dF0gA8eRt') AS f USING (rule_id)
WHERE d.confidence >= 0.9
GROUP BY d.rule_id, d.provider
ORDER BY detected DESC, d.rule_id;
Browse every detector this worker recognises, highest-confidence first.
SELECT rule_id, provider, category, confidence
FROM secretscan.main.secret_detectors
ORDER BY confidence DESC, rule_id;
Uses secret_detectors
5 more examples in the Catalog, each listed under the table or function it uses.
Questions it can answer
Plain-English questions from the worker's agent test tasks. An AI agent with this catalog attached should answer each one with SQL.
- Does the following text contain any leaked secret? Answer with a single boolean. Text: deploy AKIAZ3MZ7EXAMPLE4Q2T now
- Does the following benign sentence contain any leaked secret? Answer with a single boolean. Text: the quick brown fox jumps over the lazy dog
- Scan the following text for leaked secrets and tell me how many findings it produces. Text: deploy AKIAZ3MZ7EXAMPLE4Q2T now
- Scan the following text for leaked secrets and report, for each finding, the matched rule id and the redacted match. Text: deploy AKIAZ3MZ7EXAMPLE4Q2T now
- Using the scanner's browsable detector registry, how many distinct secret detectors does it recognise in total?
- Does the scanner's detector registry include any high-confidence (>= 0.9) detector for AWS? Answer with a single boolean.
Secret scanning is an independent open-source connector from Query.Farm. It is not affiliated with, endorsed by or sponsored by the services, projects or organisations it works with. Product names, logos and trademarks belong to their respective owners.
Related workers
YARA
Security & forensics
Scan blobs and text for malware with YARA rules, straight from SQL
CVE
Security & forensics
Look up CVE records, flag known-exploited CVEs, score exploit likelihood, find open-source package advisories, and compute CVSS v3.1 scores
Windows event logs (EVTX)
Security & forensics
Parse Windows .evtx event-log files into queryable SQL rows for forensics and incident response