Skip to content
Authentication and access

Leaked API key remediation

Steps to take if your Lightfield API key has been exposed in a public repository or other public location.

If your Lightfield API key (sk_lf_...) has been detected in a public repository, log file, or other publicly accessible location, follow the steps below immediately. Anyone with the key can make requests with its permissions.

An owner or admin revokes the exposed key in Settings → API keys. Revocation is permanent, and integrations using the key stop working.

Follow Create an API key. Grant only the scopes the integration needs, then save the new value in your secrets manager or environment variable. The key is displayed only once.

Replace the old key with the new one in every system that uses it:

  • Environment variables (.env files, CI/CD secrets, cloud provider secret stores)
  • Application configuration
  • Third-party services that call the Lightfield API on your behalf

Verify the replacement with a read operation its scopes allow. For a key with accounts:read, call List accounts and check for a successful response. The revoked key should return 401 Unauthorized.

Review recent activity in your Lightfield workspace to check for any unauthorized changes:

  • Look for unexpected accounts, contacts, or opportunities that may have been created, modified, or deleted.
  • Check for unfamiliar workflow configurations.
  • If you notice suspicious activity, contact support@lightfield.app for assistance.

Step 5: Remove the secret from your repository history

Section titled “Step 5: Remove the secret from your repository history”

Removing the key from the current version of a file is not enough. The key will still be visible in your git history. To fully remove it:

  • Use a tool like git filter-repo or BFG Repo-Cleaner to rewrite history.
  • Force-push the cleaned history.
  • If the repository is public, consider the key permanently compromised regardless of history rewriting, since the content may have been cached or cloned by others.
  • Use environment variables or a secrets manager instead of hardcoding keys in source code.
  • Ignore local secret files such as .env to prevent committing them. .gitignore matches file paths; use secret scanning to detect keys inside tracked files.
  • Enable GitHub secret scanning on your repositories to receive alerts when secrets are pushed.
  • Use separate keys per integration so you can revoke one without stopping the others.
  • Rotate keys periodically to limit the window of exposure if a key is leaked without detection.

For how to send a key and choose its scopes, see Authenticate API requests.

If you need help investigating a leaked key or believe your workspace data has been accessed without authorization, contact us at support@lightfield.app.