Tip: Choose Save as PDF in the print dialog to download. Use A4 paper size.
Shade in the A or B circle for each question.
Draw a line connecting each item on the left to its match on the right.
| Left column | Right column | |
|---|---|---|
| 1API_KEY = os.environ["API_KEY"] | Avault.rotate("payment-api-key") | |
| 2git secrets --scan | BReads the API key from an environment variable at run time, so the secret is not written in the source code | |
| 3Secrets should be stored in a .env file that is excluded from version control, so they never reach the repository | CScans commits and files for passwords or keys before they are pushed, so leaked secrets are caught early | |
| 4Keys should be rotated regularly, so a leaked or stolen key stops working once it is replaced | DThe API key is hard-coded in the source code, so anyone with repository access can see and misuse it. It should be loaded from an environment variable or a secrets vault. | |
| 5API_KEY = "sk_live_51Hx9a7" | E.env | |
| 6git add .env git commit -m "add config" | FThe .env file containing secrets is committed to the repository. It should be added to .gitignore, and any leaked keys should be rotated. |
Complete each line of code by filling in the missing parts.
Shade in the letter of the line that contains an error.
secrets management — Keeping passwords, API keys and tokens in a protected vault or environment variable, not in source code, and rotating keys and scanning commits for leaks.key = os.getenv("API_KEY")if not api_key:
raise ValueError("Key missing")echo .env >> .gitignorevault.rotate("db_password")if len(leaks) > 0:
block_commit()