Scrivio Interview library
LeadershipPrincipal6 min read · updated 12 November 2026

Your security strategy aims to eliminate long-lived static secrets (database passwords, API keys, cloud keys) from applications. How would you plan this over several years?

The plan replaces static secrets with identities the platform issues. Workload identity, such as cloud IAM roles bound to Kubernetes service accounts, gives applications short-lived credentials automatically; where a system cannot use workload identity, dynamic secrets such as Vault database credentials fill the gap. Alongside that we keep an inventory of the remaining static secrets with owners and replacement plans, remove humans from handling production secrets, and track the count of static secrets as the programme's main metric over several years.

Why this question is asked

Long-lived static secrets are the root of a large share of breaches: an access key copied into a script, a database password unchanged for six years, an API key shared by twenty services so nobody dares rotate it. Rotation helps, but it treats the symptom. Eliminating static secrets is a multi-year strategy that changes how applications get access at all. Interviewers ask this at the most senior level to see whether we can turn a slogan into a sequenced plan with realistic exceptions and a metric. In this answer, we will recap the difference between static secrets and identity, then go through workload identity, dynamic secrets, the inventory, taking humans out of the loop, and a phased plan with measurement.

1A Quick Recap: Secrets Versus Identity

A static secret is a value that grants access to whoever holds it, for as long as it is valid, often years. If it leaks, the attacker is indistinguishable from the application. An identity-based approach turns this around: the platform already knows which workload is running (this pod, with this service account, in this cluster), and an identity provider exchanges that proof for a credential that lasts minutes or hours and is scoped to that workload.

So the application never holds a value worth stealing for long. If a short-lived token leaks, it expires soon, and access policies can be tied to the workload's identity rather than to whoever presents the secret.

2Workload Identity as the Default

For cloud access, every major platform offers workload identity. On AWS, IAM Roles for Service Accounts or EKS Pod Identity let a pod assume an IAM role; on Google Cloud, Workload Identity Federation maps Kubernetes service accounts to cloud service accounts; on Azure, Microsoft Entra Workload ID does the same. The cloud SDKs pick up the short-lived credentials automatically, so a Spring Boot service using the AWS SDK needs no access key at all.

Between services, the same idea appears as mTLS certificates issued per workload (for example by a service mesh or SPIFFE), and as OAuth2 client credentials obtained with the workload's identity instead of a stored client secret where the identity provider supports it. For databases, cloud-managed databases often accept IAM authentication tokens that last 15 minutes.

Java
// Spring Boot with the AWS SDK v2: no keys in configuration
S3Client s3 = S3Client.builder().region(Region.EU_WEST_1).build();
// The default credentials provider chain finds the web identity token mounted by the platform,
// calls STS AssumeRoleWithWebIdentity and refreshes the temporary credentials before they expire.
s3.listBuckets(); // works with a role scoped to this service account

3Dynamic Secrets Where Identity Is Not Available

Not everything accepts workload identity. A self-hosted PostgreSQL, a message broker or a legacy system may only understand usernames and passwords. For these, dynamic secrets are the next best thing: Vault authenticates the workload by its platform identity and creates a credential just for it, with a lifetime of hours, revoked automatically afterwards. The application still holds a password, but it is unique, short-lived and audited.

Third-party APIs are the hardest case, because a payment provider gives us one API key and we cannot change that. Here the goal is containment: keep the key in the secret store only, let a single service or gateway use it, rotate it on a schedule through the provider's API, and push vendors over time towards OAuth or federation.

Step throughHow an application should get access
  1. Does the target accept workload identity?
    YesUse IAM, federation or mTLS identityNoNext question
  2. Can Vault issue dynamic credentials for it?
    YesUse dynamic secrets, short TTLNoNext question
  3. Static secret unavoidablefor example a vendor API key
  4. Store it centrally with an ownersingle consumer, rotated automatically
  5. Record it in the exception registerwith a review date

5 steps in order. Play them, or step through them one at a time.

Each static secret that remains is a recorded exception, not a default.

4Inventory and Owners for What Remains

