Probable logic/security bug in $validatesConfirmationOf in /wheels/model/validations.cfm

33 views
Skip to first unread message

Adam Cameron

unread,
May 14, 2021, 9:13:16 AM5/14/21
to CFWheels
Hi. Just cross-posting this from the CFML Slack Channel

 Can someone pls sanity check what I think is a logic/security bug in $validatesConfirmationOf in /wheels/model/validations.cfm? The function is thus:
 
```` 
public void function $validatesConfirmationOf() {
local.virtualConfirmProperty = arguments.property & "Confirmation";
if (
StructKeyExists(this, local.virtualConfirmProperty) && this[arguments.property] != this[local.virtualConfirmProperty]
) {
addError(property = local.virtualConfirmProperty, message = $validationErrorMessage(argumentCollection = arguments));
}
if (arguments.caseSensitive && (Compare(this[arguments.property], this[local.virtualConfirmProperty]) != 0)) {
addError(property = local.virtualConfirmProperty, message = $validationErrorMessage(argumentCollection = arguments));
}
}
````

That first condition circumvents the validation if the confirmation property isn't there at all. That should be a fail straight away, eg:

```
public void function $validatesConfirmationOf() {
local.virtualConfirmProperty = arguments.property & "Confirmation";
    if (!StructKeyExists(this, local.virtualConfirmProperty)) {
        return addError(property = local.virtualConfirmProperty, message = "you MUST specify the confirmation property if yer asking me to validate it!"));
    }
    // rest of it
}
```

Same issue exists in 1.4.x, which is where it's biting me.

Cheers for the eyes.

-- 
Adam

Tom King

unread,
May 14, 2021, 9:14:06 AM5/14/21
to CFWheels
Unless there's something I've forgotten, pretty sure that shouldn't happen - have created an issue:

Adam Cameron

unread,
May 14, 2021, 9:14:59 AM5/14/21
to CFWheels
NB: in the mean time discussed this with Tom King on Slack, and he's raised a ticket. Cheers!

Adam Cameron

unread,
May 14, 2021, 9:15:21 AM5/14/21
to CFWheels
Snap.
Reply all
Reply to author
Forward
0 new messages