Our release binary contained API keys even though they had been removed from the repository and supplied through CI variables. In Rust, env!() had embedded them at compile time. What should we check in release artifacts, and how should the app handle these credentials instead?
How do you catch API secrets embedded in desktop app builds?
Answers
Treat anything shipped in the desktop app as readable by its user. CI variables keep secrets out of the repository, but that doesn't help if the build copies their values into the executable.
For storage uploads, put the sensitive credential on a server and have the app talk to an authenticated endpoint. The server can authorize the upload without giving the client a reusable storage key.
Reply to this answer
Scan the actual release artifacts in CI, not just the source tree. A binary-aware search for known secret values can catch plain-text embedding, and a secret scanner such as TruffleHog is another option.
Check the files you actually distribute, including packaged installers and their contents. No scanner catches every encoding or transformation, so use this as a guardrail rather than proof that a binary contains no secrets.
Reply to this answer
Audit the build-time paths too. Rust's env! and option_env! read values during compilation, and values passed to rustc from a build script can end up embedded as well. A useful rule is that build-time configuration shipped to users should be safe for them to read.
Reply to this answer
Make sure the old keys are revoked, not merely replaced. Previously distributed installers can remain accessible long after a new release, so removing the keys from future builds doesn't make the old copies safe.
p.427!windupbadger:
Good distinction. I'll check the provider settings to confirm the old credentials can no longer be used.
Reply to this answer
Add your answer
Answers are reviewed before publication.
_a48+hingeacorn.6:
The same distinction applies to runtime configuration. Fetching a shared secret after login still exposes it to the client, so avoid sending that secret at all.