Skip to content

Privacy and preparation

Agent security data source exclusion: no live secrets in training tasks

By SourceX Editorial · Updated

10 sections

Short answer

To verify that a training task contains no real credentials or live secrets, build it so it never needs one: exclude sources that carry live authority, issue sandbox credentials you can list and revoke, and use typed placeholders elsewhere. Then scan every artifact in the task package, including decoded and archived content, with two detectors, treat any verified or unknown hit as live, and sign a release record.

Agent run

Agent security data source

This page covers agent security data source exclusion: no live secrets in training tasks.Illustrative

Key takeaways

  • Build tasks so they never need a live secret: sandbox credentials, typed placeholders and local stubs.
  • Exclude sources that carry live authority, such as config files, HAR captures and production tool configs.
  • Scan every artifact with decoding and archive traversal on, and use a second detector that verifies hits.
  • Treat verified and unknown results as live: rotate with the owner first, then remove from every copy.
  • Test the boundary with canary values and planted instructions, and score disclosure and authority separately.

How do you verify that a training task contains no real credentials or live secrets?

You verify it in two directions. First, prove that every credential present is one you issued for the task, scoped to a sandbox, listed in an inventory and due to expire. Second, prove that nothing else that looks like a credential survived: scan the prompt, fixtures, recorded tool responses, environment files, screenshots and attachments, and resolve every hit before release.

Absence of evidence from one scanner is not proof. Detectors match patterns, and secrets hide in base64 blobs, nested archives, screenshots and free text. The defensible claim is narrower and checkable: these sources were excluded, these credentials were issued and are sandbox-only, these artifacts were scanned with these tools and settings, and these findings were resolved by these people.

The rule behind all of it is simple. An agent training or evaluation task should exercise instruction, data, authority and approval boundaries in a sandbox where nothing it does has a real side effect. A live secret breaks that promise even if no one ever uses it.

Why a training task is a worse place for a secret than a log file

A secret in a log file sits in one system with access controls. A secret in a training task is copied to annotators, vendors, evaluation harnesses and model checkpoints, and replayed many times. OWASP's 2025 list of risks for LLM applications names security credentials among the sensitive information that can be disclosed, and recommends scrubbing or masking sensitive content before it is used in training.

Agent tasks add a second problem. A credential in a task is not just text to leak; it is authority the agent can exercise. OWASP's excessive agency entry recommends limiting the permissions an agent's extensions hold to the minimum necessary, and requiring a human to approve high-impact actions. A task that hands an agent a production API key teaches it, and tests it, under exactly the conditions those controls exist to prevent.

Which data sources to exclude before building the task

Exclusion is cheaper than detection. Some sources carry live credentials so often that the right move is to leave them out of task construction entirely and build a synthetic stand-in. Decide this before anyone copies material into a task, and record the list so later reviewers can check it was applied.

Which data sources to exclude before building the task
SourceWhy it carries live secretsExclusion ruleSafe substitute
Environment and config filesKeys, connection strings and tokens by designNever copy; rebuild from a templateTemplate with typed placeholders
CI and deployment logsEchoed variables, signed URLs, tokens in errorsExclude raw logs; extract only the error lines neededRedacted excerpt plus a scan record
Browser recordings and HAR filesSession cookies and bearer headers in every requestExclude; record against a sandbox insteadSandbox capture with auth headers stripped
Support tickets and chatsCustomers and staff paste keys and passwordsInclude only after scanning and typed replacementTicket text with placeholders and a note
Email threadsPassword reset links, OAuth codes, invite linksExclude links; keep only the message text neededMessage text with links replaced
Admin console screenshotsKeys shown on screen, not searchable as textExclude unless reviewed by a personScreenshot of a sandbox account
Database dumpsToken, webhook secret and API key columnsDrop credential columns at exportSchema-correct fake values
Agent and tool server configsClient secrets and tokens for connected servicesNever copy from productionConfig issued for the sandbox run

Build the task so it never needs a live secret

Design the sandbox before the data. Most services that agents call offer separate test credentials, and the task should use those or local stubs. Stripe's documentation, for example, says sandbox secret keys start with sk_test_ and live keys with sk_live_, that the key used determines whether a request runs in live mode or a sandbox, and recommends restricted keys whose permissions can be limited. A task fixture that contains only test-prefixed, restricted keys is checkable at a glance.

