Grails

Refactor bindData to remove 3 param form with "excludes" list and replace with 3 param form that takes Map as 3rd param with "includes" and "excludes" support

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 0.5.6
  • Component/s: None
  • Labels:
    None

Description

This change needs to be made because the "excludes" behaviour is insecure as domain classes change over time, but even more annoying, is that it is much harder to work out what to exclude than what to include, as you can look at the form and easily tell what to include!

Hey, I wrote the original so I can complain about it too

Issue Links

Activity

Hide
Lee Butts added a comment -

Hi Marc,

made the changes you suggested along with matching tests.

cheers

Lee

Show
Lee Butts added a comment - Hi Marc, made the changes you suggested along with matching tests. cheers Lee
Hide
Marcel Overdijk added a comment -

Note that the parameters are named "include" and "exclude"

Example usage:

def user = User.get(params.id)
bindData(user, params, [include: "firstName", "lastName", "email"]])

In this case it can be avaoided that a password is updated by hacking submitted form data..

Show
Marcel Overdijk added a comment - Note that the parameters are named "include" and "exclude" Example usage: def user = User.get(params.id) bindData(user, params, [include: "firstName", "lastName", "email"]]) In this case it can be avaoided that a password is updated by hacking submitted form data..
Hide
Graeme Rocher added a comment -

Bulk closing bunch of resolved issues

Show
Graeme Rocher added a comment - Bulk closing bunch of resolved issues

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: