What makes an AI API key unsanctioned

A key is unsanctioned when it does not appear in your inventory of sanctioned keys. Finding something that looks like a key is only the first step. Pattern matching finds candidates, and the allowlist is what shows which of those candidates are unsanctioned.

Because no single control covers every stage of a developer workflow, detection works best as layers, each catching what the previous one missed.

Detection layers by workflow stage
StageWhat it covers
Local developmentPre-commit hooks and IDE-level scanning before code leaves the machine.
Source controlRepository and history scanning, plus server-side push checks.
CI/CDPipeline definitions, variables, logs, artifacts, and images.
Runtime and networkEgress and proxy telemetry for traffic to AI providers.
Provider sideAudit and usage logs for accounts the enterprise controls.

Layer detection by workflow stage

No single control covers every stage, so treat each layer as a way to catch what the previous one missed.

Local development

Pre-commit hooks and IDE-level scanning stop a key before it reaches a shared repository. They are valuable but voluntary, since a developer can skip a hook or never install it. Use them to reduce volume, not as enforcement.

Source control

Scan repositories and their full history, not only the current branch. A key deleted in a later commit usually remains valid until it is revoked. Add server-side checks on push so enforcement does not depend on developer machines. Include notebooks, including saved cell outputs, and configuration files for agents and MCP servers.

CI/CD

Scan pipeline definitions, variable stores, build logs, artifacts, and container image layers. Logs and images are easy to overlook because the key was never in source code. Confirm that masking is applied to any credential exposed to a job.

Runtime and network

Egress, proxy, and DNS telemetry can show workloads or hosts calling AI provider endpoints that are not expected to. This finds usage even when no key was ever committed. It usually shows the destination, not which key was used, and encrypted traffic limits what you can inspect.

Provider side

For provider accounts the enterprise owns, audit and usage logs can show key creation and activity. They cannot show personal or third-party accounts. What each provider exposes varies, so confirm current capabilities in provider documentation.

Strengths and limits of each method

Each layer sees something the others cannot, and each has a blind spot. Use this summary to decide where to combine methods.

Strengths and limits by workflow stage
StageStrengthLimit
Local developmentStops a key before it reaches a shared repository and reduces volume.Voluntary: a developer can skip a hook or never install it. Not enforcement.
Source controlFull history scanning and server-side push checks that do not depend on developer machines. Covers notebooks and agent and MCP configuration files.A key deleted in a later commit usually remains valid until it is revoked.
CI/CDReaches pipeline definitions, variable stores, build logs, artifacts, and image layers, where a key may never have been in source code.Logs and images are easy to overlook, and masking must be confirmed for any credential exposed to a job.
Runtime and networkShows workloads or hosts calling unexpected AI provider endpoints, even when no key was ever committed.Usually shows the destination, not which key was used. Encrypted traffic limits inspection.
Provider sideAudit and usage logs can show key creation and activity for accounts the enterprise owns.Cannot show personal or third-party accounts. Exposure varies by provider, so confirm current capabilities in provider documentation.

Build an allowlist to separate sanctioned from unsanctioned

Keep an inventory of sanctioned keys and compare every finding from every layer against it. A match against the inventory is a sanctioned key; a candidate that does not match is unsanctioned.

Triage and remediate findings

Review each finding against the allowlist, whichever layer produced it. Keep in mind that a key deleted in a later commit usually remains valid until it is revoked, so removing it from code does not by itself close a finding.

Connect detection to runtime governance

Scanning shows where AI credentials appear. If you are mapping where AI credentials and agent access need tighter control, runtime governance can sit alongside your existing scanning.