mutated × unstructured — blows up live on input you didn't expect
Integration Crash on Unexpected Input
Trusting an external payload's shape, then mutating local state from it.
01the recipe
In the wild
compound ofImpure FunctionsCWE-1108 Global RelianceLack of Input ValidationCWE-20 Input ValidationcompoundCWE-248 Uncaught ExceptionCWE-754 Unchecked Condition
example.py
# SMELL: trust a third party's shape; mutate local state from it.
# (impure-functions / external read x lack-of-input-validation)
resp = requests.get(url).json() # third party, shape not guaranteed
user.age = resp["profile"]["age"] # KeyError the day they rename a field
# -- first seen live, in the demo
# RIGHT: validate at the boundary; fail with a clear, handled error.
data = UserSchema.parse(resp) # parse, don't trust
user.age = data.profile.ageThe crash isn't in your logic -- it's the contract you never enforced at the edge. It appears the first time the integration sends a shape you didn't anticipate.
// observed
unexpected: KeyError 'profile' when their API changes validated: a clear ValidationError you handle, not a 500
02weakness catalog
Mapped weaknesses (CWE)
On its own, this defect is catalogued by MITRE as one or more of these weaknesses. The exploitable vulnerability usually appears only when it chains or combines with another.