Tectu / malloy

A cross-platform C++20 library providing embeddable server & client components for HTTP and WebSocket.
BSD 3-Clause "New" or "Revised" License
66 stars 8 forks source link

HTML form: populate() potentially dangerous #118

Closed Tectu closed 2 years ago

Tectu commented 2 years ago

The malloy::html::form class provides a function populate() to pre-fill form fields based on parsed data. This feature is mainly useful to re-populate a form if a user submitted it with incorrect or partially missing data. This way, the user can be presented with an error message and doesn't need to re-enter all of the information.

However, in it's current implementation, this is a potentially dangerous function to use. If this function is called and another user gets served the same form, both users receive the pre-filled data.

The overall mechanism is still desired to keep around. However, modifications are necessary to make this more "safe" out of the box. Ideally, the mechanism would be modified in a way that the original form does not get modified. This can be accomplished through various means:

Tectu commented 2 years ago

This was handled in these commits: