Secrets Handling for Dev Teams: Keep API Keys Out of Code and Revoke Them on a Leak

Project & Development

Secrets Handling for Dev Teams: Keep API Keys Out of Code and Revoke Them on a Leak

Intermediate | 4 whiteboard pages · Task board: 5 columns (4 parent tasks, 12 subtasks)

Intermediate: Method names appear, but the whiteboard explains the key points. Use the examples as a guide and fill it in, thinking it through for your own situation.

Decide as a dev team how to keep API keys, database passwords, and private keys out of code, chat, and tickets, and how to revoke and replace one when it leaks. A table records where each secret is used, where it lives now, and who owns it, with one home per environment. Page 2 checks three pitfalls, namely old commits that keep a deleted value, screen shares and logs that show it, and laptops that hold production values. Treat a committed value as leaked and revoke it at the provider before rewriting history. A 5 Whys analysis and an impact matrix lead to a no-write rule, a management system, and a pre-commit check. A rotation schedule with a check for what will stop keeps old keys from lingering for fear of breakage. Login passwords people memorize are changed when they leak or seem at risk, not on a schedule. To start, copy the key names from each service's console. The whiteboard has 4 pages, and the task board has 5 columns, 4 parent tasks, and 12 subtasks.

0 Likes 0 Copies Author: WeProcess
secrets management API keys dev team security practices leak response
Sign up free and use this template

Once you have a free account, you can copy this template from the marketplace

Whiteboard preview

Read the whiteboard text as plain text

Handling Secrets in a Dev Team

How to use (4 pages): ① Take stock of your secrets and note where they are scattered → ② Decide where each lives per environment and check the pitfalls → ③ Dig into why they end up in code and choose safeguards → ④ Build the leak procedure and the rotation schedule

1/4 Take stock of secrets

① Goal and scope (start here)

  • Goal e.g. Remove API keys and passwords from code and chat, and be able to stop any leaked one within 30 minutes
  • Scope e.g. Payments, email sending, and the database, across 2 repositories
  • Period and lead e.g. 2 weeks. The dev lead coordinates and everyone splits the checks

② List of secrets (one per row, never write the value itself)

Where it is used Where it lives now Owner Last replaced
Payment API key e.g. Production order processing e.g. Server environment variable e.g. Dev lead e.g. Unknown (no record)
DB password e.g. Production and testing apps e.g. Hard-coded in a config file e.g. Infrastructure owner e.g. More than a year ago
Certificate private key e.g. Production web server e.g. A file on the server e.g. Infrastructure owner e.g. Renewed before the last expiry
Email-sending key e.g. Sending notification emails e.g. Still pasted in chat e.g. Not decided e.g. Never replaced since it was created

③ Scattered: code and config files

  • e.g. An API key is hard-coded in test code
  • e.g. The sample config file holds a real value
  • For each one you find, write the file name and which value it is

④ Scattered: chat and tickets

  • e.g. A how-to ticket has a password written in it
  • e.g. Pasted a value in chat along with a message to use this key
  • For each one you find, write where it is and roughly when

⑤ Scattered: personal devices

  • e.g. A downloaded certificate key file is still on the desktop
  • e.g. A certificate password is saved in a notes app
  • For each one you find, write whose device it is and which value

2/4 Draw up the storage places

⑥ Storage rules per environment (where to move the secrets in ②)

Development Testing Production
Storage place e.g. Config file on each device (development values only) e.g. Secrets management service e.g. Secrets management service
Who can read e.g. All developers e.g. Developers and testers e.g. Two operators and the app itself
How it is delivered e.g. Each person pulls it from the management service e.g. Loaded automatically at deploy time e.g. Loaded at runtime and never shown to people
Where never to write e.g. Code, chat, tickets e.g. Code, chat, tickets e.g. Code, chat, tickets, personal devices

⑦ Pitfall: a committed value stays in history

  • What happens: e.g. Deleting it from the file leaves it in past commits, and anyone who can see the repository can read it
  • How to check: e.g. Check whether any secret from ② was ever committed, using repository search or the results of a secret-detection tool
  • How to prevent: e.g. Treat a committed value as leaked and revoke and replace it at the provider before rewriting history
  • Inspection result: e.g. Checked 2 repositories. Found 1 → replaced it with the steps in ⑮

⑧ Pitfall: values show on screens and in logs

  • What happens: e.g. Screen shares, screenshots, error logs, and debug output show the value as it is
  • How to check: e.g. Check in the log settings and the log output that secret fields are masked
  • How to prevent: e.g. Add masking before anything reaches the logs, and close config files before sharing your screen
  • Inspection result: e.g. The error log showed the DB password next to the connection target → added masking