We cannot eliminate what we cannot count. The inventory lists every static secret in use: where it is stored, which services consume it, who owns it, when it was last rotated, and the plan to replace it, whether by identity, a dynamic secret or a documented exception. Sources are the secret stores, secret scanners over code and configuration, cloud key reports (for example IAM access keys and their last use) and team surveys.

Notice that consumers matter as much as the secret. One API key shared by twenty services is twenty migrations; splitting it into one key per consumer is often a useful first step, because it makes later replacement and rotation possible without coordinating twenty teams.

5Removing Humans From Production Secrets

As long as people copy production passwords into terminals and chat messages, static secrets will leak. The plan removes the need: deployments and pipelines fetch secrets with their own identities, break-glass access to a production database goes through a just-in-time system that issues a temporary credential to a named person after approval and logs the session, and nobody keeps a personal copy of a production password. A useful test is to ask whether anyone in the company can read the production database password today; the target answer is no one, because it does not exist as a long-lived value.

6A Multi-Year Plan and Its Metric

We sequence the work so each year removes a large, visible slice. The first year covers cloud access keys, because workload identity is mature and those keys are the most dangerous. The second year moves databases and internal services to dynamic credentials and mTLS identity. The third year tackles vendor keys and the long tail, with exceptions reviewed and shrinking.

The main metric is the count of static secrets in production, broken down by type and by age, plus the share of services with no static secrets at all. A board-level chart showing "static secrets: 3,100 -> 1,200 -> 400" is easy to understand and hard to argue with, and the age breakdown catches secrets that are technically counted but never rotated.

Example roadmap
YearFocusTarget
Year 1Cloud access keys -> workload identity; inventory completeZero static cloud keys in prod
Year 2Databases and brokers -> dynamic secrets; mTLS identity80 percent of services secret-free
Year 3Vendor keys contained and auto-rotated; humans out of prodExceptions under 50, all owned

7Follow-up questions

Is a secret in Vault still a static secret?

Yes, if it is a long-lived value that Vault simply stores, such as a KV entry with a password that never changes. Vault improves storage, access control and audit, but the goal is a credential that is issued per workload and expires, which needs identity or dynamic secrets.

What is the hardest part of this programme?

Usually the long tail: legacy systems and vendors that only support static keys, and shared secrets that many services use. These need patient decomposition, per-consumer keys first, and an exception process with owners so they do not stay forever.

8Conclusion

In this answer, we planned the removal of long-lived static secrets over several years. Workload identity from the platform becomes the default way to get short-lived credentials, dynamic secrets cover systems that cannot use identity, and what remains is inventoried with owners and replacement plans. We take humans out of handling production secrets with just-in-time access, sequence the work so each year removes a visible slice, and track the count of static secrets as the programme metric.

What to say in the interviewAbout 100 seconds aloud

Open with

I would frame the strategy as replacing secrets with identity. The platform already knows which workload is running, so it can exchange that for short-lived credentials, and then the application never holds a value worth stealing.

Then, if they want more

Year one is cloud access: IAM roles for Kubernetes service accounts or the equivalent federation on other clouds, so the SDKs pick up temporary credentials and we remove every static access key in production. Where a system does not accept identity, like a self-hosted PostgreSQL or a broker, Vault issues dynamic credentials per workload with a TTL of hours.

For things like a vendor API key that must stay static, I contain it: one store, one consumer, automatic rotation where the vendor supports it, and an entry in an exception register with an owner and a review date.

In parallel we build the inventory of every remaining static secret, who owns it, its consumers and its replacement plan, and we split shared secrets into one per consumer, because that makes everything else possible.

I would also remove people from the loop: pipelines fetch secrets with their own identity and production access goes through just-in-time credentials with approval and logging. The metric I would report is the number of static secrets in production, by type and age, and the share of services with none.

Going from about three thousand to a few hundred owned exceptions over three years is the kind of trend leadership can follow.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Official documentation
Spring Security reference
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your security strategy aims to eliminate long-lived static secrets (database passwords...": https://scrivio-interview-library.netlify.app/spring-boot/secrets-and-crypto/a6f802047e/