Scrivio Interview library
LeadershipPrincipal5 min read · updated 12 November 2026

Data binding frameworks made it easy to map HTTP input onto objects, and also caused serious vulnerabilities over the years (mass assignment, Spring4Shell, deserialisation flaws). What lessons would you draw for framework choices and secure defaults in your company?

The lesson is that any feature which maps untrusted input onto arbitrary objects by reflection will keep producing vulnerabilities, because the attacker gets to choose what is set. So the company should default to narrow, explicit input types such as records and DTOs with allow-lists, pick frameworks with secure defaults and a real security response, patch them centrally, teach engineers the bug classes rather than single CVEs, and measure how many endpoints still bind to entities or deserialise polymorphically.

Why this question is asked

Mass assignment in Rails and Spring, the Struts and Spring4Shell class loader exploits, and Java deserialisation flaws in Jackson and native serialisation look like different bugs, but they share one root. At a senior level, interviewers want to see that we can name that root and turn it into company policy, not just remember CVE numbers. In this answer, we will look at what these vulnerabilities have in common, turn that into a few design principles, and then see how a technology leader makes them stick through framework choice, patching, training and measurement.

1What These Vulnerabilities Have in Common

Each of these features saves developers work by taking input from the network and building or filling objects automatically. Data binding walks request parameter names and calls matching setters, including nested paths. Polymorphic deserialisation reads a type name from the payload and creates an instance of that class. Native Java serialisation recreates whole object graphs and runs code in readObject methods while doing it.

In every case, the shape of the input decides which code runs. The developer wrote a class with three intended fields, but the framework will touch anything reachable by reflection. Mass assignment set fields like role. Spring4Shell followed class.module.classLoader to reach the class loader. Deserialisation gadget chains chained ordinary library classes into code execution. The pattern repeats because convenience and reach come from the same mechanism.

One root, many incidents
FeatureWhat the attacker controlsExample outcome
Form data bindingWhich properties get setrole=ADMIN, or class loader access (Spring4Shell)
JSON binding onto entitiesWhich fields of the model changePrice or owner changed by the client
Polymorphic deserialisationWhich class is instantiatedGadget classes run code on load
Native Java serialisationThe whole object graphRemote code execution through readObject

2Principles to Set as Defaults

The first principle is that input types are narrow and explicit. An endpoint receives a record or DTO with only the fields it accepts, validated with Bean Validation, and the service copies values into the domain. A record has no setters, so there is little for a binder to reach, and new entity fields never become inputs by accident.

The second is allow-lists over deny-lists. If a binder must be restricted, use setAllowedFields. If polymorphic JSON is truly needed, enumerate the allowed subtypes with @JsonSubTypes or a PolymorphicTypeValidator instead of default typing. If Java serialisation cannot be removed, configure an ObjectInputFilter that names the allowed classes. A deny-list protects against the attacks we already know; an allow-list also protects against the next one.

The third is that the secure path should be the easy path. If the company starter makes DTO-based controllers the template and the build fails on entity parameters, most teams will never even meet the risky option.

3Framework Choice and Central Patching

When choosing frameworks, I would weigh secure defaults and the maintainers' security response alongside features. Questions worth asking: does the project publish advisories and fix them quickly, are old lines supported long enough, and are dangerous features off by default? Spring, for example, tightened binding after Spring4Shell, and Jackson disabled broad default typing long ago.

Patching must be central, because no team watches CVE feeds on its own. A shared BOM or platform version, automated update pull requests from Renovate or Dependabot, and a software composition scan in CI make a fix a version bump rather than an investigation. The policy needs a clock, for example critical issues patched within seven days, and someone who owns it.

Step throughFrom advisory to patched fleet
  1. Advisory publishedFramework or library CVE
  2. Scanner flags affected servicesSBOM and dependency scan in CI
  3. Platform team bumps the shared BOMOne change, tested once
  4. Exploitable in our setup?Check versions, packaging and features
    YesPatch within the critical windowNoPatch in the normal cycle
  5. Track until every service is updatedDashboard per team

5 steps in order. Play them, or step through them one at a time.

4Train for Bug Classes, Not CVE Numbers

Engineers remember Spring4Shell as a headline, but the useful knowledge is the class of bug: untrusted input choosing what code touches. Training should show one example from each family and then ask people to spot it in their own code. Review checklists should carry the same questions: does this endpoint bind onto an entity, does this JSON accept a type name, does anything read serialised Java objects from outside?

A short internal write-up after each industry incident, explaining whether we were exposed and why, keeps the topic alive and shows that the policy is based on real events.

5Measure Exposure and Drive It Down

Policy without measurement fades. I would build an inventory, mostly automated: count controller methods that take entity types, count uses of Jackson default typing or @JsonTypeInfo with class names, find ObjectInputStream on network input. ArchUnit tests and static analysis can produce these numbers in every build.

Then the numbers go on a dashboard per team with a target, for example zero entity-bound endpoints on public services within two quarters, and new violations blocked at build time. The goal is not to punish teams but to make the remaining risk visible, so it competes fairly with feature work for time.

6Follow-up questions

Should we ban data binding entirely?

No. Binding onto a narrow form object or record is safe and saves a lot of code. The problem is binding onto rich objects with many setters and deep graphs. The policy should restrict the target types, not the mechanism.

How do you convince teams that are busy with features?

Make the safe pattern cheaper than the unsafe one through templates and starters, block only new violations at first so nobody faces a giant backlog, and show the real incidents that motivated the rule. Once the dashboard shows progress, it becomes a normal part of engineering health work.

7Conclusion

In this answer, we saw that mass assignment, Spring4Shell and deserialisation flaws share one root: frameworks that let untrusted input choose which objects and properties are touched. The response is narrow input types and allow-lists as defaults, frameworks chosen partly for their security record, central and timed patching, training on bug classes with matching review questions, and an automated inventory of risky endpoints that the company drives towards zero.

What to say in the interviewAbout 80 seconds aloud

Open with

I'd start by naming the common root. Mass assignment, Spring4Shell and the deserialisation gadget bugs all come from convenience features that let untrusted input decide which objects get created or which properties get set through reflection.

Then, if they want more

As long as we use that style, new variants will appear, so patching individual CVEs isn't enough.

My defaults for the company would be narrow, explicit input types: records or DTOs per endpoint, validated, then mapped into the domain by a service, with allow-lists wherever a binder or deserialiser still needs restricting, and no default typing or native serialisation on external input.

I'd make that the easy path through our starter and templates, and add ArchUnit checks so controllers can't take entity types. On framework choice, I'd weigh secure defaults and how fast maintainers respond to advisories, and keep dependencies on a central BOM with automated update PRs and a clear patch window, say seven days for critical issues.

Training would focus on the bug classes with real examples, and the same questions would go into review checklists. And I'd measure it: an inventory of endpoints that bind to entities or deserialise polymorphically, per team, with a target to drive it to zero and new violations blocked in CI.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Data binding frameworks made it easy to map HTTP input onto objects, and also caused...": https://scrivio-interview-library.netlify.app/spring-boot/mvc-architecture/920316623e/