Skip to content

Knowledgebase

Rotating an application secret without breaking active traffic

development, performance

A secret rotation is a coordinated change between the issuing service, application configuration and running processes. Its exact recovery behavior depends on whether the secret signs data or authenticates an external connection.

Prepare for the change

Identify the secret type, all consumers and whether the provider supports overlapping keys. Prepare a test and rollback plan without placing secret values in the release log.

01 Rotate an application secret without breaking active traffic

  1. Create the replacement credential with the least required permissions. When overlap is supported, keep the old credential active only for the defined transition period.

  2. Update the protected runtime configuration for web processes, workers, scheduled tasks and build stages that genuinely need the secret.

  3. Reload affected processes and test a new operation using the replacement. Verify the provider’s audit information or a safe credential identifier rather than printing the secret.

  4. For signing or encryption keys, follow the application’s supported previous-key or data migration process. Do not treat them as interchangeable with a simple API password.

  5. Revoke the old credential after all required consumers have moved and the transition checks pass. Remove temporary copies and update the ownership record.

Confirm the expected result

Confirm both immediate requests and less frequent scheduled tasks succeed. Check that the revoked credential no longer works and that no forgotten worker repeatedly retries it.

If the change does not work

If failures occur, determine which consumer still has stale configuration. Restoring a compromised old secret is not automatically an acceptable recovery action.

A common question

Do I need to rebuild the frontend when rotating a private server secret?

Private server secrets should not be in a browser bundle. If a credential was bundled publicly, revoke it and correct the architecture as well as replacing the value.

Was this answer helpful?

Need a little more help?

Our support team can help you find the next step.

Contact support