Can Reading a File Run Code?
Compare ordinary data parsing with object reconstruction and see why a later validation error can arrive after a side effect.
You’re reading a preview. Premium includes the full lesson and specialist practice. View the full curriculum.
The layout is rejected—but did anything happen first?
A chart importer reads an uploaded layout and checks its width, height, and cells. A layout with invalid dimensions is rejected. That sounds reassuring until we ask what the importer did while reading the bytes.
A data parser returns values to inspect. Some object decoders can invoke behavior while reconstructing the object. If that happens first, rejecting the returned value afterward is too late to prevent it.
Read the events in order
Data path: parse values → validate layout → accept or reject
Object path: reconstruct object and possibly invoke behavior → validate result → accept or reject
The model compares ordinary JSON, a native-object fixture, and a tag handled by an explicitly unsafe YAML loader. The reconstruction event is a harmless modeled marker. Nothing is executed by this page.
Deserialization means rebuilding values or objects from a representation. The useful question is what capabilities the selected decoder has, not whether the upload is described as "encoded."