Nested and Dotted Key Injection
Test whether a bracketed or dotted key path reaches a nested field the flat schema does not expose, since a parser that maps key paths can write where the schema never declared anything
Use when: the parser accepts a structured body and nested key paths have not been exercised
Avoid when: the parser flattens nothing and a test confirms a dotted key is rejected as unknown
Procedure
- Confirm the boundary permits the write and identify the synthetic record you will update.
- Send an update using a dotted or bracketed key that targets a nested field not in the schema.
- Read the object back, including its nested structure, and compare against the captured state.
- Try one alternate notation to see whether the mapping is notation-specific or general.
- Record which notation reached the nested field, and the path it wrote to.
- Note whether the flat equivalent of the same field is rejected, since the difference is the finding.
Signals
- A dotted key writes to a nested field while the flat equivalent is rejected
- Bracket notation reaches a field the schema declares nowhere
- The stored object gains a key containing a literal dot rather than nesting
- A control flat unknown key is rejected while the notated one is accepted
Patterns
1. Notation pair
flat: {internal.flag: true} -> rejected, stored unchanged
bracket: {internal[flag]: true} -> stored under a nested path
2. Read-back rule
read the whole object including nested keys, because a notation can either nest the value or store a literal dotted key
3. Control note
the flat unknown key is the control that proves the rejection policy exists for one form but not the other
Pitfalls
- Testing only one notation and concluding the whole class is safe
- Not distinguishing a stored literal dotted key from a nested field
- Omitting the flat control, which is what makes the difference visible
Done when
- At least two notations are tested with read-back results recorded for each
- A flat control result is recorded alongside the notated attempts