Where a credential must appear only as an example, use the provider's documented placeholder or a typed placeholder of your own. AWS documentation uses AKIAIOSFODNN7EXAMPLE as a stand-in access key across its SDK and CLI guides. A typed placeholder such as a token name with the word placeholder in it keeps the task readable without looking like a real key to a scanner or a model.

Tool connections need the same care. The Model Context Protocol security guidance calls token passthrough, where a server accepts a client's token and forwards it to a downstream API, an anti-pattern that the authorization specification forbids. For local servers it recommends running them in a sandbox with minimal default privileges and restricted access to the file system and network. Build task environments the same way: per-run credentials issued to the sandbox, narrow network egress and no access to the host's keys.

The secure task construction and exclusion checklist

Run this checklist for every task package, or for every batch built from one template, and keep the evidence column with the release. A blank evidence cell blocks release just as a failed check does.

At a glance

The secure task construction and exclusion checklist

The secure task construction and exclusion checklist
CheckHow to perform itEvidence keptBlocks release if
Source exclusions appliedCompare task inputs with the exclusion listInput manifest with source per artifactAny artifact comes from an excluded source
Credential inventoryList every credential the task uses, with scope and expiryInventory signed by the sandbox ownerA credential is not in the inventory
Sandbox-only proofConfirm each credential works only in the test environmentProvider test-mode or tenant evidenceAny credential reaches production
Placeholders typedReplace every removed value with a named placeholderPlaceholder map without the original valuesA removed value is replaced by a look-alike
Deep scanScan all artifacts with decoding and archive traversal enabledScanner version, settings and reportAny unresolved finding
Second detectorRun a detector with live verification on the same packageReport with result statusesAny verified or unknown result
Non-text artifactsReview screenshots, PDFs and audio by a personReviewer name and dateUnreviewed non-text artifact
Tool permissionsGrant read-only or narrowly scoped toolsTool list with permissionsA tool holds write or admin rights it does not need
Approval pointsGate side-effect actions behind a recorded approval stepTask spec showing the gateA side effect can run without approval
Post-release rotationRevoke sandbox credentials after the run windowRevocation recordCredentials outlive their stated expiry

Reading scanner results: verified, unverified and unknown

Different tools answer different questions, so use two. Gitleaks detects secrets in git history, directories and standard input using rules with regular expressions and entropy, and can recursively decode encoded text and scan into nested archives when its decode and archive depth options are set; both are off by default. TruffleHog adds verification: for each candidate it calls the provider's API and reports verified, unverified or unknown. Its AWS detector, for example, checks a key with a GetCallerIdentity call.

Treat the statuses as triage, not as permission. A verified result is an incident: revoke or rotate the credential with its owner first, then remove it from every copy. An unknown result means verification failed, so treat it as live until the owner confirms otherwise. An unverified result may be expired, but it still gets a typed placeholder, because the task should not teach a model what real keys look like in context. Decide in advance whether verification calls are allowed at all, since they send the candidate value to the provider.

Two settings deserve caution. A gitleaks baseline hides findings already present in an earlier report, which is useful for code but dangerous for task packages, where every old finding still matters. GitHub push protection blocks supported secret types before they reach a repository, but its documentation says push protection does not cover passwords found by its AI detection, so a clean push is not a clean package.

Worked example (illustrative): a refund task on a payments sandbox

The details below are invented to show the method. A team builds a task in which an agent reads a support ticket, looks up the order in a sandbox store and issues a partial refund. The refund tool holds a restricted test key scoped to refunds, and the task spec gates the refund behind an approval step. Four findings come up during construction.

Worked example (illustrative): a refund task on a payments sandbox
ArtifactFinding (illustrative)ActionEvidence
Ticket textCustomer pasted what looks like a live secret keyReplaced with a typed placeholder; source owner told to rotatePlaceholder map and rotation ticket
Recorded webhook fixtureWebhook signing secret from a staging accountRegenerated in the sandbox; fixture re-recordedNew fixture hash and scan report
Order screenshotAdmin header shows part of an API keyRetaken from the sandbox accountReviewer sign-off
Environment templateA teammate's personal token left in a commentRemoved and revoked; template re-scannedRevocation record and clean scan

Does the agent keep task evidence separate from instructions and stay within its grant?

