When the database storage path for form definitions was
implemented, guarding the form_definition table against direct
DataHandler access was omitted.
This change re-implements a guard for storing in the database:
* FormDefinitionPersistenceGuard – request-scoped service
holding pending invocation tokens. Each token covers the
command, the record identifier, and an HMAC-SHA3-384 over
all ksort-ordered field-pairs, binding the grant to the
exact entity passed to DataHandler. allowInvocation()
returns false on duplicates; consumeInvocation() enforces
single-use after hook verification.
* FormDefinitionDataHandlerHook – registered as
processDatamapClass and processCmdmapClass:
- processDatamap_preProcessFieldArray verifies command,
identifier, and field HMAC; nullifies the field array
on mismatch.
- processCmdmap blocks unauthorised delete commands by
setting $commandIsProcessed = true.
* FormDefinitionRepository wraps each DataHandler call
(add/update/remove) in allowInvocation / try-finally
consumeInvocation, passing the exact fields sent to
DataHandler so the hook can verify the full entity.