Investigate API key sharing in an AI SaaS product

Separate legitimate shared credentials from suspicious inference traffic with workload identities, telemetry, and a proportionate review process.

Investigate API key sharing by identifying the workload authorized to use the credential and comparing observed inference traffic with that workload's expected behavior. Requests from several networks warrant review only in context. A distributed service can legitimately use several egress networks. A billing spike tied to an unrecognized credential use can warrant immediate containment.

Establish the credential owner

For each customer-facing key, record an owner, environment, approved workload and credential ID. Give a production service and a developer's local tool different credentials. If those credentials serve the same customer, attribute them to the same organization but preserve their separate IDs. Otherwise a rotation for a developer tool can interrupt production. Google Cloud recommends isolating keys, deleting unused keys and rotating active keys. Google Cloud API key best practices

A bearer credential shows the caller has access to the secret. For requests initiated by people, capture the authenticated user in your application and propagate that user and organization from trusted server context. A workload credential issued to the application covers server authentication. A separate identity record tells you whose activity the application handled.

Collect credential IDs, authenticated actor IDs where available, coarse network metrics, client class, request time, model and token volume. Keep the raw key and authorization header out of logs. Treat network and client signals as evidence with a defined retention period. OWASP recommends recording enough context to correlate an event and excluding access tokens and other secrets from logs. OWASP Logging Cheat Sheet

Compare traffic with a known workload change

Suppose your AI SaaS offers a customer-facing document API. These are hypothetical incidents for the same customer, which operates a production worker and a staging client.

Observation Check with the owner Response
Production key appears from a second region during a failover exercise Verify the exercise window, deployed worker identity, and expected model and traffic profile Record approved use and update the workload's expected network profile
Staging key begins generating high inference spend for a production-only feature Verify the intended environment, issuance record and affected feature Limit the affected credential if supported and arrange a replacement
Production key has a confirmed exposure Identify its dependencies and assess current spend and affected calls Revoke or replace the affected key according to incident policy and verify recovery

The middle case can come from a deployment configuration error. A brief review of deployment events and the key owner may resolve it. A confirmed exposure changes the urgency. Prepare a way to restore the approved service with a fresh key, and use the narrowest control that stops the suspected misuse. Keep a review record with the key ID, reasoning, action, owner, time and follow-up.

Avoid a fixed rule that treats more than one IP as evidence of sharing. Mobile networks, VPNs and rotating egress introduce legitimate change. A stable shared proxy can also hide differences between callers. Staging traffic can vary widely. Compare it with the authorized workload and corroborate anomalies with application records.

Decide where to investigate and where to enforce

If you expose a SaaS API, begin the review at the point where you issue and authenticate its credentials. Your upstream gateway may see one sending key for many customer requests. Keep cross-references to gateway request IDs so the review can use inference evidence without including the secrets. Review abuse false positives for ways to check the effect of a proposed suspension.

Alectura records a per-user key_sharing signal. The gateway's optional user IP and user-agent headers supply inputs for that signal. Your server should set those inputs from the user request it actually observed. Alectura supports signal dismissal and manual user or organization suspension. Start with one test workload and confirm that its organization and user context reach the gateway through the Alectura quickstart.

Source documents (2)

Trace a request through Alectura.

Bring a sample prompt and a customer policy. See what reaches the model and which decisions appear in the request record.

Try the quickstart

Keep reading

Track LLM context compaction costs by customer ↗Track realtime voice AI costs by customer ↗Isolate semantic LLM caches by tenant ↗