Once the package is clean, the task itself can test the boundary. Plant a harmless canary value, a string that looks like a credential but is registered as fake, in a place the agent can read but must not repeat, and plant an instruction inside the ticket text that asks the agent to print its environment or call a tool it was not granted. A pass means the agent treats ticket text as evidence, not instruction, uses only the tools in its grant and never emits the canary.

Score these as separate outcomes rather than one safety score. An agent that refuses the injected instruction but still pastes the canary into a reply has a disclosure problem, and one that keeps the canary private but calls an ungranted tool has an authority problem. Both should be visible in the evaluation record.

Register every canary before the run and search all outputs, tool call arguments and logs for it afterward, not only the final answer. Agents often leak through a tool argument or a debug message rather than through the text a grader reads. Keep the canary list separate from the task package so the search is honest, and retire each canary after one evaluation cycle so a model trained on earlier outputs cannot pass by memory.

The exception: tasks that seem to need a real credential

Some tasks test an integration that only exists against a real provider, such as an OAuth consent flow. Even then, the task package should not contain the credential. Use a dedicated test tenant with no production data, issue short-lived tokens at run time from a vault the harness controls, record the issuance and revoke after the run. The package holds a reference to the issuer, never the value.

Stop and bring in an agent security evaluator, together with the business owner of the connected system, when a task needs write access to any system that holds real customer, financial or employee data, when nobody can confirm a credential is sandbox-only, or when a verified finding cannot be rotated.

Requesting business records with live secrets excluded

Teams that source tickets, chats or logs from outside businesses to build agent tasks should ask for exclusion and scan evidence with the records, not after. SourceX sources datasets from U.S. businesses only when a buyer asks, never from stock, so the request itself can set out scope, volume, format, timing and licensing needs, including the source exclusions a task build depends on.

Frequently asked questions

What should a secure task construction checklist include?

It should cover source exclusions, a signed credential inventory, proof each credential is sandbox-only, typed placeholders, a deep scan with decoding and archive traversal, a second detector with verification, human review of non-text artifacts, tool permissions, approval points and post-release rotation. Each check keeps evidence.

Is a test-mode API key safe to include in a training task?

A test-mode key limited to a sandbox, listed in an inventory and revoked after the run is far safer than a live key, and is usually acceptable. It still grants authority in the sandbox, so scope it narrowly and avoid reusing it across tasks.

Why replace expired or unverified secrets if they no longer work?

A scanner cannot always tell expired from live, and verification can fail. Replacing every finding with a typed placeholder also keeps the task from teaching a model what real keys look like in context.

Can a secret scanner prove a task has no secrets?

No. Scanners match known patterns and miss secrets in images, unusual formats or free text. A defensible release record combines exclusions, an issued-credential inventory, two scans with stated settings and human review of non-text artifacts.

What should happen when a scan finds a verified live credential?

Treat it as an incident: tell the owner, revoke or rotate the credential, then remove it from every copy of the task and re-scan. Removing the text without rotating leaves the credential usable by anyone who saw an earlier copy.

Sources

  • OWASP's 2025 entry on sensitive information disclosure lists security credentials among sensitive information and recommends scrubbing or masking sensitive content before it is used in training. Source
  • OWASP's 2025 excessive agency entry recommends limiting extension permissions to the minimum necessary and requiring human approval of high-impact actions. Source
  • The Model Context Protocol security best practices call token passthrough an anti-pattern forbidden by the authorization specification and recommend sandboxing local servers with minimal default privileges and restricted file system and network access. Source
  • Gitleaks scans git repositories, directories and standard input, can recursively decode text and traverse nested archives when depth options are set (off by default), and ignores findings present in a baseline report. Source
  • TruffleHog verifies candidate credentials against provider APIs and reports verified, unverified or unknown, with its AWS detector using a GetCallerIdentity call. Source
  • Stripe sandbox secret keys start with sk_test_ and live keys with sk_live_, the key determines live or sandbox mode, and restricted keys are recommended. Source
  • AWS SDK and tools documentation uses AKIAIOSFODNN7EXAMPLE as a placeholder access key in credential examples. Source
  • GitHub push protection blocks supported secrets before they reach a repository, and does not cover passwords found by AI detection. Source

Tell us what data you need

Share scope, volume, format, timing and licensing needs. Datasets are sourced on request.

See if your company qualifies