secret wrapper type
A small class that holds a secret and refuses to print it, so it can travel through code without leaking into logs.
In more detail
The type prints a masked form, such as the last four characters, and needs an explicit call such as reveal to read the real value, which review can search for. Printing becomes a decision the type makes once instead of every call site.
Example
The course's Secret type prints only the last four characters and needs an explicit reveal call to read the real value, which review can search for.Related terms
- redaction — Removing or hiding sensitive values, such as tokens or personal data, before data is logged, displayed or shared.
- secret lease — A borrowed copy of a secret that comes with an end time, after which it must not be used and a fresh copy must be fetched.
Taught in
- Why Secrets Leak — Application Security & Threat Modeling for Engineers
- Moving To A Secret Manager — Application Security & Threat Modeling for Engineers