⑨ Pitfall: config files kept on personal devices

  • What happens: e.g. A production value stays in a config file on a personal laptop and still works after the device is lost or the person moves on
  • How to check: e.g. Ask the device owners in ⑤ and the owners in ② whether any development config file holds a production value, then look at the key name, memo, and usage record in the provider console (what you can see differs by service, so check its guide)
  • How to prevent: e.g. Keep only development values on personal devices and have production values read from the management service at runtime
  • Inspection result: e.g. Production keys on 2 devices → deleted them and replaced those keys

3/4 Dig into why they get in

⑩ 5 Whys (pick one from ③–⑤ and ⑦–⑨ and ask why it got in, 5 times)

  1. Why 1 e.g. Why was the production DB password hard-coded in a config file? → To get it running quickly on my machine
  2. Why 2 e.g. Why hard-code it to run quickly? → Nobody had decided where to read the value from
  3. Why 3 e.g. Why had that not been decided? → Storage was not separated by environment
  4. Why 4 e.g. Why was it not separated? → In the early days one person developed alone and it caused no trouble
  5. Why 5 e.g. Why was it not revisited as the team grew? → Nobody was responsible for handling secrets
  6. Root cause e.g. There are no rules for storage and delivery, and nobody owns them

⑪ Rank the secrets in ② by impact if leaked and ease of replacing

Vertical axis: Impact if leaked (higher = bigger) / Horizontal axis: Ease of replacing (left = harder, right = easier)

  • High impact, hard to replace First build a way to replace it without stopping anything e.g. DB password (many apps use it)
  • High impact, easy to replace Move it to the management service and replace it right away e.g. Payment API key (a new key can be issued in the console)
  • Low impact, hard to replace Plan a schedule and move them in turn e.g. Connection password of an old internal tool
  • Low impact, easy to replace Move them together at the next replacement e.g. Email-sending key for development

⑫ The no-write rule

  • e.g. Never write values in code, chat, or tickets. Write only where they are kept
  • e.g. Put dummy values in the sample config file
  • Write who owns the rule and when it starts

⑬ Management system

  • e.g. Pick one secrets management service and keep every storage place there
  • e.g. Split who can read by role, and limit production to 2 people
  • Write who owns the system and when it starts

⑭ Pre-commit watch

  • e.g. Run a secret-detection tool before every commit on every device
  • e.g. Add a no-hard-coded-values item to the code review checklist
  • Write who owns the watch and when it starts

4/4 Set up steps and schedule

⑮ The 5 steps when a secret leaks (apply to the secret ranked high-impact in ⑪)

  1. Notify Whoever notices tells the team right away e.g. Write what appeared and where to the contact the team agreed on. No blame
  2. Revoke Stop the old value at the provider e.g. Disable the leaked key in the payment service console
  3. Replace Issue a new value and swap it into storage e.g. Put the new key in the management service and reload production
  4. Check traces Look for signs it was used e.g. Check the provider usage history and billing for use you do not recognize
  5. Record the cause Record why it got out and feed it back into the system e.g. Dig with ⑩ and add rules to ⑫–⑭

⑯ Rotation schedule (start from the top right and top left of ⑪)

Next replacement How to check what will stop Owner
Payment API key e.g. Week 2 of this month e.g. Run old and new keys side by side, confirm orders go through, then stop the old one e.g. Dev lead
DB password e.g. Week 1 of next month e.g. Count the apps that use it in ②, replace in testing first, then production e.g. Infrastructure owner
Certificate private key e.g. One month before expiry e.g. Count the servers that use the certificate in ②, swap it in testing and confirm connections, then production e.g. Infrastructure owner
Email-sending key e.g. Within this month (earlier because it was pasted in chat) e.g. Check in testing that notification emails arrive e.g. One developer

⑰ Note for new members (hand it over on day one)

  • Where not to write and where to store e.g. Never write values in code, chat, or tickets. Read them from the place in ⑥
  • Pitfall: leaving a key because replacing it might stop things What happens e.g. An old key is used for years and a leak goes unnoticed How to check e.g. See that ⑯ has an owner and a date in every row How to prevent e.g. Run old and new side by side, then stop the old one
  • If you think it may have leaked e.g. No one will be blamed, so tell the contact in step 1 of ⑮ right away

Task board contents

Not started 16 items

Inventory secrets

On page 1, write the goal and scope, then list your secrets and where they are scattered. With the list done, pages 2 and later can decide storage and causes from it. Press Ctrl+F (⌘F on Mac) and type 3/4 to jump to page 3.

Copy key names

