How to Spot Credentials Embedded in a URL

Learn how to spot passwords, tokens, and keys in URLs, inspect links locally, and respond safely if a real credential has been shared.

Published
Reading time
6 min read
How to Spot Credentials Embedded in a URL
On this page

A URL can expose a username, password, token, or API key when it is copied into a ticket, chat, log, or shared document. This checklist shows how to inspect a URL locally, what a parser can and cannot tell you, and what to do if a real credential has already been shared.

Key Takeaways

  • In a URL such as https://user:password@example.test/, the text before @ is the userinfo component. It is not the hostname.
  • Credentials can also appear in query parameters, paths, or fragments, so finding no userinfo does not prove a URL is safe to share.
  • Inspect sensitive URLs on a trusted device with a local parser; do not paste them into an unknown online service.
  • A URL inspection can identify suspicious content, but it cannot establish whether a credential is still valid. Revoke or rotate exposed credentials as appropriate.

Know where credentials can appear

A common URL structure is scheme://userinfo@host/path. For example, this fictional URL contains userinfo:

https://mira:fictional-pass-74@example.test/dashboard

Here, mira:fictional-pass-74 is userinfo and example.test is the host. A username can appear without a password, and reserved characters may be percent-encoded—for example, %40 represents @ in a URL component. So a quick visual search for a colon or the word password is not a dependable check.

The userinfo component is not the only place to look. A URL might instead contain a token in its query or path:

https://example.test/reset?token=fictional-token-91
https://example.test/api/keys/fictional-key-26

Those are also fictional examples. The URL syntax alone does not tell you whether any value is secret or active. Review the surrounding context and the service’s credential format.

The URI standard describes userinfo and deprecates the user:password format. Even when a URL uses HTTPS, that does not prevent a credential from being exposed in copied links, browser history, application logs, screenshots, or monitoring systems.

Advertisement

Inspect a URL without sending it to a service

Treat the full URL as potentially sensitive. Do not paste it into a search engine, an unfamiliar URL checker, a public issue, or a chat bot. You can inspect it with a local script instead. The following Node.js example reads from standard input and reports only whether it found URL userinfo or a query parameter whose name resembles a credential field. It does not print the URL or parameter values.

Save this as inspect-url.mjs:

let input = "";

for await (const chunk of process.stdin) {
  input += chunk;
}

const raw = input.trim();

try {
  const url = new URL(raw);
  const hasUserInfo = url.username !== "" || url.password !== "";
  const sensitiveName = /password|passwd|token|secret|api[-_]?key|access[-_]?key|auth/i;
  let suspiciousQueryParameterCount = 0;

  for (const [name] of url.searchParams) {
    if (sensitiveName.test(name)) {
      suspiciousQueryParameterCount += 1;
    }
  }

  console.log(`URL parsed: yes`);
  console.log(`Userinfo present: ${hasUserInfo ? "yes" : "no"}`);
  console.log(`Query parameter names to review: ${suspiciousQueryParameterCount}`);
} catch {
  console.log("URL could not be parsed. Check its format locally.");
}

Run it with Node.js installed:

node inspect-url.mjs

Paste the URL into the program’s input, then send end-of-file (Ctrl-D on macOS/Linux, or Ctrl-Z followed by Enter on Windows). Use a trusted local terminal; terminal input may be visible on screen or in terminal scrollback. Do not put a real secret directly in a shell command, where it may be saved in shell history.

This is a screening aid, not a complete secret scanner. It checks parsed userinfo and query names only. It will not reliably identify secrets hidden in paths, fragments, unusually named parameters, nested or encoded URLs, or application-specific formats. A matching parameter name is a reason to review the value—not proof that it is a credential. Inspect the original URL carefully on a trusted device, and avoid copying sensitive values into reports.

If a real credential was shared

Assume it may have been copied or recorded; deleting the message or editing the URL does not revoke the credential.

  1. Revoke or rotate it promptly. Change the password or replace the API key, token, or other secret using the issuing service’s supported process. If the secret belongs to another organization, notify its owner.
  2. Limit access while responding. If rotation takes time, disable the credential or restrict its permissions where possible. Invalidate related sessions or tokens if the service supports it.
  3. Check for use. Review available authentication and access logs for activity during the exposure window. A clean log review does not prove nobody copied the URL or that every relevant system retained complete logs.
  4. Replace the exposed value everywhere it was configured. Update the approved secret store, application configuration, and deployment environment; verify that the old value no longer works where you can do so safely.
  5. Reduce further exposure. Remove or redact the URL from messages, tickets, documents, and logs where you have permission. Ask recipients to delete copies, but treat deletion as risk reduction—not a substitute for rotation.
  6. Follow your incident process. Escalate according to your organization’s security and reporting requirements, especially if the credential could access customer data or production systems.

If you cannot tell whether the value is a real secret, ask the credential owner or security team to assess it. Do not test an exposed credential by using it against a system unless you are authorized to do so.

Advertisement

Common Mistakes

  • Checking only for username:password@. Credentials may be encoded, use a username without a password, or appear in a query, path, or fragment.
  • Assuming HTTPS makes sharing safe. HTTPS protects a connection in transit; it does not keep a URL secret after it reaches a browser, service, log, or recipient.
  • Trusting a parser as a validity check. A parser can identify URL structure, not whether a password or token works, has expired, or has been revoked.
  • Removing the link but keeping the credential. Copies and records may remain. Revoke or rotate a real exposed credential.
  • Pasting the URL into an online checker. That can create another copy of the very data you are trying to protect.

Best Practices

  • Keep passwords, API keys, and bearer tokens out of URLs. Use an approved authentication mechanism or a securely managed secret store instead.
  • Before sharing a URL, review its hostname, userinfo, query parameters, path, and fragment. Pay attention to percent-encoded and application-specific values.
  • Redact sensitive values before putting URLs in support tickets, screenshots, analytics, or documentation. Preserve only what is necessary to reproduce the issue.
  • Prefer short-lived, narrowly scoped credentials where the service supports them, and have a clear rotation and revocation process.
  • Treat findings separately: a suspicious string merits investigation, but only the credential issuer or an authorized validation process can establish its status.

Conclusion

Check the full URL locally, not just the text before @, and do not treat parsing as proof that a credential is valid or invalid. If a real secret was shared, revoke or rotate it and investigate where the URL may have been copied or logged.

References

What would your domain sell for?

A free TidyURLs account unlocks the Domain Estimator. It prices a name from 191,011 real domain sales.