This has the risk that the user could construct an HTTP request that included data for fields not in the form sent by the server. Depending on what is done with the data this could, for example, allow someone to edit a field that users aren't supposed to be able to edit.
So if this technique is used, it is important to be aware of potential security issues and include protection against them.
| [reply] |
Hi dorward,
Thanks for pointing out this issue, something that I had not thought about.
Martin
| [reply] |
Definitely. Note, however, that this has slightly different semantics. Not worse, just different. The original example would try to set all desired values, whether they were in the form or not. Further, it would do it in a tightly-controlled manner.
Your example will skip values that aren't in the form (probably desirable), and do it in the order that they're passed in from the web client (probably immaterial - but sometimes you care about the order). Further, it will catch parameters that the OP may not care about (again, probably immaterial - if they get filtered out later). For example, the submit button will show up, I think.
| [reply] |