Open the API key list in the console of each external service you use, such as payments, email, or cloud, and copy each key name and use into the rows of board ②. It takes about 15 minutes, and you are done when 3 or more names are listed. Never write the value itself.

Set goal and scope

On board ①, write the goal, the target services and repositories, and the period and lead. Done when the 3 notes are filled.

Note where they sit

On boards ③–⑤, write where secrets sit in code and config files, chat and tickets, and personal devices. Done when each frame has at least 1 real example.

Plan storage

On page 2, decide where each secret in ② lives per environment and check 3 pitfalls. Once each has one home, page 3 makes it easier to choose safeguards.

Set rules per env

On the table in board ⑥, write the storage place, who can read, how it is delivered, and where never to write for development, testing, and production. Done when all 12 cells are filled.

Check history, logs

On boards ⑦ and ⑧, check whether values remain in past commits or show on screens and in logs, and write the result on the inspection note.

Check device files

On board ⑨, use the devices you wrote in ⑤ as clues and ask the owners whether production values are in development config files, then write the result. If you find a production value, replace that key with the steps in ⑮.

Dig into causes

On page 3, dig into why secrets get into code and chat, and choose the secrets to handle first and the safeguards. What you decide here is the basis for the steps and schedule on page 4.

Ask why five times

On board ⑩, pick one item from ③–⑤ and ⑦–⑨, ask why it got in five times, and write the root cause in the last step.

Rank impact vs ease

On board ⑪, sort the secrets in ② into 4 by impact if leaked and ease of replacing. Items in the top right and top left are tackled first.

Choose safeguards

On boards ⑫–⑭, decide one each of the no-write rule, the management system, and the pre-commit watch. Done when owners and start dates are written.

Build procedure

On page 4, build the steps to revoke and replace a leaked secret, the rotation schedule, and the briefing for new members. Copy the finished steps into the team document and hold them in the Awaiting review column until they are read through together.

Define the 5 steps

In the 5 steps of ⑮, write who is told, where to revoke, and what to check. Try them on one secret ranked high-impact in ⑪, and you are done when nothing is unclear.

Plan the rotations

On the table in ⑯, write the next replacement time, how to check what will stop, and the owner for each secret. Done when every row has a time.

New-hire guide

On ⑰, write where not to write and where to store, why not to leave replacement undone, and who to tell if you think it leaked. Done when a new member can read it on day one.

Taking inventory 0 items

Moving to safe places 0 items

Awaiting review 0 items

Done 0 items

← Back to templates

Preview mode Secrets Handling for Dev Teams: Keep API Keys Out of Code and Revoke Them on a Leak

Whiteboard preview

