Why Activation Codes Should Be Treated Like Secrets
The previous post covered how to protect a QR code. This one takes the step back: why an activation code belongs in the same class as an API key or a password, and what engineering habits follow from that classification. The argument is short. The habits are where teams slip.
What makes something a secret
A useful test has three questions:
- Does possession of the value grant access to something valuable?
- Is the value unguessable but otherwise unprotected, meaning nothing else checks who is using it?
- Does leaking it cause harm that you cannot fully undo?
An activation code answers yes to all three. Holding it lets you claim a paid profile, nothing in the QR code checks who is scanning, and once a profile is installed on the wrong device it cannot be moved back. That is a bearer credential, so it gets bearer-credential handling.
Consequences of the classification
It does not go where ordinary data goes. Configuration files, source control, spreadsheets, chat messages and ticket comments are all places where secrets leak. If your support workflow involves pasting activation strings into a ticket, the workflow is the vulnerability.
It has an owner and a lifetime. Secrets have a creation point, a short intended window of use, and an end. For an activation code, creation is the order, use is the first successful download, and the end is installation or expiry. A secret with no defined end tends to live forever in someone's inbox.
It is handled with least privilege. Most systems that touch an order do not need the code: reporting, analytics, billing and most of support. Only the delivery path needs it. Draw that boundary in your architecture, not only in your policy.
Practical rules for engineers
- Fetch the secret just in time, from the secrets store, at the moment of delivery. Do not copy it into the order record, the job payload or the message queue.
- Pass references, not values. Services exchange an ICCID or an order ID, and the one service that needs the secret resolves it.
- Make the type system help. Wrap the value in a type that refuses to print itself:
class Secret:
__slots__ = ("_value",)
def __init__(self, value: str):
self._value = value
def reveal(self) -> str:
return self._value
def __repr__(self) -> str:
return "Secret(***)"
__str__ = __repr__
code = Secret("LPA:1$smdp.example.com$abc123")
print(code) # Secret(***)
logger.info("issued %s", code) # also safe
Explicit reveal() calls are easy to find in review and in a code search, which is the point.
Detecting leaks
Prevention is never complete, so add detection:
- Pattern scanning. Scan logs, error reports, source repositories and data warehouses for the
LPA:1prefix. - Canary values. Seed a few fake codes in test data and alert if one appears anywhere unexpected.
- Usage anomalies. Track downloads per code. A code that is attempted from several unrelated networks, or repeatedly after it was consumed, is suspicious.
Incident response
Decide in advance what you do when a code leaks. A workable plan has four steps:
- Identify which codes were exposed, using the order and the time window.
- Check the status of each profile. If it is not yet installed, invalidate or replace it.
- If it was installed, work out by whom, and contact the customer when it was someone else.
- Fix the path that leaked and add a detection rule so that it does not return.
The ability to invalidate a code quickly is a design requirement. If your only option is to ask the supplier by email, you will be slow when it matters.
What about the customer?
Customers will treat the QR code like a coupon: a screenshot in a group chat, a photo sent to a friend who is traveling too. You cannot stop every case, but you can reduce the damage with short expiry windows, clear wording that the code works once and for one device, and a confirmation code on higher-value plans.
Culture, not just controls
The habit that matters most is the question "is this a secret?" at design review, asked about every identifier that grants access. Teams that ask it early end up with tokens that are generated safely, stored separately and logged by reference. Teams that do not ask it end up searching their logs after an incident.
Takeaways
- Classify activation codes as bearer secrets because they meet every test for one.
- Keep them out of ordinary data paths, pass references instead of values, and resolve them only at delivery.
- Add detection, define a response plan, and keep invalidation fast.
About the author: I work on content and web development at eSIMCircle, a travel eSIM provider. This series comes from the engineering side of that work.
About the author
- eSIMCircle provides affordable global eSIM plans with reliable data in 200+ countries.
Comments
Join the discussionNo comments yet. Be the first to comment.
