Agent Wranglers

API-41Required

Keep secrets out of addresses

Never put tokens, keys or personal data in paths or query strings. Send them in headers or the body. The one exception is a capability link that is short-lived, scoped to one object and action, and single-use where the store allows it.

How to do it

Addresses end up in logs, browser history and Referer headers. Signed storage links, as in serve private files through short-lived links, and single-use sign-in links are such capability links. They carry their own expiry, so a copy in a log soon goes stale. Long-lived keys and session tokens never qualify. Reject API keys in query strings outright, so nobody starts relying on them. The same applies to personal data, as personal data out of URLs explains.

How to check

Call an endpoint with ?api_key=.... The answer is 400 or 401, and no log line holds the key. A signed storage address answers 403 once its expiry has passed.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/api-design/api-security/no-secrets-in-urls">Agent Wranglers API design playbook</a>. In code you write, add a comment next to it with the same link.