① Goal and scope (start here) ② List of secrets (one per row, never... ③ Scattered: code and config files ④ Scattered: chat and tickets ⑤ Scattered: personal devices ⑥ Storage rules per environment (wher... ⑦ Pitfall: a committed value stays in... ⑧ Pitfall: values show on screens and... ⑨ Pitfall: config files kept on perso... ⑪ Rank the secrets in ② by impact if ... High impact, hard to replace High impact, easy to replace Low impact, hard to replace Low impact, easy to replace ⑫ The no-write rule ⑬ Management system ⑭ Pre-commit watch ⑮ The 5 steps when a secret leaks (ap... ⑯ Rotation schedule (start from the t... ⑰ Note for new members (hand it over ... Handling Secrets ... How to use (4 pag... Goal and the stat... Rules and storage... Scatter spots and... Causes and lessons 1/4 Take stock of sec... Ctrl+F / ⌘F : 2/4... → 2/4 2/4 Draw up the stora... ↙ 3/4 Goale.g. Remove API keys and passwords from code and chat, and be able to stop any leaked one within 30 minutes Scopee.g. Payments, email sending, and the database, across 2 repositories Period and leade.g. 2 weeks. The dev lead coordinates and everyone splits the checks Where it is used Where it lives now Owner Last replaced Payment API key e.g. Production order processing e.g. Server environment variable e.g. Dev lead e.g. Unknown (no record) DB password e.g. Production and testing apps e.g. Hard-coded in a config file e.g. Infrastructure owner e.g. More than a year ago Certificate priva... e.g. Production web server e.g. A file on the server e.g. Infrastructure owner e.g. Renewed before the last expiry Email-sending key e.g. Sending notification emails e.g. Still pasted in chat e.g. Not decided e.g. Never replaced since it was created e.g. An API key is hard-coded in test code e.g. The sample config file holds a real value For each one you find, write the file name and which value it is e.g. A how-to ticket has a password written in it e.g. Pasted a value in chat along with a message to use this key For each one you find, write where it is and roughly when e.g. A downloaded certificate key file is still on the desktop e.g. A certificate password is saved in a notes app For each one you find, write whose device it is and which value Development Testing Production Storage place e.g. Config file on each device (development values only) e.g. Secrets management service e.g. Secrets management service Who can read e.g. All developers e.g. Developers and testers e.g. Two operators and the app itself How it is delivered e.g. Each person pulls it from the management service e.g. Loaded automatically at deploy time e.g. Loaded at runtime and never shown to people Where never to write e.g. Code, chat, tickets e.g. Code, chat, tickets e.g. Code, chat, tickets, personal devices What happens: e.g. Deleting it from the file leaves it in past commits, and anyone who can see the repository can read it How to check: e.g. Check whether any secret from ② was ever committed, using repository search or the results of a secret-detection tool How to prevent: e.g. Treat a committed value as leaked and revoke and replace it at the provider before rewriting history Inspection result: e.g. Checked 2 repositories. Found 1 → replaced it with the steps in ⑮ What happens: e.g. Screen shares, screenshots, error logs, and debug output show the value as it is How to check: e.g. Check in the log settings and the log output that secret fields are masked How to prevent: e.g. Add masking before anything reaches the logs, and close config files before sharing your screen Inspection result: e.g. The error log showed the DB password next to the connection target → added masking What happens: e.g. A production value stays in a config file on a personal laptop and still works after the device is lost or the person moves on How to check: e.g. Ask the device owners in ⑤ and the owners in ② whether any development config file holds a production value, then look at the key name, memo, and usage record in the … How to prevent: e.g. Keep only development values on personal devices and have production values read from the management service at runtime Inspection result: e.g. Production keys on 2 devices → deleted them and replaced those keys 3/4 Dig into why they... → 4/4 4/4 Set up steps and ... ⑩ 5 Whys (pick on... Why 1 e.g. Why was the production DB password hard-coded in a config file? → To get it running quickly on my machine Why 2 e.g. Why hard-code it to run quickly? → Nobody had decided where to read the value from Why 3 e.g. Why had that not been decided? → Storage was not separated by environment Why 4 e.g. Why was it not separated? → In the early days one person developed alone and it caused no trouble Why 5 e.g. Why was it not revisited as the team grew? → Nobody was responsible for handling secrets Root cause e.g. There are no rules for storage and delivery, and nobody owns them Vertical axis: Im... First build a way to replace it without stopping anythinge.g. DB password (many apps use it) Move it to the management service and replace it right awaye.g. Payment API key (a new key can be issued in the console) Plan a schedule and move them in turne.g. Connection password of an old internal tool Move them together at the next replacemente.g. Email-sending key for development e.g. Never write values in code, chat, or tickets. Write only where they are kept e.g. Put dummy values in the sample config file Write who owns the rule and when it starts e.g. Pick one secrets management service and keep every storage place there e.g. Split who can read by role, and limit production to 2 people Write who owns the system and when it starts e.g. Run a secret-detection tool before every commit on every device e.g. Add a no-hard-coded-values item to the code review checklist Write who owns the watch and when it starts NotifyWhoever notices tells the team right awaye.g. Write what appeared and where to the contact the team agreed on. No blame RevokeStop the old value at the providere.g. Disable the leaked key in the payment service console ReplaceIssue a new value and swap it into storagee.g. Put the new key in the management service and reload production Check tracesLook for signs it was usede.g. Check the provider usage history and billing for use you do not recognize Record the causeRecord why it got out and feed it back into the systeme.g. Dig with ⑩ and add rules to ⑫–⑭ Next replacement How to check what... Owner Payment API key e.g. Week 2 of this month e.g. Run old and new keys side by side, confirm orders go through, then stop the old one e.g. Dev lead DB password e.g. Week 1 of next month e.g. Count the apps that use it in ②, replace in testing first, then production e.g. Infrastructure owner Certificate priva... e.g. One month before expiry e.g. Count the servers that use the certificate in ②, swap it in testing and confirm connections, then production e.g. Infrastructure owner Email-sending key e.g. Within this month (earlier because it was pasted in chat) e.g. Check in testing that notification emails arrive e.g. One developer Where not to write and where to storee.g. Never write values in code, chat, or tickets. Read them from the place in ⑥ Pitfall: leaving a key because replacing it might stop thingsWhat happens e.g. An old key is used for years and a leak goes unnoticedHow to check e.g. See that ⑯ has an owner and a date in every rowHow to prevent e.g. Run old and new side by side, then stop the… If you think it may have leakede.g. No one will be blamed, so tell the contact in step 1 of ⑮ right away → 2/4 Draw up the stora... ↙ 3/4 Dig into why they... → 4/4 Set up steps and ...
100%

Drag to move, scroll to zoom