← All articlesWeb security

How to Prepare a Verifiable API Key Replacement Plan for a Server Integration

Replacing an API key does not end with saving a new value in the settings. You need to confirm that the listed consumers use the new key, the permitted operation succeeds, and the old key no longer grants access after revocation. The plan below is for developers and web product owners. It helps prepare a verifiable replacement, but you must establish the specific issuance, switchover, and revocation procedure from your provider’s documentation.

Document the key’s purpose and all consumers

Start with a secret record: what it is for, which components use it, and whom to contact if problems arise. OWASP recommends recording the purpose, intended consumers, and a responsible contact. For the replacement plan, add the environment, storage location, and person or process responsible for each step. Do not include the key’s value in the working checklist.

Consider a fully fictional integration called ‘Catalog’. In the web product’s own test environment, two server components read synthetic product records through a provider’s API. The exercise uses only your own test keys and data. The record lists both consumers, the purpose of the access, and the contact details of the developer responsible for the replacement. This list becomes the basis for checking completion: a result from one component does not confirm that the other has been updated.

Confirm the provider’s rules before starting the replacement

The trust boundary here lies between the product’s server components and the provider’s API. Updating an application setting and revoking access at the service are separate actions. Restarting the application does not itself revoke stolen credentials: they remain usable until they expire or the service revokes them.

Before starting work, complete the items below using your provider’s documentation. The supplied OWASP guidance does not establish these conditions for a particular API. If answers are missing, the replacement procedure cannot yet be considered ready. Do not assume that two keys can remain active simultaneously, that revocation has a fixed delay, or that there will be no downtime.

  • How a key is issued and revoked, and what permissions the person or process performing each operation needs.
  • Whether the old and new keys may remain active simultaneously.
  • The order in which changes take effect, including any specified delays and conditions.
  • Which observable indicators confirm issuance, updating, and revocation.

Separate the key’s permissions from the operator’s authority

A secret needs the minimum permissions sufficient for its intended use. For the fictional ‘Catalog’ integration, document the required operation for reading test records and map it to the permissions in the provider’s documentation. Do not broaden permissions merely to simplify replacement.

Separately list the authority required by the person or process that issues the key, updates its storage location, and revokes it. This is a planning step proposed by the authors, not a universal provider permission model. Confirm the exact permission names and whether operations can be assigned to different operators for the chosen service.

Write down the sequence and conditions for proceeding

Manual rotation is prone to errors; OWASP recommends automation or sufficient IT support for the process. Before automating replacement, document who performs each step, its expected result, the condition for proceeding, and the action to take if it fails. The sequence must cover issuance, storage, switching each consumer, verification, and revocation.

If the provider allows keys to overlap, plan to verify the new key before revoking the old one. If overlap is prohibited, prepare a procedure that accounts for this restriction and the documented conditions under which changes take effect. Do not describe such a transition as having no downtime without confirmation. Secure REST endpoints must use HTTPS; transmit the key using the provider’s specified method that keeps it out of the URL: URLs may be retained in web server logs.

Verify the permitted operation with the new key

The following checks are proposed by the authors for your own test integration; they are not an official OWASP procedure. The positive control for ‘Catalog’ is for each of the two consumers to perform a permitted read of your own synthetic record using the new key. Specify the expected record identifier and contents in advance, according to the API contract.

Success means receiving the expected operation result and recording which consumer used the new secret version. A successful HTTP response alone is insufficient. If the intended operation changes data, also verify the expected final state of your own test resource. Do not record the key’s value in the verification results. A single successful request does not prove that other consumers have switched or that there was no downtime.

Confirm revocation of the old key

Secrets that are no longer needed or may have been compromised must be revoked to restrict access. Perform the provider’s prescribed revocation and wait for its documented conditions to take effect. Then repeat the previously permitted request with the old key using the same test data you own. The authors’ verification criterion is that the old key no longer grants access to the test resource.

Compare the result with the new key’s positive control so that general service unavailability is not mistaken for successful revocation. Do not prescribe a specific HTTP status code in advance: use the provider’s contract and the actual operation result. A network error alone does not confirm revocation. If the result is ambiguous, leave the check incomplete.

Record completion and remaining limitations

The plan’s priorities are to establish the provider’s rules and identify consumers first, then confirm the required permissions and procedure, and finally perform both checks. Replacement is complete when all listed consumers have been updated, the new key performs the permitted operation, the old key has been revoked according to the provider’s rules, and the lack of access has been verified. Retain the update time, the person or process responsible, version identifiers without secret values, and verification results: secrets management auditing should reflect when and by whom a secret was updated.

Unknown rules or an unconfirmed result leave the corresponding item open. These checks provide observable evidence for accepting a specific replacement, but they do not guarantee the security of the entire integration. To review the plan and the boundaries of your server integration, you can start with a free website or web-product audit from CheckMyApp.

Sources and documentation

  1. Secrets Management Cheat Sheet
  2. REST Security Cheat Sheet
CheckMyApp

Check your application’s security.

Enter your web application address and email. Get a free preliminary report and choose the depth of analysis.

Check for free